JP2004038586A - Data processor, and system and method for processing data - Google Patents

Data processor, and system and method for processing data Download PDF

Info

Publication number
JP2004038586A
JP2004038586A JP2002195123A JP2002195123A JP2004038586A JP 2004038586 A JP2004038586 A JP 2004038586A JP 2002195123 A JP2002195123 A JP 2002195123A JP 2002195123 A JP2002195123 A JP 2002195123A JP 2004038586 A JP2004038586 A JP 2004038586A
Authority
JP
Japan
Prior art keywords
register
instruction
program
registers
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2002195123A
Other languages
Japanese (ja)
Other versions
JP3698125B2 (en
Inventor
Tomohisa Shiga
志賀 知久
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sony Corp
Original Assignee
Sony Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority to JP2002195123A priority Critical patent/JP3698125B2/en
Application filed by Sony Corp filed Critical Sony Corp
Priority to US10/508,802 priority patent/US7581083B2/en
Priority to EP03715417A priority patent/EP1489493A1/en
Priority to KR10-2004-7015082A priority patent/KR20040097212A/en
Priority to PCT/JP2003/003716 priority patent/WO2003081422A1/en
Publication of JP2004038586A publication Critical patent/JP2004038586A/en
Application granted granted Critical
Publication of JP3698125B2 publication Critical patent/JP3698125B2/en
Priority to US11/821,424 priority patent/US20070250685A1/en
Priority to US11/821,447 priority patent/US20080046470A1/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To reduce the memory capacity of a ROM, etc., for storing program data by varying the length of an instruction in response to a register usage frequency, and also setting the instruction being short in length in the register which frequently perform access. <P>SOLUTION: A data processing system includes: a program generating device 200 for compressing the number of instruction bits to specify the register ri based on the usage frequency of the register ri, describing register kinds in the instruction structure of the program, and also generating compressed programs AP being different in instruction length; and a data processor 100 for obtaining the compressed programs AP generated by the program generating device 200 so as to decode the register kinds, restoring the number of the instruction bits to specify the register ri based on the register kinds, designating the plurality of registers ri based on the program which is restored to have the instruction structure with the prescribed instruction length, and performing arbitrary calculation. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、システムプログラムに基づいて各種データ処理をする中央演算装置(CPU)やマイクロプロセッサユニット(MPU)等、また、プログラム可能な論理演算素子(PLD)や、これらの組み込み電子機器等に適用して好適なデータ処理システム、データ処理装置及びデータ処理方法に関する。
【0002】
詳しくは、複数のレジスタを指定して任意の演算を実行するデータ処理装置を備え、プログラム作成系で作成された圧縮プログラムを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定の命令長の命令構造を有するプログラムを復元するようにして、プログラムデータを格納するROM等のメモリ容量を低減できるようにすると共に、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減できるようにしたものである。
【0003】
【従来の技術】
近年、携帯端末装置や、電子カード、情報処理装置等の各種電子機器にCPU(中央演算処理装置)を含むマイクロプロセッサが使用される場合が多くなってきた。この種のプロセッサには命令実行演算部の他に命令実行プログラムを格納するための読み出し専用メモリ(以下、ROMという)や、命令実行演算処理に使用される多くのレジスタ等が実装されている。
【0004】
従来方式のマイクロプロセッサによれば、任意の電子機器に当該プロセッサを組み込んで用いる場合、ある動作を行う命令はその動作と、その動作を行うための命令とが一対一に対応していた。つまり、使用頻度が高いレジスタも、使用頻度が低いレジスタも、当該レジスタを指定するための命令ビット数を同等にして一律の長さの命令により作成されたプログラムが使用される場合が多い。このことで、固定長の命令がROMに格納されて使用される。
【0005】
他方で、半導体集積回路技術の発展により、多大な数のレジスタをプロセッサ(以下データ処理装置ともいう)内に実装することが可能になってきた。この場合、レジスタを特定するための命令ビット数も益々多く必要になる。例えば、1024個のレジスタが実装される場合、1024個のレジスタ中でその1つを特定するためには、命令ビットとして10ビットが必要となる。しかし、実際のプログラムでは全てのレジスタへのアクセス頻度は一様ではなく、アクセス頻度に斑がある。頻繁にアクセスされるレジスタの番号は一般的にコンパイラによって決定される。
【0006】
【発明が解決しようとする課題】
ところで、従来方式のデータ処理装置によれば、命令実行プログラムを格納するROMを実装するに当たり以下のような問題がある。
【0007】
▲1▼ 命令実行プログラムのコード全体を眺めてみると、レジスタを指定するための例えば、10ビットの命令ビット内、この10ビット全体が一様に使用されることが少ない。従って、命令実行プログラムを格納するメモリ中(例えばROMやフラッシュメモリ)に無駄なビットが多く存在してしまう。これにより、全てのレジスタを単一の命令ビット数で表現する方法は効率良くROMを使用することに関して妨げとなる。
【0008】
▲2▼ また、メモリセルや論理演算素子から成るプログラマブル・ロジック・デバイス(Programmable Logic Device;PLD)によりマイクロプロセッサ等を構築しようとした場合に、同一半導体チップ上に命令実行演算部を配置し、その周辺部にレジスタアレイや、ROM等を配置する方法が考えられる。この場合に、プロセッサの多機能化の要求から命令実行プログラムが多くなると、このプログラムを格納するROMのメモリ容量が多く必要になる。従って、メモリセルがROM構築に占有されてしまい、多くのメモリセルをレジスタに割り当てることが困難になる。
【0009】
そこで、この発明はこのような従来の課題を解決したものであって、レジスタの使用頻度に応じて命令の長さを可変できるようにすると共に、頻繁にアクセスするレジスタには短い長さの命令をセットできるようにし、プログラムデータを格納するROM等のメモリ容量を低減できるようにしたデータ処理システム、データ処理装置及びデータ処理方法を提供することを目的とする。
【0010】
【課題を解決するための手段】
上述した課題は、一方で、所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、他方で、当該プログラムと複数のレジスタとを使用してデータを処理するシステムであって、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムを作成するプログラム作成装置と、このプログラム作成装置で作成された圧縮プログラムを取得してレジスタ種類を解読し、レジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行するデータ処理装置とを備えることを特徴とするデータ処理システムによって解決される。
【0011】
本発明に係るデータ処理システムによれば、一方で、所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、他方で、当該プログラムと複数のレジスタとを使用してデータを処理する場合に、プログラム作成装置ではレジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムが作成される。
【0012】
データ処理装置では、プログラム作成装置で作成された圧縮プログラムを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算が実行される。
【0013】
従って、プログラム作成系ではレジスタの使用頻度に応じて命令の長さを可変できるので、頻繁にアクセスするレジスタに短い長さの命令をセットすることができる。これにより、プログラム実行系ではROM等に圧縮した命令をセットすることができ、プログラムデータを格納するROM等のメモリ容量を低減することができる。また、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができる。
【0014】
本発明に係るデータ処理装置は、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数が予め圧縮されると共に、当該プログラムの命令構造の中にレジスタ種類が記述された命令長の異なる圧縮プログラムに基づいてデータを処理する装置であって、複数のレジスタと、レジスタを指定するための圧縮プログラムを記憶する記憶手段と、この記憶手段から圧縮プログラムを読み出してレジスタ種類を解読し、当該レジスタ種類に基づいてレジスタを指定するための命令ビット数を復元する命令解読復元手段と、この命令解読復元手段によって復元された所定長さの命令に基づいてレジスタを指定して任意の演算を実行する命令実行演算手段とを備えることを特徴とするものである。
【0015】
本発明に係るデータ処理装置によれば、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数が予め圧縮されると共に、当該プログラムの命令構造の中にレジスタ種類が記述された命令長の異なる圧縮プログラムに基づいてデータを処理する場合に、記憶手段には複数のレジスタ中から当該レジスタを指定するための圧縮プログラムが記憶される。命令解読復元手段では、この記憶手段から圧縮プログラムを読み出してレジスタ種類が解読され、このレジスタ種類に基づいて当該レジスタを指定するための命令ビット数が復元される。これを前提にして、命令実行演算手段では命令解読復元手段によって復元された所定の命令長のプログラムに基づいてレジスタを指定して任意の演算を実行するようになされる。
【0016】
従って、レジスタの使用頻度に応じて可変された命令の長さの圧縮プログラムであって、頻繁にアクセスするレジスタには短い長さの命令がセットされた、圧縮プログラムデータを記憶手段に格納することができるので、そのメモリ容量を低減することができる。これにより、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができる。
【0017】
本発明に係るデータ処理方法はプログラム作成系で所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、プログラム実行系で当該プログラムと複数のレジスタとを使用してデータを処理する方法であって、プログラム作成系では、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムを作成し、プログラム実行系では、プログラム作成系で作成された圧縮プログラムを取得してレジスタ種類を解読し、ここで解読されたレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、ここで復元された所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行することを特徴とするものである。
【0018】
本発明に係るデータ処理方法によれば、プログラム作成系で所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、プログラム実行系で当該プログラムと複数のレジスタとを使用してデータを処理する場合に、プログラム作成系ではレジスタの使用頻度に応じて命令の長さを可変できるので、頻繁にアクセスするレジスタに短い長さの命令をセットすることができる。
【0019】
従って、プログラム実行系ではROM等に圧縮した命令をセットすることができ、プログラムデータを格納するROM等のメモリ容量を低減することができる。また、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができる。
【0020】
【発明の実施の形態】
続いて、この発明に係るデータ処理システム、データ処理装置及びデータ処理方法の一実施の形態について、図面を参照しながら説明をする。
【0021】
(1)実施形態
図1は本発明に係る実施形態としてのデータ処理システム100の構成例を示すブロック図である。
この実施形態では複数のレジスタを指定して任意の演算を実行するデータ処理装置を備え、プログラム作成系で作成された圧縮プログラムを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定の命令長の命令構造を有するプログラムを復元するようにして、プログラムデータを格納するROM等のメモリ容量を低減できるようにすると共に、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減できるようにしたものである。
【0022】
また、プログラム作成系ではレジスタの使用頻度に応じて命令の長さを可変できるようにすると共に、頻繁にアクセスするレジスタには短い長さの命令をセットできるようにする。
【0023】
図1に示すデータ処理システム10は、一方で、所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、他方で、当該プログラムと複数のレジスタとを使用してデータを処理するシステムである。データ処理システム10ではプログラム作成系Iを成すプログラム作成装置200が準備される。新規に設計製造されるデータ処理装置100を動作させるためのプログラムを作成するためである。データ処理装置100はプログラム実行系IIを構成し、当該装置100内には命令実行演算手段や、記憶手段、複数のレジスタ等が実装される。
【0024】
プログラム作成装置200では、データ処理装置100でレジスタを使用する頻度に基づいて当該レジスタを指定するための命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムAPを作成するようになされる。データ処理装置100に実装されるプログラム格納用の記憶手段のメモリ容量を削減するためである。
【0025】
プログラム作成装置200は例えば、データベース21、キーボード22、マウス23、表示装置24及び制御装置25を有している。データベース21にはデータ処理装置100のプログラム作成に必要なデータが格納される。例えば、C言語によるプログラムの記述に必要な「Global変数宣言」、「関数宣言」、「Local変数宣言」、「代入」、「加算」、「比較」及び「分岐」が格納される。データベース21には制御装置25が接続されており、この制御装置25にはキーボード22、マウス23及び表示装置24が接続されている。
【0026】
プログラム作成装置200では表示装置24にC言語によるプログラム記述画面を表示して、キーボード22及びマウス23を使用してプログラムが作成される。例えば、新規な設計製造に係るデータ処理装置100がN個のレジスタを使用する場合であって、N個のレジスタに第1番から第N番のシリアル番号を付与したとき、第1番から第K番のグループのレジスタを使用頻度が高い部類として「Local変数宣言」がなされ、第K+1番から第N番のグループのレジスタを使用頻度が低い部類として「Global変数宣言」がなされる。
【0027】
これらの宣言はキーボード22や、マウス23を使用して指定され、これはレジスタ種類を2つに分類して使用頻度が高いレジスタは短い命令ビット数で命令セットし、使用頻度が低いレジスタは長い命令ビット数で命令セットするためである。データ処理装置100においてレジスタの数が例えば、4千〜8千個程度になると、これを指定する命令ビット数が12乃至13ビット必要になる。
【0028】
制御装置25ではレジスタの使用頻度に応じて命令の長さを可変するようになされる。頻繁にアクセスするレジスタは短い長さの命令をセットするためである。使用頻度が高いレジスタは短い命令ビット数が割り当てられ、使用頻度が低いレジスタは長い命令ビット数が割り当てられる。
【0029】
データ処理装置100ではこのプログラム作成装置200で作成された圧縮プログラムAPを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行するようになされる。
【0030】
データ処理装置100は例えば、命令解読復元手段3、記憶手段4、レジスタアレイ11及び命令実行演算手段50を有している。レジスタアレイ11は複数のレジスタを集合したものである。
【0031】
記憶手段4にはレジスタアレイ11の中から該当レジスタを指定するための圧縮プログラムAPが格納される。圧縮プログラムAPはプログラム作成装置200で作成されたものが使用される。例えば、圧縮プログラムAPはデータ処理装置100で構築されたプログラム格納用の記憶手段4に、ROMライタ等を使用して書き込まれる。
【0032】
これはデータ処理装置100に関して、複数のメモリセルや算術論理素子により構成されるプログラマブル・ロジック・デバイス(Programmable Logic Device;PLD)からプロセッサを構築する場合があるからである。ROMとして機能させるメモリセルの占有率を低減することができる。もちろん、プログラム格納用の記憶手段4を演算処理装置とは別個に製造し、個々の記憶手段4に圧縮プログラムAPを格納してから同一基板上に実装する方法であってもよい。記憶手段4として読み出し専用のメモリ(ROM)や、EEPROM(フラッシュメモリ)が使用されるからである。
【0033】
記憶手段4には命令解読復元手段3が接続されており、この記憶手段4から圧縮プログラムAPを読み出してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定するための命令ビット数を復元するようになされる。命令長を揃え、この命令に基づいて複数のレジスタを指定するためである。
【0034】
命令解読復元手段3には命令実行演算手段50が接続されており、この命令実行演算手段50にはレジスタアレイ11が接続されている。命令実行演算手段50では命令解読復元手段3によって復元された所定の命令長のプログラムに基づいてレジスタアレイ11内で該当レジスタを指定して任意の演算を実行するようになされる。
【0035】
続いて、本発明に係るデータ処理方法について、当該データ処理システム10における処理例について説明をする。図2はデータ処理システム10における処理例を示すフローチャートである。
【0036】
このシステム10ではプログラム作成系Iで所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、プログラム実行系IIで当該プログラムと複数のレジスタとを使用してデータを処理する場合を前提とする。このデータ処理装置100がN個のレジスタを使用する場合であって、N個のレジスタに第1番から第N番のシリアル番号が付与される場合を例にとる。
【0037】
これを処理条件にして、プログラム作成系では図2AにフローチャートのステップA1で所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集する。そして、ステップA2でレジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮し、命令長を短くする。例えば、第K+1番から第N番のグループのレジスタを指定する命令ビット数をnビットとし、第1番から第K番のグループのレジスタを指定する命令ビット数をmビットとしたとき、例えば、n−m=8ビットとなるように、第1番から第K番のグループのレジスタを指定する命令ビット数が圧縮される。
【0038】
その後、ステップA3で当該プログラムの命令構造の中にレジスタ種類を記述する。例えば、被数及び加数を保持する1組のレジスタ、これを「レジスタ番号1」のレジスタの種類を「レジスタ種類1」、及び「レジスタ番号2」のレジスタの種類を「レジスタ種類2」としたとき、第1番から第K番のグループのレジスタに関して使用頻度が高い場合は「レジスタ種類1」及び「レジスタ種類2」にコード「0」が記述される。また、第K+1番から第N番のグループのレジスタに関して使用頻度が低い場合は「レジスタ種類1」及び「レジスタ種類2」にコード「1」が記述される。
【0039】
そして、ステップA4で命令長の異なる圧縮プログラムAPを作成する。この圧縮プログラムAPにおいて、第1番から第K番のグループのレジスタを指定する命令ビット数に関してはmビットであり、第K+1番から第N番のグループのレジスタを指定する命令ビット数に関してはnビットである。上述の例で第1番から第K番のグループのレジスタ指定を含む命令形態では、第K+1番から第N番のグループのレジスタ指定を含む命令形態に比べて命令長が16ビット短くなる。
【0040】
一方、プログラム実行系ではプログラム作成系で作成された圧縮プログラムAPを図2Bに示すフローチャートのステップB1で取得する。例えば、圧縮プログラムAPはデータ処理装置100で構築されたプログラム格納用の記憶手段4に、ROMライタ等を使用して書き込まれる。この圧縮プログラムAPでは使用頻度が高いレジスタは短い命令ビット数=mビットで命令セットされ、使用頻度が低いレジスタは長い命令ビット数=nビットで命令セットされている。
【0041】
そして、ステップB2で命令を実行するかを判断する。この際の判断は周知技術によりなされる。命令を実行する場合はステップB3でレジスタ種類を解読する。例えば、「レジスタ種類1」及び「レジスタ種類2」に関してコード「0」から使用頻度が高いレジスタとして第1番から第K番のグループのレジスタ番号が解読され、「レジスタ種類1」及び「レジスタ種類2」に関してコード「1」から使用頻度が低いレジスタとして第K+1番から第N番のグループのレジスタ番号が解読される。
【0042】
そして、解読されたレジスタ種類に基づいてステップB4で当該レジスタを指定する命令ビット数を復元する。例えば、第1番から第K番のグループのレジスタの命令ビット数=mビットの上位、この例で上位8ビットに「0」が付加される。第1番から第K番のグループのレジスタの命令ビット数が、第K+1番から第N番のグループのレジスタの命令ビット数と同様にしてnビットに揃えられる。
【0043】
ここで復元された所定長さの命令に基づいてステップB5で複数のレジスタを指定して任意の演算を実行する。その後、ステップB6で演算処理を終了するかを判断する。演算処理を終了しない場合はステップB2に戻って命令を実行するかを判断して演算処理を継続する。演算処理を終了する場合は電源オフ情報等を検出して当該演算処理を終了する。
【0044】
このように、本発明に係る実施形態としてのデータ処理システム10によれば、一方で、所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、他方で、当該プログラムと複数のレジスタとを使用してデータを処理する場合に、プログラム作成装置200ではレジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムAPが作成される。
【0045】
データ処理装置100では、プログラム作成装置200で作成された圧縮プログラムAPを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算が実行される。
【0046】
従って、プログラム作成系Iではレジスタの使用頻度に応じて命令の長さを可変できるので、頻繁にアクセスするレジスタに短い長さの命令をセットすることができる。これにより、プログラム実行系IIではROM等の記憶手段4に圧縮した命令をセットすることができ、プログラムデータを格納する記憶手段4のメモリ容量を低減することができる。また、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができるようになる。
【0047】
(2)実施例
図3は本発明に係る実施例としてのマイクロプロセッサ101の構成例を示すブロック図である。
この実施例ではデータ処理装置100に外部メモリ2を接続してマイクロプロセッサ101を構成し、複数のレジスタを指定して任意の演算を実行する。そのために、プログラム作成系Iで作成された機械語の命令の圧縮プログラムAPを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定の命令長の命令構造を有するプログラムを復元するようにした。そうすることでプログラムデータを格納するROM等のメモリ容量を低減できるようにしたものである。
【0048】
図3に示すマイクロプロセッサ101は、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数が予め圧縮されると共に、当該プログラムの命令構造の中にレジスタ種類が記述された命令長の異なる圧縮プログラムAPに基づいてデータを処理する装置である。このプロセッサ101ではプログラム作成装置200で作成された圧縮プログラムAPを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行するようになされる。
【0049】
マイクロプロセッサ101は例えば、レジスタアレイ11、命令ビット復元デコーダ13、ROM14、及び命令実行演算手段50を有している。レジスタアレイ11は複数のレジスタを集合したものである。レジスタアレイ11には例えば、8192個×32bitのレジスタri(i=0〜8191)が設けられる。各々のレジスタriは書込みアドレスAw及び書込み制御信号Swに基づいて任意の値を保持し、及び、読出しアドレスArに基づいて被数Xや加数Y等の値を出力するようになされる。
【0050】
このマイクロプロセッサ101は記憶手段の一例となるプログラム格納用のROM14が実装されており、レジスタアレイ11の中から該当レジスタriを指定するための圧縮プログラムAPが格納される。圧縮プログラムAPは機械語の命令(Instruction)構造を有しており、プログラム作成装置200で作成されたものが使用される。例えば、圧縮プログラムAPはROMライタ等を使用してROM14に書き込まれる。命令実行時、ROM14は例えば、プログラムカウンタ54からのカウント出力信号S5に基づいて圧縮プログラムAPを出力するようになされる。
【0051】
ROM14には命令ビット復元デコーダ13が接続されており、このROM14から機械語の命令の圧縮プログラムAPを読み出して命令制御信号S4、命令信号S9及び各引数信号S10を発生するようになされる。命令信号S9にはload命令、add命令、cmp命令、jump命令が含まれる。各引数信号S10にはアクセス方法#1,アクセス方法#2,「レジスタ種類1」,「レジスタ種類2」,レジスタ番号r0,r1・・・等、フラグ状態(flag condition)及びジャンプアドレス等が含まれる。
【0052】
この圧縮プログラムAPには、レジスタ相対メモリアドレッシング処理を実行するための演算命令を含んでいる。この処理では演算命令に基づいて一のレジスタを選択し、ここで選択されたレジスタが保持する値によって外部メモリ2を選択するようになされる。この処理は例えば、アクセス方法#1によって実行される。
【0053】
この例で命令ビット復元デコーダ13は、「レジスタ種類1」及び「レジスタ種類2」を解読し、この「レジスタ種類1」及び「レジスタ種類2」に基づいて当該レジスタriを指定するための命令ビット数=nビットを復元するようになされる。命令長を圧縮前のビット数に揃え、この命令に基づいて複数のレジスタri等を指定するためである。上述の命令制御信号S4は命令読出しステートマシーン52に出力される。
【0054】
上述のレジスタアレイ11及び命令ビット復元デコーダ13には命令実行演算手段50が接続されている。命令実行演算手段50では命令ビット復元デコーダ13によって復元された所定の命令長のプログラムに基づいてレジスタアレイ11内で該当レジスタriを指定して任意の演算を実行するようになされる。
【0055】
命令実行演算手段50は、算術論理演算ユニット(Arithmetic and LogicUnit:以下でALUという)12、実行ステートマシーン51、命令読出しステートマシーン52、セレクタ53、プログラムカウンタ(PC)54、+1インクリメンタ55、入力用のセレクタ59、ラッチ回路58、510、511を有しており、レジスタ相対メモリアドレッシング処理を実行するようになされる。
【0056】
レジスタアレイ11にはデータ信号線L20が接続されており、この信号線L20を通じてALU12が接続されている。ALU12ではレジスタアレイ11の中で指定されたレジスタから読み出されたXやY等の値を演算するようになされる。演算結果の値はZである。演算種目は足し算、かけ算、引き算、わり算等である。演算種目は実行ステートマシーン51から出力されるALU制御信号S35に基づいて設定される。データ信号線L20には、ALU12の他にラッチ回路58、511、59等が接続されている。データ信号線L20にはDATA、被数X値、加数Y値等が伝送される。
【0057】
命令ビット復元デコーダ13には実行ステートマシーン51及び命令読出しステートマシーン52が接続されており、命令ビット復元デコーダ13によって解読された演算命令を実行するためにレジスタアレイ11及びALU12を制御するようになされる。
【0058】
命令読出しステートマシーン52では命令ビット復元デコーダ13から出力される命令制御信号S4に基づいてプログラムカウンタ54及び実行ステートマシーン51を制御する。例えば、当該マシーン52は命令ビット復元デコーダ13から命令信号S9及び各引数信号S10が実行ステートマシーン51へ出力されると共に命令実行開始信号S29を出力する。
【0059】
実行ステートマシーン51にはレジスタアレイ11、ALU12、ラッチ回路58,510、511及びセレクタ59が接続されている。当該マシーン51では命令実行開始信号S29に基づいて命令の実行を開始する。例えば、データの書込み時には、書込み制御信号Swがレジスタアレイ11に出力され、セレクタ59には選択制御信号S24が出力される。データの読出し時には、レジスタアレイ11に読出しアドレスArが出力される。
【0060】
演算時には、ラッチ制御信号S34がラッチ回路58に出力され、ラッチ回路510にはラッチ制御信号S38が出力される。当該プロセッサ外部には外部制御信号S16が出力される。命令の実行が終了すると、実行ステートマシーン51は命令読み出しステートマシーン52へ実行終了信号S26を出力し、プログラムカウンタ54の値を進めるようになされる。
【0061】
この実行ステートマシーン51及び命令読み出しステートマシーン52にはセレクタ53が接続されており、選択制御信号S28に基づいてインクリメント出力信号S7又は分岐制御信号S27のいずれか一方を選択し、これをセレクタ出力としてプログラムカウンタ54に出力するようになされる。選択制御信号S28は実行ステートマシーン51から供給される。インクリメント出力信号S7はインクリメンタ55からセレクタ53へ出力される。
【0062】
プログラムカウンタ54ではカウント制御信号S30に基づいてROM14から圧縮プログラムAPを読み出す場所が指定される。+1インクリメンタ55はプログラムカウンタ54のカウント出力信号S5を「+1」してインクリメンとするようになされる。カウント制御信号S30は命令解読ステートマシーン52から供給される。このカウント出力信号S5は+1インクリメンタ55の他にROM14に出力される。
【0063】
セレクタ59はデータバス19A、レジスタアレイ11及びALU12に接続されており、データバス19Aから取り込んだデータ(DATA)、レジスタアレイ11から出力される被数X値(加数Y値)又はALU12から出力される演算結果値Zのいずれかを選択制御信号S24に基づいて入力制御するようになされる。
【0064】
ラッチ回路58はレジスタアレイ11の読出しポートとALU12の間に接続されており、ラッチ制御信号S34に基づいてレジスタriの出力値Xをラッチするようになされる。ラッチ回路510はALU12の比較出力部等に接続されており、ラッチ制御信号S38に基づいて一致検出信号S22をラッチして、フラグ状態(flag condition)信号S23を出力するようになされる。ラッチ回路511はレジスタアレイ11の読出しポートとアドレスバス19Bとの間に接続されており、ラッチ制御信号S17に基づいて外部アドレス(address)をラッチするようになされる。
【0065】
なお、実行された命令によってジャンプ(命令分岐)が発生した場合は、ジャンプ先のアドレスを示す分岐制御信号S27を実行ステートマシン51からセレクタ53へ出力される。セレクタ53では選択制御信号S28に基づいてその分岐制御信号S27を選択し、この分岐制御信号S27をプログラムカウンタ54へ書き込むようになされる。
【0066】
また、実行ステートマシーン51、セレクタ59、データ信号線L20及びラッチ回路511にはI/Oインタフェース60を通じて外部メモリ2が接続されている。レジスタ相対メモリアドレッシング処理に基づいてALU12を動作させるためである。I/Oインタフェース60と外部メモリ2との間はデータバス19A、アドレスバス19B及びコントロールバス19Cによって接続され、データバス19Aによってデータが転送され、アドレスバス19Bによってアドレスが転送され、コントロールバス19Cによって外部制御信号S16が外部メモリ2へ転送される。外部メモリ2を制御するためである。外部メモリ2には例えば、512Mバイト×32ビットのRAM(随時書き込み読み出し可能なメモリ)が使用される。
【0067】
図4はレジスタアレイ11の内部構成例を示すブロック図である。図4に示すレジスタアレイ11によれば、例えば、8192個の32bitのレジスタri(i=0〜8191)が備えられ、各々のレジスタriの入力には書込みポート15が接続されている。1bitのレジスタはD型のフリップ・フロップ回路等から構成される。
【0068】
書込みポート15は図3に示したセレクタ59に接続されており、書込み制御信号Sw及び書込みアドレスAwに基づいて、データバス19Aから取り込んだデータ(DATA)、レジスタアレイ11から出力される被数X値(加数Y値)又はALU12から出力される演算結果値Zのいずれかをレジスタr0〜riに書き込むようになされる。書込みポート15は実行ステートマシーン51に接続され、書込みアドレスAwを供給するようになされる。
【0069】
各々のレジスタriの出力には読出しポート16が接続されている。読出しポート16はデータ信号線L20を通じて図3に示したALU12、ラッチ回路58、511、セレクタ59等に接続されており、読出しアドレスArに基づいて指定されたレジスタriからデータ(DATA)を読み出すようになされる。読出しポート16は実行ステートマシーン51に接続され、読出しアドレスArを供給するようになされる。
【0070】
次に、ROM14にセットされる命令の構造例について説明する。図5A〜Eはマイクロプロセッサ101で取り扱う命令の構造例を示すフォーマットである。図6A〜Dは命令構造における記述内容例を示す表図である。
【0071】
このROM14にセットされる命令形態は、図5A〜Eに示すように、#F1〜#F5の5種類である。マイクロプロセッサ101では命令形態#F2〜#F4の命令を命令形態#F1の命令の形態に復元して取り扱われる。これらの命令形態#F1〜#F5で各々の命令はload、add及びcmp命令と、jump命令とに大きく二つに分かれる。命令形態#F1〜#F4において、load命令の場合は図6Aに示すように命令にコード「0」が記述され、add命令の場合は命令にコード「1」が記述され、cmp命令の場合は命令にコード「2」が各々記述される。
【0072】
命令形態#F5はjump命令であって、この場合は命令にコード「3」が記述される。cmp命令に関しては比較結果が同じであった場合は、図3に示したラッチ回路510のフラグ状態信号S23に基づいてzero flagが「1」にセットされ、同じでなかった場合は「0」がセットされる。
【0073】
この例では、load、add及びcmp命令はアクセスするレジスタriの番号が例えば、5ビットで表現できるときは5ビット、それ以外は13ビットで表現される。つまり、使用頻度が高い第0番のレジスタr0から第31番のレジスタr31をm=5ビットで表現する。使用頻度が低い第32番のレジスタr32から第8191番のレジスタr8191をm=13ビットで表現するようになされる。
【0074】
命令形態#F1では命令長が32ビットであり、「レジスタ番号1」で示されるレジスタriの命令ビット数はn=13ビットであり、「レジスタ番号2」で示されるレジスタriの命令ビット数もn=13ビットである。命令形態#F2では命令長が24ビットであり、「レジスタ番号1」で示されるレジスタriの命令ビット数はm=5ビットであり、「レジスタ番号2」で示されるレジスタriの命令ビット数はn=13ビットである。
【0075】
また、命令形態#F3でも命令長が24ビットであり、「レジスタ番号1」で示されるレジスタriの命令ビット数はn=13ビットであり、「レジスタ番号2」で示されるレジスタriの命令ビット数はm=5ビットである。命令形態#F4は命令長が16ビットであり、「レジスタ番号1」で示されるレジスタriの命令ビット数はm=5ビットであり、「レジスタ番号2」で示されるレジスタriの命令ビット数もm=5ビットである。
【0076】
いずれの命令形態#F1〜#F4においても、最初の2ビットは命令の種類を示している。命令種類に関して、loadは転送、addは加算、cmpは比較、jumpは制御移行(分岐)を各々示している。load、add、cmp命令の場合は、命令の後に2ビットのアクセス方法#1、#2が続く。Operandは左がアクセス方法#1、「レジスタ番号1」で表され、右がアクセス方法#2、「レジスタ番号2」で表される。
【0077】
つまり、アクセス方法#1は「レジスタ番号1」で示されるレジスタriのアクセス方法を示しており、アクセス方法#2は「レジスタ番号2」で示されるレジスタriのアクセス方法を示している。アクセス方法#1とアクセス方法#2はそれぞれレジスタ番号No.1、レジスタ番号No.2に対応し、これらの間で処理が行われる。いずれも、図6Bに示すようにアクセス方法#1、#2には2種類が準備されている。
【0078】
アクセス方法#1、#2に関してコード「0」が記述された場合は、レジスタ番号2で示されるレジスタriに対し直接アクセスする方法である。当該レジスタ番号で示されるレジスタriの値を直接用いることを示している。アクセス方法#1、#2に関してコード「1」が記述された場合は、「レジスタ番号1」で示されるレジスタriの値をアドレスとし、当該マイクロプロセッサ101で外部メモリ2に対してアクセスする方法である(図6B参照)。
【0079】
また、図5A〜図5Dにおいて、アクセス方法#1、#2の後には2ビットの「レジスタ種類1」、「レジスタ種類2」が続けて記述されている。「レジスタ種類1」は「レジスタ番号1」で示されるレジスタriの種類を示し、「レジスタ種類2」は「レジスタ番号2」で示されるレジスタriの種類を示している。レジスタ種類は図6Cに示すように2種類が準備されている。「レジスタ種類1」及び「レジスタ種類2」に関して、コード「0」が記述される場合は、レジスタ番号が「31」以下で使用頻度が高いレジスタriを示している。このレジスタri(i=0〜31)はレジスタ番号をm=5ビットで表現することができる。
【0080】
この「レジスタ種類1」及び「レジスタ種類2」に関して、「1」が記述される場合は、レジスタ番号が「32」以上で使用頻度が低いレジスタriを示している。このレジスタri(i=32〜8191)はレジスタ番号をn=13ビットで表現するようになされる。このように、レジスタ番号の大きさを区別することでプログラムを圧縮することができる。
【0081】
この「レジスタ種類1」、「レジスタ種類2」の後には「レジスタ番号1」、「レジスタ番号2」が続けて記述されている。「レジスタ番号1」は例えば、被数を保持するレジスタriを示し、「レジスタ番号2」は加数を保持するレジスタriを示す。
【0082】
また、図5Eに示すjump命令のフォーマットによれば、最初の2bitに命令が記述され、続く2bitにはフラグ状態(flag condition)が記述される。続く20bitにはジャンプアドレスが記述される。フラグ状態は図6Dに示すように、命令実行制御を移すかどうかの判断をするための条件である。コード「0」は「無条件」で常に制御を移す。コード「1」は「zero flag」でzero flagが「1」である場合に、制御を移す。コード「2」は「non−zero flag」でzero flagが「0」である場合に制御を移すようになされる。コード「3」は未使用である。
【0083】
続いて、プログラム作成系Iにおける処理例について説明をする。図7はプログラム作成系Iにおけるプログラム作成例を示す表図である。図7において、P1はプログラム記述画面をイメージし、P2にはその記述内容を示し、P3には実施例で該当する条件を記述したものである。所定のプログラム言語に基づいて目的の演算処理を実行するための命令を、図1に示したプログラム作成装置200で編集して圧縮プログラムを作成するためである。
【0084】
プログラム作成装置200では図1に示した表示装置24に図7に示すC言語によるプログラム記述画面P1を表示して、キーボード22及びマウス23を使用して圧縮プログラムが作成される。このとき、データベース21からマイクロプロセッサ101のプログラム作成に必要なデータが読み出される。例えば、C言語によるプログラムの記述に必要な「Global変数宣言」、「関数宣言」、「Local変数宣言」、「代入」、「加算」、「比較」及び「分岐」が読み出される。
【0085】
この例で新規な設計製造に係るマイクロプロセッサ101で、N=8192個の32ビットのレジスタriを使用する場合であって、8192個のレジスタriに第0番から第8191番のシリアル番号を付与したとき、第0番から第31番のグループのレジスタr0〜r31を使用頻度が高い部類として「Local変数宣言」がなされる。つまり、この例では第31番目以下のレジスタriに「Local変数宣言」が割り当てられる。また、第32番から第8191番のグループのレジスタr32〜r8191を使用頻度が低い部類として「Global変数宣言」がなされる。つまり、第32番目以上のレジスタriには「Global変数宣言」が割り当てられる。
【0086】
プログラム作成装置200では「Global変数宣言」がなされた第32番から第8191番のグループのレジスタr32〜r8191の命令ビット数をn=13ビットとしたとき、Local変数宣言がなされたレジスタr0〜r31の命令ビット数は、これよりも8ビット少ないm=5ビットに圧縮される。これと共に、当該プログラムの命令構造の中に「レジスタ種類1」、「レジスタ種類2」を記述して命令長の異なる圧縮プログラムAPを作成するようになされる。
【0087】
図1に示した制御装置25ではレジスタriの使用頻度に応じて命令の長さを可変するようになされる。この例では、使用頻度が高いレジスタr0〜r31を短い命令ビット数m=5ビットで命令セットし、使用頻度が低いレジスタr32〜r8191は長い命令ビット数n=13ビットで命令セットするようになされる。このようにすると、頻繁にアクセスするレジスタr0〜r31は短い長さの命令をセットすることができ、マイクロプロセッサ101に実装されるプログラム格納用のROM14のメモリ容量を削減することができる。
【0088】
続いて、プログラム作成装置200におけるコンパイル例について説明をする。図8はプログラム作成装置200におけるコンパイル例を示すフローチャート(メインルーチン)である。図9はコンパイラにおける代入及び演算処理例を示すフローチャート(サブルーチン)である。
【0089】
この実施例ではプログラム作成系IでC言語によるプログラムに基づいて目的の演算処理を実行するための命令を編集して圧縮プログラムを作成する場合を前提とする。また、マイクロプロセッサ101が8192個のレジスタr0〜r8191を使用する場合であって、8192個のレジスタriに第0番から第8191番のシリアル番号が付与される場合を例にとる。
【0090】
これを処理条件にして、プログラム作成系IではC言語によるプログラムに基づいて命令を編集するために、図8にフローチャートのステップC1でプログラムアドレスを「0」にする。その後、ステップC2に移行してC言語によるプログラムを一行読み込む。このとき、表示装置24のプログラム記述画面P1には、例えば、「global変数宣言」を示す
int *read add *write add ,counter,end val;
が表示され、また、関数宣言を示す
void main ()

が表示される。
【0091】
そして、ステップC3で当該プログラムの記述が「global変数宣言」であるかをチェックする。当該記述が「global変数宣言」である場合は、ステップC4に移行して第32番目以上のレジスタr32〜r8191を割り当てる。このグループのレジスタr32〜r8191を指定する命令ビット数をmビットとしたとき、m=13ビットである。命令は命令形態#F1で作成される。その後、ステップC14に移行する。
【0092】
また、ステップC3で当該記述が「global変数宣言」ではない場合はステップC5に移行して「local変数宣言」かをチェックする。このとき、表示装置24のプログラム記述画面P1には、例えば、「local変数宣言」を示す
int  temp,added val;
が表示される。当該記述が「local変数宣言」である場合は、ステップC6に移行して第31番目以下のレジスタr0〜r31を割り当てる。レジスタriを使用する頻度が高いことから、当該レジスタriを指定する命令ビット数nを、「global変数宣言」されたレジスタr32〜r8191よりも8ビット少ない5ビットに圧縮するためである。命令は命令形態#F2乃至#F4で作成される。その後、ステップC14に移行する。
【0093】
上述のステップC5で当該記述が「local変数宣言」ではない場合はステップC7に移行して、C言語のプログラムで代入・加算処理等の実行を示す「do」が記述されているかをチェックする。このとき、表示装置24のプログラム記述画面P1には、例えば、「do」を示す

Figure 2004038586
が表示される。このような代入・加算等の処理を示す「do」が記述されている場合は、ステップC8に移行して現在のプログラムアドレスを記憶する。その後、ステップC14に移行する。
【0094】
ステップC7で「do」が記述されていない場合はステップC9に移行してC言語のプログラムでその間の処理を示す「while」が記述されているかをチェックする。このとき、表示装置24のプログラム記述画面P1には、例えば、「while」を示す
while(counter !=end val);
が表示される。このような比較・分岐等の処理を示す「while」が記述されている場合は、ステップC10に移行して代入・演算処理を実行する。
【0095】
例えば、図9に示すサブルーチンをコールして、そのフローチャートのステップE1でC言語のプログラムにおいて、当該行が「while」を記述している行かがチェックされる。「while」が記述されている行の場合は、ステップE2に移行して後続の処理で生成する命令をcmp命令とする。その後、ステップE6に移行する。
【0096】
ステップE1で「while」が記述されていない行の場合は、ステップE3に移行して演算処理は加算かをチェックする。演算処理が加算の場合はステップE4に移行して後続の処理で生成する命令をadd命令とする。演算処理が加算ではない場合はステップE5に移行して後続の処理で生成する命令をload命令とする。その後、ステップE6に移行する。
【0097】
ステップE6ではレジスタriに書き込まれる変数に対応するレジスタ番号と、レジスタアレイ11から読み出される変数に対応するレジスタriのレジスタ番号を調べられる。書込みアドレスAw及び読み出しアドレスArを決めるためである。その後、ステップE7に移行する。
【0098】
ステップE7では両方のレジスタ番号が「32」以上かをチェックする。両方のレジスタ番号が「32」以上の場合はステップE8に移行して図5Aに示した命令形態#F1で命令を生成する。この命令形態#F1で「レジスタ種類1」及び「レジスタ種類2」には「1」が記述される。このとき、「レジスタ種類1」及び「レジスタ種類2」は圧縮プログラムの命令構造の中に記述される。例えば、第32番から第8191番のグループのレジスタr32〜r8191に関して「レジスタ種類1」及び「レジスタ種類2」に「1」が記述される。その後、図8に示したメインルーチンのステップC10にリターンする。
【0099】
また、ステップE7で両方のレジスタ番号が「32」以上ではない場合はステップE9に移行して両方のレジスタ番号が「31」以下かをチェックする。ここで両方のレジスタ番号が「31」以下の場合はステップE10に移行して図5Dに示した命令形態#F4で命令を生成する。この命令形態#F4で「レジスタ種類1」及び「レジスタ種類2」には「0」が記述される。このとき、「レジスタ種類1」及び「レジスタ種類2」は圧縮プログラムの命令構造の中に記述される。例えば、第0番から第31番のグループのレジスタr0〜r31に関して「レジスタ種類1」及び「レジスタ種類2」に「0」が記述される。その後、図8に示したメインルーチンのステップC10にリターンする。
【0100】
更に、両方のレジスタ番号が「31」以下ではない場合はステップE11に移行してレジスタアレイ11から読み出される変数のレジスタriの番号が「32」以上かをチェックする。読み出される変数のレジスタriの番号が「32」以上の場合は、ステップE12に移行して図5Bに示した命令形態#F2で命令を生成する。この命令形態#F2で「レジスタ種類1」に「0」が記述され、「レジスタ種類2」には「1」が記述される。その後、図8に示したメインルーチンのステップC10にリターンする。
【0101】
更にまた、レジスタアレイ11から読み出される変数のレジスタriの番号が「32」以上ではない場合は、ステップE13に移行して図5Cに示した命令形態#F3で命令を生成する。この命令形態#F3では「レジスタ種類1」に「1」が記述され、「レジスタ種類2」に「0」が記述される。その後、図8に示したメインルーチンのステップC10にリターンする。その後、ステップC11に移行してjump命令を生成する。jump命令の飛び先は先に記憶したプログラムアドレスを用いる。その後、ステップC14に移行する。
【0102】
上述のステップC9で「while」が記述されていない場合はステップC12に移行してC言語のプログラムにおいて、データの代入又は加算かをチェックする。データの代入又は加算の場合はステップC13に移行してデータの代入又は演算処理を実行する。このステップC13では、図9に示したサブルーチンをコールして、そのフローチャートのステップE1〜E13を経て図8に示したメインルーチンのステップC13にリターンする。その後、ステップC14に移行する。
【0103】
また、ステップC12でC言語のプログラムにおいて、データの代入又は加算ではない場合はステップC14に移行する。ステップC14ではC言語のプログラムに関して最後の行かをチェックされる。最後の行ではない場合は、ステップC15に移行してプログラムアドレスを進める。その後、ステップC2に戻って上述したコンパイル処理を繰り返すようになされる。最後の行に至ってこのコンパイル処理を終了する。
【0104】
これにより、図5A〜図5Eに示したような命令形態#F1〜#F5であって、命令長の異なる圧縮プログラムAPを作成することができる。この圧縮プログラムAPにおいて、第0番から第31番のグループのレジスタr0〜r31を指定する命令ビット数に関してはm=5ビットであり、第32番から第8191番のグループのレジスタr32〜r8191を指定する命令ビット数に関してはn=13ビットである。
【0105】
続いて、プログラム実行系IIにおける処理例について説明をする。図10は復元された演算プログラムによる演算命令の例を示す表図である。図11はレジスタr0,r1・・・・r32,r33,r34,r35等の状態例、図12は外部メモリ2におけるデータ格納例を各々示すイメージ図である。
【0106】
この例では、データ処理装置100に接続された外部メモリ2の中に図12に示すような10個のメモリセルの配列を二組用意する。一方はメモリ配列#M1で、他方はメモリ配列#M2である。そして、図10に示す8つの演算命令(Instruction)#I1〜#I8に基づいて、その一組のメモリ配列#M1に格納された値に「1」を加算し、もう一組のメモリ配列#M2にその結果を格納する演算処理の例を挙げる。
【0107】
図10に示す演算命令(Instruction)#I1〜#I8はROM14の圧縮プログラムAPを復元した後の演算プログラムによるものである。この演算プログラムでは図11に示すように、アクセス頻度が高いレジスタriが二つあるため、これらをそれぞれr0とr1に割り当てた。これにより、プログラム全体の長さを圧縮する前の演算プログラムに比べて効率よく短縮することができた。
【0108】
また、図11において、レジスタ番号r0で示されるレジスタは一時的に使用され、レジスタ番号r1で示されるレジスタには加算値「1」が格納される。また、レジスタ番号r32で示されるレジスタには読み出しアドレス「0」が格納され、レジスタ番号r33で示されるレジスタには書込みアドレス「10」が格納され、レジスタ番号r34で示されるレジスタにはカウンタの初期値「0」が格納され、レジスタ番号r35で示されるレジスタには演算回数値(終了値)「10」が格納される。
【0109】
図10に示す各々の演算命令#I1〜#I8には、ニーモニックによる表現、機械語による表現及び処理の内容が示されている。演算命令#I1は図5に示した命令構造において、機械語で140020hによって表されるload,r0,(r32)であり、レジスタアレイ11のレジスタr32の値をアドレスとし、外部メモリ2から読み出した値をレジスタr0に格納する内容である。動作としては例えば、レジスタr32の値を「0」としたとき、図12に示した外部メモリ2の読み出しアドレスが「0」の内容である、メモリ配列#M1のデータ「0」が読み出され、このデータ「0」がレジスタr0に書き込まれる。
【0110】
演算命令#I2は機械語で4001hによって表されるadd,r0,r1であり、レジスタアレイ11のレジスタr0にレジスタr1の値を加算し、その結果をレジスタr0に格納する内容である。動作としてはレジスタr0の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr0に書き込まれる。
【0111】
演算命令#I3は機械語で280420hによって表されるload,(r33),r0であり、レジスタアレイ11のレジスタr33の値をアドレスとして、レジスタr0の値を外部メモリ2に書き込む内容である。動作としてはレジスタr33が示す外部メモリ2のメモリ配列#M2のアドレスにデータ「1」が書き込まれる。
【0112】
演算命令#I4は機械語で480401hによって表されるadd,r32,r1であり、レジスタアレイ11のレジスタr32にレジスタr1の値を加算して、その結果をレジスタr32に格納する内容である。動作としてはレジスタr32の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr32に書き込まれる。
【0113】
演算命令#I5は機械語で480421hによって表されるadd,r33,r1であり、レジスタアレイ11のレジスタr33にレジスタr1の値を加算して、その結果をレジスタr33に格納する内容である。動作としてはレジスタr33の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr33に書き込まれる。
【0114】
演算命令#I6は機械語で480441hによって表されるadd,r34,r1であり、レジスタアレイ11のレジスタr34にレジスタr1の値を加算して、その結果をレジスタr34に格納する内容である。動作としてはレジスタr34の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr34に書き込まれる。この演算命令#I4〜#I6によって実行ステートマシーン51内のカウンタでは読み出しアドレスAr及び書き込みアドレスAwに関して「1」が加算される。
【0115】
演算命令#I7は機械語で8C044023hによって表されるcmp,r34,r35であり、レジスタアレイ11のレジスタr34の内容とレジスタr35の内容とを比較し、その値が同じ場合は、zero flagに「1」をセットし、異なっている場合は「0」にセットする内容である。動作としてはレジスタr34とレジスタr35の値である「1」と「10」は異なるので、zeroflagには「0」がセットされる。zero flagの値はラッチ回路510によって保持され、以降の命令によって参照される。
【0116】
演算命令#I8は機械語でE00000hによって表されるjump nz,LOOPであり、zero flagが「0」の場合は、LOOPで示されるラベルへ制御を移す内容である。動作としては、zero flagが「0」の場合は制御を演算命令#I1に移す。上記の動作が10回、繰り返されるとレジスタr34の値が「10」になり、演算命令#I7によりzero flagが「1」にセットされ、演算命令#I8で制御が移らなくなり、演算処理を終了するようになされる。このように、全てのレジスタriの命令ビット数を単一の方法で表現した場合と比べて、効率良くROM14を使用することが可能になる。
【0117】
続いて、マイクロプロセッサ101における動作例について説明をする。図13はマイクロプロセッサ101における動作例を示すフローチャートである。図14及び図15は命令ビット復元デコーダ13における処理例(その1,2)を示すフローチャートである。
【0118】
この実施例ではマイクロプロセッサ101がプログラム実行系IIを構成し、ROM14から読み出された圧縮プログラムAPから図10に示した演算命令#I1〜#I8を含む演算プログラムを復元する。このとき、命令形態#F1〜#F4に関して「レジスタ種類1」及び、「レジスタ種類2」にコード「0」が記述されている場合は、命令ビット復元デコーダ13によってレジスタ番号の拡張が行われる。この際の命令ビットの拡張では、例えば、「レジスタ番号1」の命令ビット数m=5ビットの上位に8ビットの「0」を追加するようになされる。この演算プログラムに基づいて、図12に示した外部メモリ2の中のメモリ配列#M1の値に「1」を加算し、メモリ配列#M2に格納するようになされる。
【0119】
レジスタアレイ11のレジスタ状態については、図11に示したように例えば、6個のレジスタr0,r1,r32,r33,r34,r35に関して、r0が不定、r1が初期値「1」、r32及びr34が共に初期値「0」、r33及びr35が初期値「10」が設定される。これらの値を書き込む場合は、実行ステートマシーン51ではレジスタアレイ11に書き込みアドレスAwが出力され、その初期値「0」、「1」、「10」が設定される。
【0120】
これを動作条件にして、図13に示すフローチャートのステップF1で、まず、命令ビット復元デコーダ13はROM14から圧縮プログラム(機械語命令)APを順次受け取り、このプログラムAPを解読して所定の命令長の演算命令#I1〜#I8を検出する。
【0121】
この命令ビット復元デコーダ13は例えば、図14に示すサブルーチンをコールしてそのフローチャートのステップG1で命令部分を取り出し、命令信号S9を実行ステートマシーン51に出力する。これと共に、命令ビット復元デコーダ13ではステップG2に移行して当該命令形態がjump命令であるかをチェックする。当該命令形態が#F5で示されるjump命令の場合はステップG12に移行してflag condition、jump addressを出力する。その後、メインルーチンのステップF1にリターンする。
【0122】
また、ステップG2で当該命令形態がjump命令でない場合は、ステップG4に移行して当該命令形態に関して「レジスタ種類1」に記述されているコードは「0」又は「1」かをチェックする。「レジスタ種類1」にコード「0」が記述されている場合はステップG4に移行して「レジスタ番号1」の命令ビット数mを5bit長として圧縮プログラムAPから取り出す。その後、ステップG5に移行して「レジスタ番号1」の命令ビット数m=5bitの上位8ビットに「0」を付加して13bit長とする。その後、ステップG7に移行する。
【0123】
上述のステップG3で「レジスタ種類1」にコード「1」が記述されている場合はステップG6に移行して「レジスタ番号1」の命令ビット数nを13bit長として圧縮プログラムAPから取り出す。その後、ステップG7に移行して、当該命令形態に関して「レジスタ種類2」に記述されているコードは「0」又は「1」かをチェックする。「レジスタ種類2」にコード「0」が記述されている場合はステップG8に移行して「レジスタ番号2」の命令ビット数mを5bit長として圧縮プログラムAPから取り出す。その後、ステップG9に移行して「レジスタ番号2」の命令ビット数m=5bitの上位8ビットに「0」を付加して13bit長とする。その後、ステップG11に移行する。
【0124】
上述のステップG7で「レジスタ種類2」にコード「1」が記述されている場合はステップG10に移行して「レジスタ番号2」の命令ビット数nを13bit長として圧縮プログラムAPから取り出す。その後、ステップG11に移行して、「レジスタ番号1」、「レジスタ番号2」、「アクセス方法#1」及び「アクセス方法#2」を検出する。
【0125】
その後、図13に示したメインルーチンのステップF1にリターンする。従って、実行ステートマシン51には「レジスタ種類1」及び「レジスタ種類2」は出力されず、所定の命令長の演算命令#I1〜#I8に基づく命令制御信号S4、命令信号S9及び各引数信号S10が出力される。
【0126】
この命令信号S9にはload命令、add命令、cmp命令、jump命令が含まれる。各引数信号S10にはアクセス方法#1,アクセス方法#2,レジスタ番号r0,r1・・・等、フラグ状態(flag condition)及びジャンプアドレス等が含まれる。命令制御信号S4はデコーダ13から命令読出しステートマシーン52に出力される。
【0127】
なお、ROM14で圧縮プログラムAPを読み出す場所(アドレス)はプログラムカウンタ54(PC)によって指定される。これらの読み出しの動作は命令読み出しステートマシーン52によって制御される。
【0128】
命令読出しステートマシーン52では命令ビット復元デコーダ13から出力される命令制御信号S4に基づいてプログラムカウンタ54及び実行ステートマシーン51を制御する。例えば、当該マシーン52は命令ビット復元デコーダ13から命令信号S9及び各引数信号S10が実行ステートマシーン51へ出力されると共に命令実行開始信号S29を出力する。
【0129】
実行ステートマシーン51では命令実行開始信号S29に基づいて命令の実行を開始する。例えば、データの書込み時には、書込み制御信号Swがレジスタアレイ11に出力され、セレクタ59には選択制御信号S24が出力される。データの読出し時には、レジスタアレイ11に読出しアドレスArが出力される。
【0130】
演算時には、ラッチ制御信号S34がラッチ回路58に出力され、ラッチ回路510にはラッチ制御信号S38が出力される。当該プロセッサ外部には外部制御信号S16が出力される。命令の実行が終了すると、実行ステートマシーン51は命令読み出しステートマシーン52へ実行終了信号S26を出力し、プログラムカウンタ54の値を進めるようになされる。
【0131】
プログラムカウンタ54ではカウント制御信号S30に基づいてROM14から圧縮プログラムAPを読み出す場所が指定される。+1インクリメンタ55はプログラムカウンタ54のカウント出力信号S5を「+1」してインクリメンとするようになされる。
【0132】
そして、ステップF2で実行ステートマシーン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I1を受け取ると、機械語で140020hによって表されるload,r0,(r32)に基づいて書込み信号S16を外部メモリ2に出力する。この値はレジスタアレイ11の読み出しアドレスArとして用いられる。レジスタアレイ11は32番目の値をデータ信号線L20に出力する。
【0133】
この値はラッチ回路511によって保持され、アドレスバス19Bを経由し、外部メモリ2へ出力される。そして、レジスタアレイ11のレジスタr32の値をアドレスとし、外部メモリ2から読み出した値をレジスタr0に格納する。このとき、レジスタr32の値が「0」であるので、図12に示した外部メモリ2のアドレスが「0」の内容であるメモリ配列#M1のデータ「0」が読み出され、このデータ「0」がレジスタr0に書き込まれる。
【0134】
つまり、外部メモリ2からアドレスバス19Bによって転送されたアドレス(場所)のデータがセレクタ59に出力される。実行ステートマシーン51ではこのデータが選択されるように、選択信号S24を出力する。これにより、データがレジスタアレイ11に入力される。そして、実行ステートマシーン51では書き込みアドレスAw=「0」をレジスタアレイ11に出力する。その後、実行ステートマシン51は書き込み信号Swを用いて実際に、演算結果値の書き込みを指示するようになされる。
【0135】
その後、ステップF3で実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I2を受け取ると、機械語で4001hによって表されるadd,r0,r1に基づいてレジスタアレイ11のレジスタr0にレジスタr1の値を加算し、その結果をレジスタr0に格納する。このとき、レジスタr0の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr0に書き込まれる。
【0136】
そして、ステップF4で実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I3を受け取ると、機械語で280420hによって表されるload,(r33),r0に基づいてレジスタアレイ11のレジスタr33の値をアドレスとして、レジスタr0の値を外部メモリ2に書き込む。このとき、レジスタr33が示す外部メモリ2のメモリ配列#M2のアドレスにデータ「1」が書き込まれる。
【0137】
その後、ステップF5で実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I4を受け取ると、機械語で480401hによって表されるadd,r32,r1に基づいてレジスタアレイ11のレジスタr32にレジスタr1の値を加算して、その結果をレジスタr32に格納する。このとき、レジスタr32の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr32に書き込まれる。この演算命令#I4によって実行ステートマシーン51内のカウンタでは読み出しアドレスAr及び書き込みアドレスAwに関して「1」が加算される。
【0138】
そして、ステップF6で実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I5を受け取ると、機械語で480421hによって表されるadd,r33,r1に基づいてレジスタアレイ11のレジスタr33にレジスタr1の値を加算して、その結果をレジスタr33に格納する。このとき、レジスタr33の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr33に書き込まれる。この演算命令#I5によって実行ステートマシーン51内のカウンタでは読み出しアドレスAr及び書き込みアドレスAwに関して「1」が加算される。
【0139】
その後、ステップF7で実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I6を受け取ると、機械語で480441hによって表されるadd,r34,r1に基づいてレジスタアレイ11のレジスタr34にレジスタr1の値を加算して、その結果をレジスタr34に格納する。このとき、レジスタr34の内容である「0」にレジスタr1の値である「1」が加算され、その結果「1」がレジスタr34に書き込まれる。この演算命令#I6によって実行ステートマシーン51内のカウンタでは読み出しアドレスAr及び書き込みアドレスAwに関して「1」が加算される。
【0140】
この例では、ステップF8でレジスタr35が示す値=10回に至ったかが判別される。例えば、実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I7を受け取ると、機械語で8C044023hによって表されるcmp,r34,r35に基づいてレジスタアレイ11のレジスタr34の内容とレジスタr35の内容とを比較し、その値が同じ場合は、zero flagに「1」をセットし、異なっている場合は「0」にセットする。このとき、レジスタr34とレジスタr35の値である「1」と「10」は異なるので、zero flagには「0」がセットされる。zero flagの値はラッチ回路510によって保持され、以降の命令によって参照される。
【0141】
そして、実行ステートマシン51は命令読出しステートマシーン52の命令読出し制御を受けて演算命令#I8を受け取ると、機械語でE00000hによって表されるjump nz,LOOPに基づいてzero flagが「0」の場合は、LOOPで示されるラベルへ制御を移行する。zero flagが「0」の場合は制御をステップF2の演算命令#I1に移す。上記の動作がステップF8で10回繰り返されるとレジスタr34の値が「10」になり、演算命令#I7によりzero flagが「1」にセットされ、演算命令#I8で制御が移らなくなり、演算処理を終了するようになされる。
【0142】
このように、本発明に係る実施例としてのマイクロプロセッサ101によれば、8192個のレジスタr0〜r8191の中でその使用頻度に基づいて当該レジスタriを指定する命令ビット数が予め圧縮されると共に、当該プログラムの命令構造の中に「レジスタ種類1」及び「レジスタ種類2」が記述された命令長の異なる圧縮プログラムAPに基づいてデータを処理するようになされる。
【0143】
ROM14には8192個のレジスタr0〜r8191の中から当該レジスタriを指定するための圧縮プログラムAPが記憶される。命令ビット復元デコーダ13では、このROM14から圧縮プログラムAPを読み出して「レジスタ種類1」及び「レジスタ種類2」が解読され、この「レジスタ種類1」及び「レジスタ種類2」に基づいて当該レジスタriを指定するための命令ビット数が復元される。
【0144】
従って、レジスタriの使用頻度に応じて可変された命令の長さの圧縮プログラムAPであって、頻繁にアクセスするレジスタr0〜r31には短い長さの命令がセットされた、圧縮プログラムデータをROM14に格納することができるので、そのメモリ容量を低減することができる。この例ではプログラムを圧縮する前に比べて16ビット×32個×命令数分だけメモリ容量を低減できる。
【0145】
これにより、メモリセルや論理演算素子から成るPLDによりマイクロプロセッサ101を構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができるようになる。
【0146】
【発明の効果】
以上説明したように、本発明に係るデータ処理システムによれば、一方で、所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、他方で、当該プログラムと複数のレジスタとを使用してデータを処理する場合に、プログラム作成系で作成された圧縮プログラムを取得してレジスタ種類を解読し、このレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行するデータ処理装置を備えるものである。
【0147】
この構成によって、プログラム作成系ではレジスタの使用頻度に応じて命令の長さを可変できるので、頻繁にアクセスするレジスタに短い長さの命令をセットすることができる。従って、プログラム実行系ではプログラムデータを格納するROM等のメモリ容量を低減することができる。また、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができる。
【0148】
本発明に係るデータ処理装置によれば、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数が予め圧縮されると共に、当該プログラムの命令構造の中にレジスタ種類が記述された命令長の異なる圧縮プログラムに基づいてデータを処理する場合に、この圧縮プログラムから解読したレジスタ種類に基づいて当該レジスタを指定するための命令ビット数を復元する命令解読復元手段を備え、この命令解読復元手段によって復元された所定長の命令に基づいてレジスタを指定して任意の演算を実行するものである。
【0149】
この構成によって、レジスタの使用頻度に応じて可変された命令の長さの圧縮プログラムであって、頻繁にアクセスするレジスタには短い長さの命令がセットされた、圧縮プログラムデータを記憶手段に格納することができるので、そのメモリ容量を低減することができる。従って、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができる。
【0150】
本発明に係るデータ処理方法によれば、プログラム作成系で所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、プログラム実行系で当該プログラムと複数のレジスタとを使用してデータを処理する場合に、プログラム作成系では、レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムを作成し、プログラム実行系では、プログラム作成系で作成された圧縮プログラムを取得してレジスタ種類を解読し、ここで解読されたレジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、ここで復元された所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行するようになされる。
【0151】
この構成によって、プログラム作成系ではレジスタの使用頻度に応じて命令の長さを可変できるので、頻繁にアクセスするレジスタに短い長さの命令をセットすることができる。従って、プログラム実行系ではプログラムデータを格納するROM等のメモリ容量を低減することができる。また、メモリセルや論理演算素子から成るPLDによりプロセッサを構築する場合に、ROMとして機能させるメモリセルの占有率を低減することができ、その分のメモリセルをレジスタに多く割り当てることができる。
【0152】
この発明は命令実行プログラム等に基づいて各種データ処理をするCPUや、MPU、PLD等、これらの組み込み電子機器に適用して極めて好適である。
【図面の簡単な説明】
【図1】本発明に係る実施形態としてのデータ処理システム10の構成例を示すブロック図である。
【図2】データ処理システム10における処理例を示すフローチャートである。
【図3】本発明に係る実施例としてのマイクロプロセッサ101の構成例を示すブロック図である。
【図4】レジスタアレイ11の内部構成例を示すブロック図である。
【図5】A〜EはROM14にセットされる命令の構造例を示すフォーマットである。
【図6】A〜Dは命令構造における記述内容例を示す表図である。
【図7】プログラム作成系Iにおけるプログラム作成例を示す表図である。
【図8】プログラム作成装置200におけるコンパイル例を示すフローチャート(メインルーチン)である。
【図9】コンパイラにおける代入及び演算処理例を示すフローチャート(サブルーチン)である。
【図10】復元された演算プログラムによる演算命令の例を示す表図である。
【図11】r0,r1・・・・r32,r33,r34,r35等のレジスタの状態例を示すイメージ図である。
【図12】外部メモリ2におけるデータ格納例を示すイメージ図である。
【図13】マイクロプロセッサ101における動作例を示すフローチャートである。
【図14】命令ビット復元デコーダ13における処理例(その1)を示すフローチャートである。
【図15】命令ビット復元デコーダ13における処理例(その2)を示すフローチャートである。
【符号の説明】
2・・・外部メモリ、3・・・命令解読復元手段、4・・・記憶手段、10・・・データ処理システム、11・・・レジスタアレイ、12・・・ALU、13・・・命令ビット復元デコーダ(命令解読復元手段)、14・・・ROM(記憶手段)、50・・・命令実行演算手段、100・・・データ処理装置、101・・・マイクロプロセッサ、200・・・プログラム作成装置[0001]
TECHNICAL FIELD OF THE INVENTION
INDUSTRIAL APPLICABILITY The present invention is applied to a central processing unit (CPU), a microprocessor unit (MPU), and the like that perform various data processing based on a system program, a programmable logical operation element (PLD), and an electronic device embedded therein. A data processing system, a data processing device, and a data processing method.
[0002]
In detail, a data processing device is provided that executes an arbitrary operation by designating a plurality of registers, obtains a compression program created by a program creation system, decodes a register type, and registers the register based on the register type. By restoring a designated instruction bit number and restoring a program having an instruction structure of a prescribed instruction length, it is possible to reduce the memory capacity of a ROM or the like for storing program data, In the case where a processor is constructed by using a PLD composed of PLDs, the occupancy of memory cells functioning as ROM can be reduced.
[0003]
[Prior art]
2. Description of the Related Art In recent years, microprocessors including a central processing unit (CPU) have been often used in various electronic devices such as mobile terminal devices, electronic cards, and information processing devices. In this type of processor, a read-only memory (hereinafter, referred to as a ROM) for storing an instruction execution program, many registers used for the instruction execution operation processing, and the like are mounted in addition to the instruction execution operation unit.
[0004]
According to a conventional microprocessor, when a processor is incorporated in an arbitrary electronic device and used, an instruction for performing a certain operation corresponds one-to-one with an instruction for performing the operation. In other words, a register created by a uniform-length instruction with the same number of instruction bits for designating the register is often used for both the frequently used register and the infrequently used register. Thus, the fixed-length instructions are stored in the ROM and used.
[0005]
On the other hand, with the development of semiconductor integrated circuit technology, it has become possible to mount a large number of registers in a processor (hereinafter also referred to as a data processing device). In this case, the number of instruction bits for specifying the register is required more and more. For example, when 1024 registers are implemented, 10 bits are required as instruction bits to specify one of the 1024 registers. However, in an actual program, the access frequency to all the registers is not uniform, and the access frequency varies. The number of frequently accessed registers is generally determined by the compiler.
[0006]
[Problems to be solved by the invention]
By the way, according to the conventional data processing device, there are the following problems in mounting a ROM for storing an instruction execution program.
[0007]
{Circle around (1)} When looking at the entire code of the instruction execution program, among the 10 instruction bits for designating a register, for example, the entire 10 bits are rarely used uniformly. Therefore, there are many useless bits in a memory (for example, a ROM or a flash memory) for storing an instruction execution program. Thus, a method of expressing all registers with a single instruction bit number hinders efficient use of the ROM.
[0008]
{Circle around (2)} When an attempt is made to construct a microprocessor or the like using a programmable logic device (PLD) including a memory cell and a logic operation element, an instruction execution operation unit is arranged on the same semiconductor chip. A method of arranging a register array, a ROM, and the like in a peripheral portion thereof can be considered. In this case, if the number of instruction execution programs increases due to a demand for multifunctional processors, a large memory capacity of a ROM for storing the programs is required. Therefore, the memory cells are occupied by the construction of the ROM, and it becomes difficult to allocate many memory cells to the registers.
[0009]
In view of the above, the present invention has been made to solve such a conventional problem. In addition to making it possible to change the length of an instruction according to the frequency of use of a register, a frequently accessed register has a short instruction length. It is an object of the present invention to provide a data processing system, a data processing device, and a data processing method that can set a data processing method and reduce a memory capacity of a ROM or the like for storing program data.
[0010]
[Means for Solving the Problems]
The problem described above is, on the one hand, to create a program by editing instructions for executing a target arithmetic processing based on a predetermined programming language, and, on the other hand, to use the program and a plurality of registers to transfer data. A processing system that compresses the number of instruction bits specifying a register based on the frequency of use of the register, and describes a register type in the instruction structure of the program to create a compressed program having a different instruction length. A program creating device that obtains the compressed program created by the program creating device, decodes the register type, restores the number of instruction bits specifying the register based on the register type, and And a data processing device for executing an arbitrary operation by designating a plurality of registers. It is resolved by the arm.
[0011]
According to the data processing system of the present invention, on the one hand, an instruction for executing a target arithmetic processing is edited based on a predetermined program language to create a program, and on the other hand, the program and a plurality of registers are created. When processing data using, the program creation device compresses the number of instruction bits that specify the register based on the frequency of using the register, and describes the register type in the instruction structure of the program. Compression programs with different instruction lengths are created.
[0012]
The data processing device obtains the compressed program created by the program creating device, decodes the register type, restores the number of instruction bits designating the register based on the register type, and, based on the instruction of a predetermined length, An arbitrary operation is executed by designating a plurality of registers.
[0013]
Therefore, in the program creation system, the length of an instruction can be changed according to the frequency of use of the register, so that an instruction having a short length can be set in a frequently accessed register. As a result, in the program execution system, compressed instructions can be set in the ROM or the like, and the memory capacity of the ROM or the like for storing program data can be reduced. Further, when a processor is constructed by a PLD including memory cells and logical operation elements, the occupancy of the memory cells functioning as ROM can be reduced, and more memory cells can be allocated to registers.
[0014]
In the data processing device according to the present invention, the number of instruction bits designating the register is compressed in advance based on the frequency of using the register, and the instruction length of the instruction type in which the register type is described in the instruction structure of the program is different. An apparatus for processing data based on a compression program, comprising: a plurality of registers; storage means for storing a compression program for designating the registers; and reading a compression program from the storage means to decode a register type. Instruction decoding and restoring means for restoring the number of instruction bits for designating a register based on a register type, and executing an arbitrary operation by designating a register based on an instruction of a predetermined length restored by the instruction decoding and restoring means And an instruction execution calculating means.
[0015]
According to the data processing device of the present invention, the number of instruction bits for designating a register is pre-compressed based on the frequency of using the register, and the instruction length in which the register type is described in the instruction structure of the program When processing data based on different compression programs, a storage program stores a compression program for designating the register from among a plurality of registers. In the instruction decoding and restoring means, the compression program is read from the storage means to decode the register type, and the number of instruction bits for designating the register is restored based on the register type. On the premise of this, the instruction execution operation means executes an arbitrary operation by designating a register based on a program of a predetermined instruction length restored by the instruction decoding / reconstruction means.
[0016]
Therefore, it is possible to store compressed program data in a storage means, which is a compression program having an instruction length that is variable according to the frequency of use of a register, wherein an instruction of a short length is set in a frequently accessed register. Therefore, the memory capacity can be reduced. This makes it possible to reduce the occupancy of the memory cells functioning as the ROM when constructing a processor using the PLD including the memory cells and the logic operation elements, and allocate more memory cells to the registers.
[0017]
The data processing method according to the present invention edits an instruction for executing a target arithmetic process based on a predetermined program language in a program creation system to create a program, and the program execution system associates the program with a plurality of registers. This is a method of processing data using a program. In a program creation system, the number of instruction bits specifying the register is compressed based on the frequency of use of the register, and the register type is described in the instruction structure of the program. To create compressed programs with different instruction lengths, and the program execution system obtains the compressed program created by the program creation system, decodes the register type, and specifies the register based on the decoded register type. The number of instruction bits to be restored is specified, and a plurality of registers are specified based on the restored instructions of a predetermined length. It is characterized in that to perform any operation.
[0018]
According to the data processing method according to the present invention, a program creation system edits an instruction for executing a target arithmetic process based on a predetermined program language to create a program, and the program execution system combines the program with a plurality of programs. When processing data using registers, the length of instructions can be varied according to the frequency of use of registers in the program creation system, so that short-length instructions can be set in frequently accessed registers. .
[0019]
Therefore, in the program execution system, the compressed instruction can be set in the ROM or the like, and the memory capacity of the ROM or the like for storing the program data can be reduced. Further, when a processor is constructed by a PLD including memory cells and logical operation elements, the occupancy of the memory cells functioning as ROM can be reduced, and more memory cells can be allocated to registers.
[0020]
BEST MODE FOR CARRYING OUT THE INVENTION
Next, an embodiment of a data processing system, a data processing apparatus, and a data processing method according to the present invention will be described with reference to the drawings.
[0021]
(1) Embodiment
FIG. 1 is a block diagram showing a configuration example of a data processing system 100 as an embodiment according to the present invention.
In this embodiment, a data processing apparatus is provided which executes a given operation by designating a plurality of registers, obtains a compression program created by a program creation system, decodes a register type, and, based on the register type, To restore a program having an instruction structure of a predetermined instruction length to reduce the memory capacity of a ROM or the like for storing program data, and to reduce memory cells and logical operations. When a processor is constructed using PLDs composed of elements, the occupancy of memory cells functioning as a ROM can be reduced.
[0022]
In the program creation system, the length of an instruction can be changed according to the frequency of use of a register, and an instruction having a short length can be set in a frequently accessed register.
[0023]
On the one hand, the data processing system 10 shown in FIG. 1 creates a program by editing an instruction for executing a target arithmetic processing based on a predetermined program language, and, on the other hand, associates the program with a plurality of registers. It is a system that uses and processes data. In the data processing system 10, a program creation device 200 that forms the program creation system I is prepared. This is to create a program for operating the newly designed and manufactured data processing apparatus 100. The data processing device 100 constitutes a program execution system II, in which an instruction execution operation unit, a storage unit, a plurality of registers, and the like are mounted.
[0024]
The program creation device 200 compresses the number of instruction bits for designating the register based on the frequency of use of the register in the data processing device 100, and describes the register type in the instruction structure of the program to specify the instruction length. Of different compression programs AP. This is for reducing the memory capacity of the storage means for storing the program mounted on the data processing apparatus 100.
[0025]
The program creation device 200 includes, for example, a database 21, a keyboard 22, a mouse 23, a display device 24, and a control device 25. The database 21 stores data necessary for creating a program for the data processing device 100. For example, “Global variable declaration”, “function declaration”, “Local variable declaration”, “assignment”, “addition”, “comparison”, and “branch” necessary for describing a program in the C language are stored. A control device 25 is connected to the database 21, and a keyboard 22, a mouse 23 and a display device 24 are connected to the control device 25.
[0026]
The program creation device 200 displays a program description screen in C language on the display device 24, and creates a program using the keyboard 22 and the mouse 23. For example, in the case where the data processing apparatus 100 according to the new design and manufacturing uses N registers, and when the first to N-th serial numbers are assigned to the N registers, the first to N-th serial numbers are assigned. A “Local variable declaration” is made for the K-th group of registers that are frequently used, and a “Global variable declaration” is made for the K + 1-th to N-th groups of registers that are infrequently used.
[0027]
These declarations are specified by using the keyboard 22 and the mouse 23. The register types are classified into two types, and registers that are used frequently are set with a small number of instruction bits, and registers that are used less frequently are set longer. This is for setting an instruction by the number of instruction bits. When the number of registers in the data processing device 100 is, for example, about 4,000 to 8,000, the number of instruction bits for designating the registers becomes 12 to 13 bits.
[0028]
The control device 25 changes the length of the instruction according to the frequency of use of the register. Frequently accessed registers set short-length instructions. Registers that are frequently used are assigned a shorter number of instruction bits, and registers that are less frequently used are assigned a longer number of instruction bits.
[0029]
The data processing device 100 acquires the compressed program AP created by the program creating device 200, decodes the register type, restores the number of instruction bits designating the register based on the register type, and obtains an instruction of a predetermined length. , An arbitrary operation is executed by designating a plurality of registers.
[0030]
The data processing device 100 includes, for example, an instruction decoding / reconstructing unit 3, a storage unit 4, a register array 11, and an instruction execution operation unit 50. The register array 11 is a collection of a plurality of registers.
[0031]
The storage means 4 stores a compression program AP for designating a corresponding register from the register array 11. The compression program AP created by the program creation device 200 is used. For example, the compression program AP is written in the storage means 4 for storing the program constructed by the data processing device 100 using a ROM writer or the like.
[0032]
This is because, in the data processing apparatus 100, a processor may be constructed from a programmable logic device (Programmable Logic Device; PLD) including a plurality of memory cells and arithmetic logic elements. The occupancy of the memory cells functioning as the ROM can be reduced. Of course, the storage means 4 for storing the program may be manufactured separately from the arithmetic processing device, and the compression program AP may be stored in the individual storage means 4 and then mounted on the same substrate. This is because a read-only memory (ROM) or an EEPROM (flash memory) is used as the storage unit 4.
[0033]
An instruction decoding / restoring means 3 is connected to the storage means 4, reads out the compressed program AP from the storage means 4, decodes the register type, and determines the number of instruction bits for designating the register based on the register type. It is made to restore. This is for aligning the instruction lengths and designating a plurality of registers based on the instructions.
[0034]
The instruction decoding / reconstruction means 3 is connected to an instruction execution operation means 50, and the instruction execution operation means 50 is connected to the register array 11. The instruction execution operation means 50 executes an arbitrary operation by designating a corresponding register in the register array 11 based on a program of a predetermined instruction length restored by the instruction decoding and restoration means 3.
[0035]
Subsequently, an example of processing in the data processing system 10 regarding the data processing method according to the present invention will be described. FIG. 2 is a flowchart illustrating a processing example in the data processing system 10.
[0036]
In this system 10, a program creation system I edits an instruction for executing a target arithmetic process based on a predetermined program language to create a program, and a program execution system II uses the program and a plurality of registers. It is assumed that data is processed by using The case where the data processing apparatus 100 uses N registers and the first to Nth serial numbers are assigned to the N registers as an example.
[0037]
With this as a processing condition, the program creation system edits an instruction for executing a target arithmetic process based on a predetermined program language in step A1 of the flowchart in FIG. 2A. Then, in step A2, the number of instruction bits designating the register is compressed based on the frequency of using the register, and the instruction length is shortened. For example, when the number of instruction bits for specifying the registers of the (K + 1) th to Nth groups is n bits and the number of instruction bits for specifying the registers of the first to Kth groups is m bits, for example, The number of instruction bits designating the first to Kth group registers is compressed so that nm = 8 bits.
[0038]
Then, in step A3, the register type is described in the instruction structure of the program. For example, a set of registers holding the augend and the addend, which are referred to as "register type 1" for the register type of "register number 1" and "register type 2" for the register type of "register number 2" At this time, if the use frequency of the registers of the first to Kth groups is high, the code “0” is described in “register type 1” and “register type 2”. When the usage frequency of the registers in the (K + 1) th to the Nth groups is low, the code “1” is described in “register type 1” and “register type 2”.
[0039]
Then, in step A4, compressed programs AP having different instruction lengths are created. In the compressed program AP, the number of instruction bits for specifying the registers of the first to Kth groups is m bits, and the number of instruction bits for specifying the registers of the (K + 1) th to Nth groups is n. Is a bit. In the above example, the instruction form including the first to Kth group register designations has an instruction length shorter by 16 bits than the instruction form including the K + 1th to Nth group register designations.
[0040]
On the other hand, in the program execution system, the compressed program AP created in the program creation system is acquired in step B1 of the flowchart shown in FIG. 2B. For example, the compression program AP is written in the storage means 4 for storing the program constructed by the data processing device 100 using a ROM writer or the like. In this compression program AP, registers that are frequently used are set with a short instruction bit number = m bits, and registers that are used less frequently are set with a long instruction bit number = n bits.
[0041]
Then, it is determined in step B2 whether to execute the instruction. The determination at this time is made by a known technique. When executing the instruction, the register type is decoded in step B3. For example, regarding the “register type 1” and the “register type 2”, the register numbers of the first to K-th groups are decoded from the code “0” as the frequently used registers, and the “register type 1” and the “register type” are decoded. With respect to “2”, the register numbers of the (K + 1) th to Nth groups are decoded as the registers whose use frequency is low from the code “1”.
[0042]
Then, based on the decoded register type, the number of instruction bits for designating the register is restored in step B4. For example, “0” is added to the upper 8 bits of the instruction bit number = m bits of the registers of the 1st to Kth groups, in this example. The instruction bit numbers of the registers of the first to Kth groups are aligned to n bits in the same manner as the instruction bit numbers of the registers of the (K + 1) th to Nth groups.
[0043]
At step B5, an arbitrary operation is executed by designating a plurality of registers based on the restored instruction having the predetermined length. After that, it is determined whether or not to end the arithmetic processing in step B6. If the arithmetic processing is not completed, the process returns to step B2 to determine whether to execute the instruction, and continues the arithmetic processing. When ending the arithmetic processing, power-off information or the like is detected, and the arithmetic processing ends.
[0044]
As described above, according to the data processing system 10 as the embodiment according to the present invention, on the one hand, a program is created by editing an instruction for executing a target arithmetic process based on a predetermined program language, and When processing data using the program and a plurality of registers, the program creating apparatus 200 compresses the number of instruction bits for designating the register based on the frequency of using the register, and executes the instruction of the program. Compressed programs AP having different instruction lengths are created by describing the register types in the structure.
[0045]
The data processing device 100 obtains the compressed program AP created by the program creating device 200, decodes the register type, restores the number of instruction bits designating the register based on the register type, and obtains an instruction of a predetermined length. , An arbitrary operation is executed by designating a plurality of registers.
[0046]
Accordingly, in the program creation system I, the length of the instruction can be changed according to the frequency of use of the register, so that an instruction having a short length can be set in a frequently accessed register. Thus, in the program execution system II, the compressed instruction can be set in the storage means 4 such as a ROM, and the memory capacity of the storage means 4 for storing the program data can be reduced. Further, when a processor is constructed by a PLD composed of memory cells and logical operation elements, the occupancy of memory cells functioning as ROM can be reduced, and more memory cells can be allocated to registers. Become.
[0047]
(2) Example
FIG. 3 is a block diagram illustrating a configuration example of a microprocessor 101 as an embodiment according to the present invention.
In this embodiment, the external memory 2 is connected to the data processing device 100 to constitute the microprocessor 101, and an arbitrary operation is executed by designating a plurality of registers. For this purpose, a compressed program AP of machine language instructions created by the program creation system I is obtained, the register type is decoded, and the number of instruction bits designating the register is restored based on the register type. A program having a long instruction structure is restored. By doing so, the memory capacity of a ROM or the like for storing program data can be reduced.
[0048]
In the microprocessor 101 shown in FIG. 3, the number of instruction bits designating the register is compressed in advance based on the frequency of use of the register, and the instruction length of the instruction type in which the register type is described in the instruction structure of the program is different. This is a device that processes data based on a compression program AP. The processor 101 acquires the compressed program AP created by the program creating device 200, decodes the register type, restores the number of instruction bits designating the register based on the register type, and restores the instruction bit number based on the instruction of a predetermined length. Thus, an arbitrary operation is executed by designating a plurality of registers.
[0049]
The microprocessor 101 has, for example, a register array 11, an instruction bit restoration decoder 13, a ROM 14, and an instruction execution operation unit 50. The register array 11 is a collection of a plurality of registers. The register array 11 is provided with, for example, 8192 × 32-bit registers ri (i = 0 to 8191). Each register ri holds an arbitrary value based on the write address Aw and the write control signal Sw, and outputs values such as the augend X and the addend Y based on the read address Ar.
[0050]
In the microprocessor 101, a ROM 14 for storing a program, which is an example of a storage unit, is mounted, and a compression program AP for designating a corresponding register ri from the register array 11 is stored. The compressed program AP has a machine language instruction (Instruction) structure, and a program created by the program creating device 200 is used. For example, the compression program AP is written in the ROM 14 using a ROM writer or the like. When the instruction is executed, the ROM 14 outputs the compression program AP based on, for example, the count output signal S5 from the program counter 54.
[0051]
An instruction bit restoration decoder 13 is connected to the ROM 14, and reads out a compressed program AP of machine language instructions from the ROM 14 to generate an instruction control signal S4, an instruction signal S9, and respective argument signals S10. The command signal S9 includes a load command, an add command, a cmp command, and a jump command. Each of the argument signals S10 includes access method # 1, access method # 2, "register type 1", "register type 2", register numbers r0, r1,..., A flag state (flag condition), a jump address, and the like. It is.
[0052]
The compression program AP includes an operation instruction for executing a register relative memory addressing process. In this processing, one register is selected based on the operation instruction, and the external memory 2 is selected based on the value held by the selected register. This process is executed by, for example, the access method # 1.
[0053]
In this example, the instruction bit restoration decoder 13 decodes “register type 1” and “register type 2”, and specifies an instruction bit for designating the register ri based on the “register type 1” and “register type 2”. It is arranged to recover the number = n bits. This is because the instruction length is made equal to the number of bits before compression, and a plurality of registers ri and the like are specified based on this instruction. The above-described instruction control signal S4 is output to the instruction reading state machine 52.
[0054]
Instruction execution operation means 50 is connected to the register array 11 and the instruction bit restoration decoder 13 described above. The instruction execution operation means 50 executes an arbitrary operation by designating the corresponding register ri in the register array 11 based on a program of a predetermined instruction length restored by the instruction bit restoration decoder 13.
[0055]
The instruction execution operation unit 50 includes an arithmetic and logic unit (ALU) and an execution state machine 51, an instruction reading state machine 52, a selector 53, a program counter (PC) 54, a +1 incrementer 55, and an input. Selector 59 and latch circuits 58, 510, and 511, and execute register-relative memory addressing processing.
[0056]
A data signal line L20 is connected to the register array 11, and the ALU 12 is connected through the signal line L20. The ALU 12 calculates values such as X and Y read from a register designated in the register array 11. The value of the operation result is Z. The operation types are addition, multiplication, subtraction, division, and the like. The calculation type is set based on the ALU control signal S35 output from the execution state machine 51. The data signal line L20 is connected to latch circuits 58, 511, 59 and the like in addition to the ALU12. DATA, an augend X value, an addend Y value, and the like are transmitted to the data signal line L20.
[0057]
The instruction bit restoration decoder 13 is connected to an execution state machine 51 and an instruction reading state machine 52, and controls the register array 11 and the ALU 12 to execute the operation instruction decoded by the instruction bit restoration decoder 13. You.
[0058]
The instruction reading state machine 52 controls the program counter 54 and the execution state machine 51 based on the instruction control signal S4 output from the instruction bit restoration decoder 13. For example, the machine 52 outputs the instruction signal S9 and the respective argument signals S10 from the instruction bit restoration decoder 13 to the execution state machine 51 and outputs an instruction execution start signal S29.
[0059]
The register array 11, the ALU 12, the latch circuits 58, 510, 511, and the selector 59 are connected to the execution state machine 51. The machine 51 starts executing the instruction based on the instruction execution start signal S29. For example, at the time of writing data, a write control signal Sw is output to the register array 11, and a selection control signal S24 is output to the selector 59. When reading data, a read address Ar is output to the register array 11.
[0060]
At the time of calculation, the latch control signal S34 is output to the latch circuit 58, and the latch control signal S38 is output to the latch circuit 510. An external control signal S16 is output outside the processor. When the execution of the instruction is completed, the execution state machine 51 outputs an execution completion signal S26 to the instruction reading state machine 52, and the value of the program counter 54 is advanced.
[0061]
A selector 53 is connected to the execution state machine 51 and the instruction reading state machine 52, and selects one of the increment output signal S7 and the branch control signal S27 based on the selection control signal S28, and uses this as a selector output. An output is made to the program counter 54. The selection control signal S28 is supplied from the execution state machine 51. The increment output signal S7 is output from the incrementer 55 to the selector 53.
[0062]
In the program counter 54, a location where the compressed program AP is read from the ROM 14 is designated based on the count control signal S30. The +1 incrementer 55 increments the count output signal S5 of the program counter 54 by "+1". The count control signal S30 is supplied from the instruction decoding state machine 52. The count output signal S5 is output to the ROM 14 in addition to the +1 incrementer 55.
[0063]
The selector 59 is connected to the data bus 19A, the register array 11 and the ALU 12, and outputs data (DATA) taken from the data bus 19A, an augend X value (addend Y value) output from the register array 11, or an output from the ALU 12. Any one of the calculated operation result values Z is input controlled based on the selection control signal S24.
[0064]
The latch circuit 58 is connected between the read port of the register array 11 and the ALU 12, and latches the output value X of the register ri based on the latch control signal S34. The latch circuit 510 is connected to the comparison output unit of the ALU 12, latches the coincidence detection signal S22 based on the latch control signal S38, and outputs a flag condition (flag condition) signal S23. The latch circuit 511 is connected between the read port of the register array 11 and the address bus 19B, and latches an external address (address) based on a latch control signal S17.
[0065]
If a jump (instruction branch) occurs due to the executed instruction, a branch control signal S27 indicating the jump destination address is output from the execution state machine 51 to the selector 53. The selector 53 selects the branch control signal S27 based on the selection control signal S28, and writes the branch control signal S27 to the program counter 54.
[0066]
The external memory 2 is connected to the execution state machine 51, the selector 59, the data signal line L20, and the latch circuit 511 through the I / O interface 60. This is for operating the ALU 12 based on the register relative memory addressing processing. The I / O interface 60 and the external memory 2 are connected by a data bus 19A, an address bus 19B and a control bus 19C, data is transferred by the data bus 19A, an address is transferred by the address bus 19B, and a control bus 19C. The external control signal S16 is transferred to the external memory 2. This is for controlling the external memory 2. As the external memory 2, for example, a RAM of 512 Mbytes × 32 bits (memory that can be written and read at any time) is used.
[0067]
FIG. 4 is a block diagram showing an example of the internal configuration of the register array 11. According to the register array 11 shown in FIG. 4, for example, 8192 32-bit registers ri (i = 0 to 8191) are provided, and the write port 15 is connected to the input of each register ri. The 1-bit register includes a D-type flip-flop circuit and the like.
[0068]
The write port 15 is connected to the selector 59 shown in FIG. 3, and based on the write control signal Sw and the write address Aw, the data (DATA) fetched from the data bus 19A, and the operand X output from the register array 11. Either the value (addend Y value) or the operation result value Z output from the ALU 12 is written into the registers r0 to ri. The write port 15 is connected to the execution state machine 51 and supplies a write address Aw.
[0069]
A read port 16 is connected to the output of each register ri. The read port 16 is connected to the ALU 12, the latch circuits 58, 511, the selector 59, and the like shown in FIG. 3 through the data signal line L20, and reads data (DATA) from the register ri specified based on the read address Ar. Is made. The read port 16 is connected to the execution state machine 51 and supplies a read address Ar.
[0070]
Next, an example of the structure of an instruction set in the ROM 14 will be described. FIGS. 5A to 5E are formats showing an example of the structure of an instruction handled by the microprocessor 101. 6A to 6D are table diagrams showing examples of description contents in the instruction structure.
[0071]
As shown in FIGS. 5A to 5E, there are five types of instructions set in the ROM 14 such as # F1 to # F5. In the microprocessor 101, the instructions of the instruction forms # F2 to # F4 are restored to the instruction form of the instruction form # F1 and handled. In each of these instruction forms # F1 to # F5, each instruction is roughly divided into load, add, and cmp instructions and a jump instruction. In the instruction forms # F1 to # F4, in the case of a load instruction, a code "0" is described in the instruction as shown in FIG. 6A, in the case of the add instruction, the code "1" is described in the instruction, and in the case of the cmp instruction, The code "2" is described in each instruction.
[0072]
The instruction form # F5 is a jump instruction, and in this case, code "3" is described in the instruction. For the cmp instruction, if the comparison results are the same, zero flag is set to “1” based on the flag state signal S23 of the latch circuit 510 shown in FIG. 3, and if not, “0” is set. Set.
[0073]
In this example, the load, add, and cmp instructions are represented by 5 bits when the number of the register ri to be accessed can be represented by, for example, 5 bits, and are represented by 13 bits otherwise. That is, the 0th register r0 to the 31st register r31, which are frequently used, are represented by m = 5 bits. The 32nd register r32 to the 8191st register r8191 which are used less frequently are represented by m = 13 bits.
[0074]
In the instruction form # F1, the instruction length is 32 bits, the number of instruction bits of the register ri indicated by “register number 1” is n = 13 bits, and the number of instruction bits of the register ri indicated by “register number 2” is also n = 13 bits. In the instruction form # F2, the instruction length is 24 bits, the number of instruction bits of the register ri indicated by “register number 1” is m = 5 bits, and the number of instruction bits of the register ri indicated by “register number 2” is n = 13 bits.
[0075]
Also in the instruction form # F3, the instruction length is 24 bits, the number of instruction bits of the register ri indicated by “register number 1” is n = 13 bits, and the instruction bit of the register ri indicated by “register number 2” is The number is m = 5 bits. The instruction form # F4 has an instruction length of 16 bits, the number of instruction bits of the register ri indicated by “register number 1” is m = 5 bits, and the number of instruction bits of the register ri indicated by “register number 2” is also m = 5 bits.
[0076]
In each of the instruction forms # F1 to # F4, the first two bits indicate the instruction type. Regarding the instruction type, load indicates transfer, add indicates addition, cmp indicates comparison, and jump indicates control transfer (branch). In the case of the load, add, and cmp instructions, 2-bit access methods # 1 and # 2 follow the instruction. The left of Operand is represented by access method # 1, "register number 1" on the left, and the right is represented by access method # 2, "register number 2" on the right.
[0077]
That is, access method # 1 indicates an access method of register ri indicated by “register number 1”, and access method # 2 indicates an access method of register ri indicated by “register number 2”. Access method # 1 and access method # 2 correspond to register number No. 1, register number No. 2, and processing is performed between them. In both cases, as shown in FIG. 6B, two types of access methods # 1 and # 2 are prepared.
[0078]
When the code “0” is described for the access methods # 1 and # 2, this is a method of directly accessing the register ri indicated by the register number 2. This indicates that the value of the register ri indicated by the register number is directly used. When the code “1” is described for the access methods # 1 and # 2, the microprocessor 101 accesses the external memory 2 using the value of the register ri indicated by “register number 1” as an address. (See FIG. 6B).
[0079]
In FIGS. 5A to 5D, 2-bit “register type 1” and “register type 2” are described successively after access methods # 1 and # 2. “Register type 1” indicates the type of register ri indicated by “register number 1”, and “register type 2” indicates the type of register ri indicated by “register number 2”. As shown in FIG. 6C, two types of registers are prepared. When a code “0” is described for “register type 1” and “register type 2”, the register ri has a register number of “31” or less and is frequently used. The register ri (i = 0 to 31) can represent the register number with m = 5 bits.
[0080]
When “1” is described for “register type 1” and “register type 2”, it indicates a register ri whose register number is “32” or more and whose use frequency is low. The register ri (i = 32 to 8191) represents the register number with n = 13 bits. Thus, the program can be compressed by distinguishing the register numbers.
[0081]
"Register type 1" and "Register number 2" are followed by "Register number 1" and "Register number 2". “Register number 1” indicates, for example, a register ri holding an augend, and “register number 2” indicates a register ri holding an addend.
[0082]
According to the format of the jump instruction shown in FIG. 5E, the instruction is described in the first two bits, and the flag state is described in the subsequent two bits. The next 20 bits describe a jump address. The flag state is a condition for determining whether to shift the instruction execution control as shown in FIG. 6D. The code “0” always transfers control “unconditionally”. The code “1” is “zero flag”, and the control is transferred when the zero flag is “1”. The code "2" is "non-zero flag", and the control is transferred when the zero flag is "0". Code "3" is unused.
[0083]
Subsequently, a processing example in the program creation system I will be described. FIG. 7 is a table showing an example of program creation in the program creation system I. In FIG. 7, P1 is an image of a program description screen, P2 shows the description contents, and P3 describes conditions applicable in the embodiment. This is for creating a compressed program by editing instructions for executing a target arithmetic process based on a predetermined program language by the program creating apparatus 200 shown in FIG.
[0084]
The program creation device 200 displays the program description screen P1 in C language shown in FIG. 7 on the display device 24 shown in FIG. 1, and creates a compressed program using the keyboard 22 and the mouse 23. At this time, data necessary for creating a program for the microprocessor 101 is read from the database 21. For example, “Global variable declaration”, “function declaration”, “Local variable declaration”, “assignment”, “addition”, “comparison”, and “branch” necessary for describing a program in the C language are read.
[0085]
In this example, the microprocessor 101 according to the new design / manufacture uses N = 8192 32-bit registers ri. Serial numbers 0 to 8191 are assigned to the 8192 registers ri. At this time, a “Local variable declaration” is made with the registers r0 to r31 in the 0th to 31st groups as a frequently used category. That is, in this example, “Local variable declaration” is assigned to the 31st and lower registers ri. In addition, a “Global variable declaration” is made for the registers r32 to r8191 of the 32nd to 8191st groups as a low-use category. That is, “Global variable declaration” is assigned to the 32nd or higher register ri.
[0086]
In the program creation device 200, when the number of instruction bits of the registers r32 to r8191 of the 32nd to 8191st groups where the “Global variable declaration” is made is n = 13 bits, the registers r0 to r31 where the Local variable declaration is made Are compressed to m = 5 bits, which is 8 bits less than this. At the same time, "register type 1" and "register type 2" are described in the instruction structure of the program, and compressed programs AP having different instruction lengths are created.
[0087]
In the control device 25 shown in FIG. 1, the length of the instruction is changed according to the frequency of use of the register ri. In this example, the frequently used registers r0 to r31 are set with a short instruction bit number m = 5 bits, and the infrequently used registers r32 to r8191 are set with a long instruction bit number n = 13 bits. You. In this manner, frequently accessed registers r0 to r31 can be set with short-length instructions, and the memory capacity of the program storage ROM 14 mounted on the microprocessor 101 can be reduced.
[0088]
Next, a compile example in the program creation device 200 will be described. FIG. 8 is a flowchart (main routine) showing a compilation example in the program creation device 200. FIG. 9 is a flowchart (subroutine) showing an example of assignment and calculation processing in the compiler.
[0089]
In this embodiment, it is assumed that the program creating system I edits an instruction for executing a target arithmetic process based on a program in C language and creates a compressed program. In addition, the microprocessor 101 uses 8192 registers r0 to r8191 and a case where serial numbers 0 to 8191 are assigned to the 8192 registers ri is taken as an example.
[0090]
Under this processing condition, the program creation system I sets the program address to “0” in step C1 of the flowchart in FIG. 8 in order to edit the instruction based on the program in C language. Thereafter, the process proceeds to step C2 to read one line of the C language program. At this time, for example, "global variable declaration" is shown on the program description screen P1 of the display device 24.
int * read add * write add, counter, end val;
Is displayed and also indicates the function declaration
void main ()

Is displayed.
[0091]
Then, in step C3, it is checked whether the description of the program is "global variable declaration". If the description is "global variable declaration", the process proceeds to step C4, where the 32nd or more registers r32 to r8191 are allocated. When the number of instruction bits designating registers r32 to r8191 of this group is m, m = 13 bits. The instruction is created in the instruction form # F1. Thereafter, the process proceeds to step C14.
[0092]
If the description is not "global variable declaration" in step C3, the process shifts to step C5 to check whether it is "local variable declaration". At this time, for example, "local variable declaration" is shown on the program description screen P1 of the display device 24.
int temp, added val;
Is displayed. If the description is "local variable declaration", the process proceeds to step C6, where the 31st and lower registers r0 to r31 are allocated. Since the frequency of using the register ri is high, the number of instruction bits n for specifying the register ri is compressed to 5 bits, which is 8 bits smaller than the registers r32 to r8191 declared as “global variables”. Instructions are created in instruction forms # F2 to # F4. Thereafter, the process proceeds to step C14.
[0093]
If the description is not "local variable declaration" in step C5, the process proceeds to step C7 to check whether "do" indicating the execution of the assignment / addition processing or the like is described in the C language program. At this time, for example, “do” is displayed on the program description screen P1 of the display device 24.
Figure 2004038586
Is displayed. If "do" indicating such a substitution / addition process is described, the process proceeds to step C8 to store the current program address. Thereafter, the process proceeds to step C14.
[0094]
If "do" is not described in step C7, the process proceeds to step C9, and it is checked whether "while" indicating the process during the process is described in the C language program. At this time, for example, “while” is displayed on the program description screen P1 of the display device 24.
while (counter! = end val);
Is displayed. If "while" indicating such a process of comparison / branch, etc., is described, the process proceeds to step C10 to execute an assignment / operation process.
[0095]
For example, a subroutine shown in FIG. 9 is called, and in step E1 of the flowchart, it is checked whether or not the relevant line describes "while" in the C language program. In the case of the line in which “while” is described, the process proceeds to step E2, and the command generated in the subsequent processing is the cmp command. Thereafter, the process shifts to step E6.
[0096]
If it is determined in step E1 that the row does not include "while", the process proceeds to step E3 to check whether the arithmetic processing is addition. If the arithmetic processing is addition, the process proceeds to step E4, and the instruction generated in the subsequent processing is set as an add instruction. If the arithmetic processing is not addition, the process proceeds to step E5, and the instruction generated in the subsequent processing is set as a load instruction. Thereafter, the process shifts to step E6.
[0097]
In step E6, the register number corresponding to the variable written to the register ri and the register number of the register ri corresponding to the variable read from the register array 11 can be checked. This is for determining the write address Aw and the read address Ar. Thereafter, the process shifts to step E7.
[0098]
In step E7, it is checked whether both register numbers are "32" or more. If both register numbers are equal to or larger than "32", the process proceeds to step E8 to generate an instruction in the instruction form # F1 shown in FIG. 5A. In this instruction form # F1, "1" is described in "register type 1" and "register type 2". At this time, “register type 1” and “register type 2” are described in the instruction structure of the compression program. For example, “1” is described in “register type 1” and “register type 2” for the registers r32 to r8191 in the 32nd to 8191st groups. Thereafter, the process returns to step C10 of the main routine shown in FIG.
[0099]
If both register numbers are not equal to or larger than "32" in step E7, the process shifts to step E9 to check whether both register numbers are equal to or smaller than "31". If both register numbers are equal to or smaller than "31", the process proceeds to step E10 to generate an instruction in the instruction mode # F4 shown in FIG. 5D. In this instruction form # F4, “0” is described in “register type 1” and “register type 2”. At this time, “register type 1” and “register type 2” are described in the instruction structure of the compression program. For example, “0” is described in “register type 1” and “register type 2” for the registers r0 to r31 of the 0th to 31st groups. Thereafter, the process returns to step C10 of the main routine shown in FIG.
[0100]
Further, when both register numbers are not equal to or smaller than "31", the process proceeds to step E11 to check whether the number of the register ri of the variable read from the register array 11 is equal to or larger than "32". If the number of the register ri of the variable to be read is “32” or more, the process proceeds to step E12 to generate an instruction in the instruction format # F2 shown in FIG. 5B. In this instruction form # F2, “0” is described in “register type 1”, and “1” is described in “register type 2”. Thereafter, the process returns to step C10 of the main routine shown in FIG.
[0101]
Furthermore, when the number of the register ri of the variable read from the register array 11 is not equal to or more than “32”, the process proceeds to step E13, and an instruction is generated in the instruction form # F3 shown in FIG. 5C. In this instruction form # F3, “1” is described in “register type 1”, and “0” is described in “register type 2”. Thereafter, the process returns to step C10 of the main routine shown in FIG. Thereafter, the process proceeds to step C11 to generate a jump instruction. The jump address of the jump instruction uses the previously stored program address. Thereafter, the process proceeds to step C14.
[0102]
If "while" is not described in step C9 described above, the process proceeds to step C12 to check whether data is to be substituted or added in the C language program. In the case of data substitution or addition, the process proceeds to step C13 to execute data substitution or arithmetic processing. In this step C13, the subroutine shown in FIG. 9 is called, and the process returns to step C13 of the main routine shown in FIG. 8 through steps E1 to E13 of the flowchart. Thereafter, the process proceeds to step C14.
[0103]
If it is not the substitution or addition of data in the C language program in step C12, the process proceeds to step C14. In step C14, it is checked whether the program is the last line in the C language program. If it is not the last line, the process goes to step C15 to advance the program address. Thereafter, the process returns to step C2 to repeat the above-described compile processing. This compile process ends at the last line.
[0104]
As a result, it is possible to create compressed programs AP having instruction formats # F1 to # F5 as shown in FIGS. 5A to 5E and different instruction lengths. In this compressed program AP, the number of instruction bits for specifying the registers r0 to r31 in the 0th to 31st groups is m = 5 bits, and the registers r32 to r8191 in the 32nd to 8191st groups are The number of instruction bits to be specified is n = 13 bits.
[0105]
Next, a processing example in the program execution system II will be described. FIG. 10 is a table showing an example of operation instructions according to the restored operation program. 11 is a state example of registers r0, r1,... R32, r33, r34, r35 and the like, and FIG. 12 is an image diagram showing an example of data storage in the external memory 2.
[0106]
In this example, two sets of ten memory cell arrays as shown in FIG. 12 are prepared in the external memory 2 connected to the data processing device 100. One is a memory array # M1 and the other is a memory array # M2. Then, based on eight operation instructions (Instruction) # I1 to # I8 shown in FIG. 10, "1" is added to the value stored in the set of memory arrays # M1, and the other set of memory arrays # An example of a calculation process for storing the result in M2 will be described.
[0107]
The operation instructions (Instruction) # I1 to # I8 shown in FIG. 10 are based on the operation program after the compression program AP in the ROM 14 is decompressed. In this operation program, as shown in FIG. 11, there are two registers ri having a high access frequency, and these are assigned to r0 and r1, respectively. As a result, the length of the entire program can be efficiently reduced as compared with the operation program before compression.
[0108]
In FIG. 11, the register indicated by the register number r0 is temporarily used, and the register indicated by the register number r1 stores the added value “1”. The register indicated by register number r32 stores the read address “0”, the register indicated by register number r33 stores the write address “10”, and the register indicated by register number r34 stores the initial value of the counter. The value “0” is stored, and the number of operations (end value) “10” is stored in the register indicated by the register number r35.
[0109]
In each of the operation instructions # I1 to # I8 shown in FIG. 10, the expression by mnemonic, the expression by machine language, and the contents of the processing are shown. The operation instruction # I1 is load, r0, (r32) represented by 140020h in machine language in the instruction structure shown in FIG. 5, and is read from the external memory 2 using the value of the register r32 of the register array 11 as an address. This is the content of storing the value in the register r0. As an operation, for example, when the value of the register r32 is set to “0”, the data “0” of the memory array # M1 in which the read address of the external memory 2 shown in FIG. 12 is “0” is read. The data "0" is written to the register r0.
[0110]
The operation instruction # I2 is add, r0, r1 represented by 4001h in machine language, and is a content for adding the value of the register r1 to the register r0 of the register array 11 and storing the result in the register r0. As an operation, “1” which is the value of the register r1 is added to “0” which is the content of the register r0, and as a result, “1” is written to the register r0.
[0111]
The operation instruction # I3 is load, (r33), r0 represented by 280420h in machine language, and is a content for writing the value of the register r0 into the external memory 2 using the value of the register r33 of the register array 11 as an address. As an operation, data “1” is written to the address of the memory array # M2 of the external memory 2 indicated by the register r33.
[0112]
The operation instruction # I4 is add, r32, r1 represented by 480401h in machine language, and is a content for adding the value of the register r1 to the register r32 of the register array 11 and storing the result in the register r32. As an operation, “1” which is the value of the register r1 is added to “0” which is the content of the register r32, and as a result “1” is written to the register r32.
[0113]
The operation instruction # I5 is add, r33, r1 represented by 480421h in machine language, and is a content for adding the value of the register r1 to the register r33 of the register array 11 and storing the result in the register r33. As an operation, “1” that is the value of the register r1 is added to “0” that is the content of the register r33, and as a result, “1” is written to the register r33.
[0114]
The operation instruction # I6 is add, r34, r1 represented by 480441h in machine language, and is a content for adding the value of the register r1 to the register r34 of the register array 11 and storing the result in the register r34. As an operation, “1” which is the value of the register r1 is added to “0” which is the content of the register r34, and as a result “1” is written to the register r34. By the operation instructions # I4 to # I6, "1" is added to the read address Ar and the write address Aw in the counter in the execution state machine 51.
[0115]
The operation instruction # I7 is cmp, r34, and r35 represented by 8C044023h in machine language. The contents of the register r34 of the register array 11 are compared with the contents of the register r35. "1" is set, and if different, "0" is set. As the operation, since the values “1” and “10” of the registers r34 and r35 are different, “0” is set to zeroflag. The value of the zero flag is held by the latch circuit 510, and is referred to by a subsequent instruction.
[0116]
The operation instruction # I8 is jump nz, LOOP represented by E00000h in a machine language. When the zero flag is “0”, the content of the control is transferred to the label indicated by LOOP. As an operation, when the zero flag is “0”, the control is transferred to the operation instruction # I1. When the above operation is repeated 10 times, the value of the register r34 becomes "10", the zero flag is set to "1" by the operation instruction # I7, the control is not transferred by the operation instruction # I8, and the operation processing is ended. It is made to do. In this manner, the ROM 14 can be used more efficiently than when the number of instruction bits of all the registers ri is expressed by a single method.
[0117]
Subsequently, an operation example in the microprocessor 101 will be described. FIG. 13 is a flowchart illustrating an operation example of the microprocessor 101. 14 and 15 are flowcharts showing processing examples (parts 1 and 2) in the instruction bit restoration decoder 13.
[0118]
In this embodiment, the microprocessor 101 constitutes the program execution system II and restores the operation program including the operation instructions # I1 to # I8 shown in FIG. 10 from the compressed program AP read from the ROM 14. At this time, if the code “0” is described in “register type 1” and “register type 2” for the instruction forms # F1 to # F4, the register number is expanded by the instruction bit restoration decoder 13. In the expansion of the instruction bits at this time, for example, 8-bit “0” is added to the upper part of the instruction bit number m = 5 bits of “register number 1”. Based on this calculation program, “1” is added to the value of the memory array # M1 in the external memory 2 shown in FIG. 12 and stored in the memory array # M2.
[0119]
Regarding the register state of the register array 11, as shown in FIG. 11, for example, for six registers r0, r1, r32, r33, r34, and r35, r0 is undefined, r1 is an initial value “1”, r32 and r34. Are both set to the initial value “0”, and r33 and r35 are set to the initial value “10”. When writing these values, the write address Aw is output to the register array 11 in the execution state machine 51, and its initial values “0”, “1”, and “10” are set.
[0120]
Under these operating conditions, in step F1 of the flowchart shown in FIG. 13, first, the instruction bit decompression decoder 13 sequentially receives a compressed program (machine instruction) AP from the ROM 14, decodes the program AP, and decodes the program AP into a predetermined instruction length. Are detected.
[0121]
The instruction bit restoration decoder 13 calls, for example, a subroutine shown in FIG. 14 to fetch an instruction portion in step G1 of the flowchart, and outputs an instruction signal S9 to the execution state machine 51. At the same time, the instruction bit restoration decoder 13 proceeds to step G2 and checks whether the instruction type is a jump instruction. If the instruction form is a jump instruction indicated by # F5, the process shifts to step G12 to output a flag condition and a jump address. Thereafter, the process returns to step F1 of the main routine.
[0122]
If the instruction type is not a jump instruction in step G2, the process proceeds to step G4 to check whether the code described in “register type 1” is “0” or “1” for the instruction type. If the code “0” is described in the “register type 1”, the process proceeds to step G4, and the instruction bit number m of the “register number 1” is extracted from the compressed program AP as a 5-bit length. Thereafter, the process proceeds to step G5, where “0” is added to the upper 8 bits of the instruction bit number m = 5 bits of “register number 1” to make the length 13 bits. Thereafter, the process proceeds to step G7.
[0123]
If the code "1" is described in the "register type 1" in step G3 described above, the process shifts to step G6 to take out the instruction bit number n of "register number 1" as 13 bits long from the compression program AP. After that, the process shifts to step G7 to check whether the code described in the “register type 2” is “0” or “1” for the instruction mode. If the code "0" is described in the "register type 2", the process proceeds to step G8, and the instruction bit number m of the "register number 2" is extracted from the compressed program AP as a 5-bit length. After that, the process shifts to step G9 to add “0” to the upper 8 bits of the instruction bit number m = 5 bits of “register number 2” to make it 13 bits long. Thereafter, the process proceeds to step G11.
[0124]
If the code "1" is described in the "register type 2" in step G7 described above, the process proceeds to step G10, where the instruction bit number n of "register number 2" is taken out from the compression program AP with a 13-bit length. After that, the process shifts to step G11 to detect "register number 1", "register number 2", "access method # 1" and "access method # 2".
[0125]
Thereafter, the process returns to step F1 of the main routine shown in FIG. Therefore, the “register type 1” and the “register type 2” are not output to the execution state machine 51, and the instruction control signal S4, the instruction signal S9, and the respective argument signals based on the operation instructions # I1 to # I8 having a predetermined instruction length. S10 is output.
[0126]
The command signal S9 includes a load command, an add command, a cmp command, and a jump command. Each argument signal S10 includes a flag state (flag condition), a jump address, and the like, such as access method # 1, access method # 2, register numbers r0, r1,. The instruction control signal S4 is output from the decoder 13 to the instruction reading state machine 52.
[0127]
The location (address) where the compressed program AP is read from the ROM 14 is specified by the program counter 54 (PC). These read operations are controlled by the instruction read state machine 52.
[0128]
The instruction reading state machine 52 controls the program counter 54 and the execution state machine 51 based on the instruction control signal S4 output from the instruction bit restoration decoder 13. For example, the machine 52 outputs the instruction signal S9 and the respective argument signals S10 from the instruction bit restoration decoder 13 to the execution state machine 51 and outputs an instruction execution start signal S29.
[0129]
The execution state machine 51 starts executing the instruction based on the instruction execution start signal S29. For example, at the time of writing data, a write control signal Sw is output to the register array 11, and a selection control signal S24 is output to the selector 59. When reading data, a read address Ar is output to the register array 11.
[0130]
At the time of calculation, the latch control signal S34 is output to the latch circuit 58, and the latch control signal S38 is output to the latch circuit 510. An external control signal S16 is output outside the processor. When the execution of the instruction is completed, the execution state machine 51 outputs an execution completion signal S26 to the instruction reading state machine 52, and the value of the program counter 54 is advanced.
[0131]
In the program counter 54, a location where the compressed program AP is read from the ROM 14 is designated based on the count control signal S30. The +1 incrementer 55 increments the count output signal S5 of the program counter 54 by "+1".
[0132]
Then, in step F2, when the execution state machine 51 receives the operation instruction # I1 under the instruction reading control of the instruction reading state machine 52, the execution state machine 51 writes the write signal based on load, r0, (r32) represented by 140020h in machine language. S16 is output to the external memory 2. This value is used as the read address Ar of the register array 11. Register array 11 outputs the 32nd value to data signal line L20.
[0133]
This value is held by the latch circuit 511 and output to the external memory 2 via the address bus 19B. Then, using the value of the register r32 of the register array 11 as an address, the value read from the external memory 2 is stored in the register r0. At this time, since the value of the register r32 is “0”, the data “0” of the memory array # M1 having the content of the address “0” of the external memory 2 shown in FIG. "0" is written to the register r0.
[0134]
That is, the data of the address (location) transferred from the external memory 2 by the address bus 19B is output to the selector 59. The execution state machine 51 outputs a selection signal S24 so that this data is selected. As a result, data is input to the register array 11. Then, the execution state machine 51 outputs the write address Aw = "0" to the register array 11. Thereafter, the execution state machine 51 is instructed to actually write the operation result value by using the write signal Sw.
[0135]
Thereafter, in step F3, when the execution state machine 51 receives the operation instruction # I2 under the instruction read control of the instruction read state machine 52, the execution state machine 51 reads the register array 11 based on the add, r0, r1 represented by the machine language 4001h. The value of the register r1 is added to the register r0, and the result is stored in the register r0. At this time, "1" which is the value of the register r1 is added to "0" which is the content of the register r0, and as a result "1" is written to the register r0.
[0136]
In step F4, when the execution state machine 51 receives the operation instruction # I3 under the instruction reading control of the instruction reading state machine 52, the execution state machine 51 registers the register array based on load, (r33), and r0 represented by 280420h in machine language. The value of the register r0 is written to the external memory 2 using the value of the register r33 of No. 11 as an address. At this time, data “1” is written to the address of the memory array # M2 of the external memory 2 indicated by the register r33.
[0137]
After that, in step F5, when the execution state machine 51 receives the operation instruction # I4 under the instruction reading control of the instruction reading state machine 52, the execution state machine 51 reads the register array 11 based on add, r32, r1 represented by the machine language 480401h. The value of the register r1 is added to the register r32, and the result is stored in the register r32. At this time, "1" which is the value of the register r1 is added to "0" which is the content of the register r32, and as a result "1" is written to the register r32. By the operation instruction # I4, "1" is added to the read address Ar and the write address Aw in the counter in the execution state machine 51.
[0138]
Then, in step F6, when the execution state machine 51 receives the operation instruction # I5 under the instruction reading control of the instruction reading state machine 52, the execution state machine 51 reads the register array 11 based on add, r33, and r1 represented by the machine language 480421h. The value of the register r1 is added to the register r33, and the result is stored in the register r33. At this time, “1” that is the value of the register r1 is added to “0” that is the content of the register r33, and as a result, “1” is written to the register r33. By the operation instruction # I5, the counter in the execution state machine 51 adds "1" to the read address Ar and the write address Aw.
[0139]
After that, in step F7, when the execution state machine 51 receives the operation instruction # I6 under the instruction reading control of the instruction reading state machine 52, the execution state machine 51 reads the register array 11 based on add, r34, r1 represented by the machine language 480441h. The value of the register r1 is added to the register r34, and the result is stored in the register r34. At this time, "1" which is the value of the register r1 is added to "0" which is the content of the register r34, and the result "1" is written to the register r34. By the operation instruction # I6, "1" is added to the read address Ar and the write address Aw in the counter in the execution state machine 51.
[0140]
In this example, it is determined in step F8 whether the value indicated by the register r35 has reached 10 times. For example, when the execution state machine 51 receives the operation instruction # I7 under the instruction reading control of the instruction reading state machine 52, the execution state machine 51 reads the register r34 of the register array 11 based on cmp, r34, and r35 represented by 8C044023h in machine language. The content is compared with the content of the register r35. If the values are the same, zero flag is set to "1", and if they are different, the value is set to "0". At this time, since the values “1” and “10” of the registers r34 and r35 are different, “0” is set in the zero flag. The value of the zero flag is held by the latch circuit 510, and is referred to by a subsequent instruction.
[0141]
Then, when the execution state machine 51 receives the operation instruction # I8 under the instruction reading control of the instruction reading state machine 52, if the zero flag is “0” based on jump nz, LOOP represented by E00000h in machine language, Transfers control to the label indicated by LOOP. If the zero flag is "0", the control is transferred to the operation instruction # I1 in step F2. When the above operation is repeated 10 times in step F8, the value of the register r34 becomes "10", the zero flag is set to "1" by the operation instruction # I7, and the control is not transferred by the operation instruction # I8. Is made to end.
[0142]
As described above, according to the microprocessor 101 as the embodiment according to the present invention, the number of instruction bits for designating the register ri based on the frequency of use among the 8192 registers r0 to r8191 is compressed in advance. The data is processed based on compressed programs AP having different instruction lengths in which "register type 1" and "register type 2" are described in the instruction structure of the program.
[0143]
The ROM 14 stores a compression program AP for designating the register ri from among the 8192 registers r0 to r8191. The instruction bit decompression decoder 13 reads out the compressed program AP from the ROM 14 and decodes “register type 1” and “register type 2”. Based on the “register type 1” and “register type 2”, the register ri is read. The number of instruction bits to specify is restored.
[0144]
Therefore, a compressed program AP having an instruction length variable according to the frequency of use of the register ri, in which frequently-accessed registers r0 to r31 are set with a short-length instruction, , So that the memory capacity can be reduced. In this example, the memory capacity can be reduced by 16 bits × 32 pieces × the number of instructions as compared with before the program is compressed.
[0145]
This makes it possible to reduce the occupancy of the memory cells functioning as the ROM when the microprocessor 101 is constructed by the PLD including the memory cells and the logic operation elements, and it is possible to allocate more memory cells to the registers. become able to.
[0146]
【The invention's effect】
As described above, according to the data processing system of the present invention, on the one hand, an instruction for executing a target arithmetic process is edited based on a predetermined program language to create a program, and on the other hand, When processing data using a program and multiple registers, obtain the compressed program created by the program creation system, decode the register type, and specify the number of instruction bits that specify the register based on this register type. And a data processing device for executing an arbitrary operation by designating a plurality of registers based on an instruction of a predetermined length.
[0147]
With this configuration, the length of an instruction can be changed in the program creation system according to the frequency of use of the register. Therefore, an instruction with a short length can be set in a frequently accessed register. Therefore, in the program execution system, the capacity of a memory such as a ROM for storing program data can be reduced. Further, when a processor is constructed by a PLD including memory cells and logical operation elements, the occupancy of the memory cells functioning as ROM can be reduced, and more memory cells can be allocated to registers.
[0148]
According to the data processing device of the present invention, the number of instruction bits for designating a register is pre-compressed based on the frequency of using the register, and the instruction length in which the register type is described in the instruction structure of the program When processing data based on a compression program different from the compression program, there is provided an instruction decoding and restoring means for restoring the number of instruction bits for designating the register based on the type of register decoded from the compression program. And performs an arbitrary operation by designating a register based on the instruction of a predetermined length restored by the above.
[0149]
With this configuration, a compressed program having an instruction length that is variable according to the frequency of use of a register, wherein a short-length instruction is set in a frequently accessed register, and compressed program data is stored in a storage unit. Therefore, the memory capacity can be reduced. Therefore, when a processor is constructed by a PLD including memory cells and logical operation elements, the occupancy of the memory cells functioning as ROM can be reduced, and more memory cells can be allocated to registers.
[0150]
According to the data processing method according to the present invention, a program creation system edits an instruction for executing a target arithmetic process based on a predetermined program language to create a program, and the program execution system combines the program with a plurality of programs. When processing data using a register, the program creation system compresses the number of instruction bits for designating the register based on the frequency of use of the register, and specifies the register type in the instruction structure of the program. Write a compressed program with a different instruction length by writing, and the program execution system obtains the compressed program created by the program creation system, decodes the register type, and registers the register based on the decoded register type. Restore the specified number of instruction bits, and specify multiple registers based on the restored instruction of the specified length. It is adapted to perform any of the operations Te.
[0151]
With this configuration, the length of an instruction can be changed in the program creation system according to the frequency of use of the register. Therefore, an instruction with a short length can be set in a frequently accessed register. Therefore, in the program execution system, the capacity of a memory such as a ROM for storing program data can be reduced. Further, when a processor is constructed by a PLD including memory cells and logical operation elements, the occupancy of the memory cells functioning as ROM can be reduced, and more memory cells can be allocated to registers.
[0152]
The present invention is very suitable when applied to these embedded electronic devices such as a CPU that performs various data processing based on an instruction execution program and the like, an MPU, a PLD, and the like.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration example of a data processing system 10 as an embodiment according to the present invention.
FIG. 2 is a flowchart illustrating a processing example in the data processing system 10.
FIG. 3 is a block diagram illustrating a configuration example of a microprocessor 101 as an embodiment according to the present invention.
FIG. 4 is a block diagram showing an example of the internal configuration of a register array 11;
5A to 5E are formats showing examples of the structure of an instruction set in a ROM 14. FIG.
FIGS. 6A to 6D are table diagrams showing examples of description contents in an instruction structure.
FIG. 7 is a table showing an example of program creation in the program creation system I.
FIG. 8 is a flowchart (main routine) illustrating a compilation example in the program creation device 200.
FIG. 9 is a flowchart (subroutine) showing an example of assignment and calculation processing in a compiler.
FIG. 10 is a table showing an example of an operation instruction according to a restored operation program.
FIG. 11 is an image diagram showing a state example of registers such as r0, r1,..., R32, r33, r34, and r35.
FIG. 12 is an image diagram showing an example of data storage in an external memory 2;
FIG. 13 is a flowchart illustrating an operation example of the microprocessor 101.
FIG. 14 is a flowchart illustrating a processing example (part 1) in the instruction bit restoration decoder 13;
FIG. 15 is a flowchart showing a processing example (part 2) in the instruction bit restoration decoder 13;
[Explanation of symbols]
2 ... external memory, 3 ... instruction decoding and restoring means, 4 ... storage means, 10 ... data processing system, 11 ... register array, 12 ... ALU, 13 ... instruction bits Restoration decoder (instruction decoding / restoration means), 14 ROM (storage means), 50 instruction execution calculation means, 100 data processing apparatus, 101 microprocessor, 200 program creation apparatus

Claims (7)

一方で、所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、他方で、当該プログラムと複数のレジスタとを使用してデータを処理するシステムであって、
前記レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムを作成するプログラム作成装置と、
前記プログラム作成装置で作成された圧縮プログラムを取得してレジスタ種類を解読し、前記レジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、所定長さの命令に基づいて複数のレジスタを指定して任意の演算を実行するデータ処理装置とを備えることを特徴とするデータ処理システム。
On the one hand, a system for editing a command for executing a target arithmetic processing based on a predetermined programming language to create a program, and, on the other hand, a system for processing data using the program and a plurality of registers. hand,
A program creating device that compresses the number of instruction bits specifying the register based on the frequency of using the register, and describes a register type in an instruction structure of the program to create a compressed program having a different instruction length;
Obtain the compressed program created by the program creation device, decode the register type, restore the number of instruction bits specifying the register based on the register type, and restore a plurality of registers based on an instruction of a predetermined length. A data processing system comprising: a data processing device that executes an arbitrary operation by designating the data processing device.
前記データ処理装置は、
複数のレジスタと、
前記レジスタを指定するための圧縮プログラムを記憶する記憶手段と、
前記記憶手段から圧縮プログラムを読み出してレジスタ種類を解読し、当該レジスタ種類に基づいて前記レジスタを指定するための命令ビット数を復元する命令解読復元手段と、
前記命令解読復元手段によって復元された所定の長さの命令に基づいて前記レジスタを指定して任意の演算を実行する命令実行演算手段とを有することを特徴とする請求項1に記載のデータ処理システム。
The data processing device includes:
Multiple registers,
Storage means for storing a compression program for specifying the register;
Instruction decoding and restoring means for reading the compressed program from the storage means to decode the register type, and for restoring the number of instruction bits for designating the register based on the register type;
2. The data processing apparatus according to claim 1, further comprising: an instruction execution operation unit configured to execute an arbitrary operation by designating the register based on the instruction of a predetermined length restored by the instruction decoding and restoration unit. system.
前記レジスタ種類は、
N個のレジスタを使用する場合であって、
前記N個のレジスタに第1番から第N番のシリアル番号を付与したとき、
前記第1番から第K番のグループのレジスタを使用頻度が高い部類に、
前記第K+1番から第N番のグループのレジスタを使用頻度が低い部類に分けることを特徴とする請求項1に記載のデータ処理システム。
The register type is
When using N registers,
When the first to Nth serial numbers are assigned to the N registers,
The registers of the 1st to Kth groups are classified into a class that is frequently used,
The data processing system according to claim 1, wherein the registers of the (K + 1) th to (N) th groups are classified into low-use categories.
レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数が予め圧縮されると共に、当該プログラムの命令構造の中にレジスタ種類が記述された命令長の異なる圧縮プログラムに基づいてデータを処理する装置であって、
複数のレジスタと、
前記レジスタを指定するための圧縮プログラムを記憶する記憶手段と、
前記記憶手段から圧縮プログラムを読み出してレジスタ種類を解読し、当該レジスタ種類に基づいて前記レジスタを指定するための命令ビット数を復元する命令解読復元手段と、
前記命令解読復元手段によって復元された所定長さの命令に基づいて前記レジスタを指定して任意の演算を実行する命令実行演算手段とを備えることを特徴とするデータ処理装置。
The number of instruction bits designating the register is pre-compressed based on the frequency of use of the register, and the data is processed based on a compression program having a different instruction length in which the register type is described in the instruction structure of the program. A device,
Multiple registers,
Storage means for storing a compression program for specifying the register;
Instruction decoding and restoring means for reading the compressed program from the storage means to decode the register type, and for restoring the number of instruction bits for designating the register based on the register type;
A data processing apparatus comprising: an instruction execution operation unit configured to execute an arbitrary operation by designating the register based on an instruction having a predetermined length restored by the instruction decryption restoration unit.
前記レジスタ種類は、
N個のレジスタを使用する場合であって、
前記N個のレジスタに第1番から第N番のシリアル番号を付与したとき、
前記第1番から第K番のグループのレジスタを使用頻度が高い部類に、前記第K+1番から第N番のグループのレジスタを使用頻度が低い部類に分けられることを特徴とする請求項4に記載のデータ処理装置。
The register type is
When using N registers,
When the first to Nth serial numbers are assigned to the N registers,
5. The register according to claim 4, wherein the registers of the first to Kth groups are classified into a category of high use frequency, and the registers of the K + 1th to Nth groups are classified into a category of low frequency use. The data processing device as described in the above.
プログラム作成系で所定のプログラム言語に基づいて目的の演算処理を実行するための命令を編集してプログラムを作成し、プログラム実行系で当該プログラムと複数のレジスタとを使用してデータを処理する方法であって、
前記プログラム作成系では、
前記レジスタを使用する頻度に基づいて当該レジスタを指定する命令ビット数を圧縮すると共に、当該プログラムの命令構造の中にレジスタ種類を記述して命令長の異なる圧縮プログラムを作成し、
前記プログラム実行系では、
前記プログラム作成系で作成された圧縮プログラムを取得してレジスタ種類を解読し、
解読された前記レジスタ種類に基づいて当該レジスタを指定する命令ビット数を復元し、
復元された所定長さの前記命令に基づいて複数のレジスタを指定して任意の演算を実行することを特徴とするデータ処理方法。
A method in which a program creating system edits an instruction for executing a target arithmetic process based on a predetermined program language to create a program, and the program executing system processes data using the program and a plurality of registers. And
In the program creation system,
While compressing the number of instruction bits specifying the register based on the frequency of using the register, writing a register type in the instruction structure of the program to create a compressed program with a different instruction length,
In the program execution system,
Obtain the compression program created by the program creation system and decode the register type,
Restoring the number of instruction bits specifying the register based on the decoded register type,
A data processing method, wherein a plurality of registers are designated and an arbitrary operation is executed based on the restored predetermined length instruction.
前記レジスタ種類は、
N個のレジスタを使用する場合であって、
前記N個のレジスタ第1番から第N番のシリアル番号を付与したとき、
前記第1番から第K番のグループのレジスタを使用頻度が高い部類に、
前記第K+1番から第N番のグループのレジスタを使用頻度が低い部類に分けることを特徴とする請求項6に記載のデータ処理方法。
The register type is
When using N registers,
When the first to Nth serial numbers of the N registers are assigned,
The registers of the 1st to Kth groups are classified into a class that is frequently used,
7. The data processing method according to claim 6, wherein the registers in the (K + 1) th to the Nth groups are classified into low-use categories.
JP2002195123A 2002-03-27 2002-07-03 Data processing system, data processing apparatus, and data processing method Expired - Fee Related JP3698125B2 (en)

Priority Applications (7)

Application Number Priority Date Filing Date Title
JP2002195123A JP3698125B2 (en) 2002-07-03 2002-07-03 Data processing system, data processing apparatus, and data processing method
EP03715417A EP1489493A1 (en) 2002-03-27 2003-03-26 Operation processor, building method, operation processing system, and operation processing method
KR10-2004-7015082A KR20040097212A (en) 2002-03-27 2003-03-26 Operation processor, building method, operation processing system, and operation processing method
PCT/JP2003/003716 WO2003081422A1 (en) 2002-03-27 2003-03-26 Operation processor, building method, operation processing system, and operation processing method
US10/508,802 US7581083B2 (en) 2002-03-27 2003-03-26 Operation processing device, system and method having register-to-register addressing
US11/821,424 US20070250685A1 (en) 2002-03-27 2007-06-22 Operation-processing device, method for constructing the same, and operation-processing system and method
US11/821,447 US20080046470A1 (en) 2002-03-27 2007-06-22 Operation-processing device, method for constructing the same, and operation-processing system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002195123A JP3698125B2 (en) 2002-07-03 2002-07-03 Data processing system, data processing apparatus, and data processing method

Publications (2)

Publication Number Publication Date
JP2004038586A true JP2004038586A (en) 2004-02-05
JP3698125B2 JP3698125B2 (en) 2005-09-21

Family

ID=31703633

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002195123A Expired - Fee Related JP3698125B2 (en) 2002-03-27 2002-07-03 Data processing system, data processing apparatus, and data processing method

Country Status (1)

Country Link
JP (1) JP3698125B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014209399A1 (en) * 2013-06-28 2014-12-31 Hewlett-Packard Development Company, L.P. Memory component capable to communicate at multiple data widths
US9189234B2 (en) 2013-09-04 2015-11-17 Globalfoundries Inc. Reducing overhead in loading constants
CN117331512A (en) * 2023-12-01 2024-01-02 芯动微电子科技(武汉)有限公司 Data compression and processing method for executing write operation on GPU (graphics processing unit) nuclear memory

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014209399A1 (en) * 2013-06-28 2014-12-31 Hewlett-Packard Development Company, L.P. Memory component capable to communicate at multiple data widths
US9189234B2 (en) 2013-09-04 2015-11-17 Globalfoundries Inc. Reducing overhead in loading constants
CN117331512A (en) * 2023-12-01 2024-01-02 芯动微电子科技(武汉)有限公司 Data compression and processing method for executing write operation on GPU (graphics processing unit) nuclear memory
CN117331512B (en) * 2023-12-01 2024-04-12 芯动微电子科技(武汉)有限公司 Data compression and processing method for executing write operation on GPU (graphics processing unit) nuclear memory

Also Published As

Publication number Publication date
JP3698125B2 (en) 2005-09-21

Similar Documents

Publication Publication Date Title
US5907842A (en) Method of sorting numbers to obtain maxima/minima values with ordering
JP3649470B2 (en) Data processing device
US6915413B2 (en) Micro-controller for reading out compressed instruction code and program memory for compressing instruction code and storing therein
JP2005332361A (en) Program command compressing device and method
JPH0810428B2 (en) Data processing device
US20080046470A1 (en) Operation-processing device, method for constructing the same, and operation-processing system and method
US7552313B2 (en) VLIW digital signal processor for achieving improved binary translation
JP2001034471A (en) Vliw system processor
US6036350A (en) Method of sorting signed numbers and solving absolute differences using packed instructions
EP1267255A2 (en) Conditional branch execution in a processor with multiple data paths
JP4078243B2 (en) Method and apparatus for executing repeated block instructions along a nested loop with zero cycle overhead
US6542989B2 (en) Single instruction having op code and stack control field
US20070234244A1 (en) System and method for checking equivalence between descriptions
US7047396B1 (en) Fixed length memory to memory arithmetic and architecture for a communications embedded processor system
JPH09231071A (en) Computer system
JP3698125B2 (en) Data processing system, data processing apparatus, and data processing method
US7647368B2 (en) Data processing apparatus and method for performing data processing operations on floating point data elements
US20040236929A1 (en) Logic circuit and program for executing thereon
US20070106884A1 (en) Hybrid memory system for a microcontroller
KR20000061574A (en) Micro computer system with compressed instruction
US6144321A (en) Microprocessor dedicated to processing of bit streams in a system of compression/decompression of animated images
EP1403768A2 (en) Processor system, processor and arithmetic processing method
US6133859A (en) Microprocessor dedicated to processing of bit streams in a system of compression/decompression of animated images
CN114428630B (en) Chip algorithm upgrading method and device and chip
US5768554A (en) Central processing unit

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040416

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050614

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050627

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080715

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090715

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees