JP2004046318A - Computer, integrated circuit device and method for instruction execution in computer - Google Patents

Computer, integrated circuit device and method for instruction execution in computer Download PDF

Info

Publication number
JP2004046318A
JP2004046318A JP2002199577A JP2002199577A JP2004046318A JP 2004046318 A JP2004046318 A JP 2004046318A JP 2002199577 A JP2002199577 A JP 2002199577A JP 2002199577 A JP2002199577 A JP 2002199577A JP 2004046318 A JP2004046318 A JP 2004046318A
Authority
JP
Japan
Prior art keywords
instruction
address
additional
data
stored
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.)
Pending
Application number
JP2002199577A
Other languages
Japanese (ja)
Inventor
Kunihiro Ohara
大原 邦裕
Hiroshi Narutomi
成冨 裕志
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2002199577A priority Critical patent/JP2004046318A/en
Publication of JP2004046318A publication Critical patent/JP2004046318A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a computer and the like that can perform correction, such as addition or deletion of instruction data despite a simple structure. <P>SOLUTION: A microcomputer 100 comprises a ROM 120 storing an instruction data column, a CPU 110 having an IR 111 and a PC 112 showing a specific instruction address SIA, instruction addition registers 131 etc. capable of storing added instruction data and an added address, an added address comparing circuit 140 for comparing the specific instruction address SIA and the added address, and an instruction selector 150. If the added address comparing circuit 140 detects that the specific instruction address SIA and the added address are unequal, the instruction selector 150 outputs specific instruction data SID to the IR 111. If the specific instruction address SIA and the added address are equal, the PC 112 stops updating the specific instruction address SIA, and the instruction selector 150 selects the added instruction data to output them to the IR 111. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、計算機及びその命令実行方法に関し、特に、命令を修正(追加あるいは削除)できる計算機、これを1チップに集積した集積回路装置、及び計算機におけるこのような修正(追加や削除)を含む命令実行方法に関する。
【0002】
【従来の技術】
図9に示すように、マイクロコンピュータ10には、CPU1のほかマスクROM4を内蔵するものがある。このマイクロコンピュータ10では、マスクROM4に格納されプログラムを成す命令データ列のうち、プログラムカウンタ3に示す特定命令アドレスで特定される特定命令データをインストラクションレジスタ2に順次読み込んでCPU1で実行し、所定の結果を得るようにされている。
【0003】
しかし、マスクROM4に記憶させたプログラム(命令データ列)にバグが発見された場合には、そのプログラムを修正することができず、マイクロコンピュータを廃棄せざるを得なかった。
【0004】
これに対し、特開昭61−239330号では、ROM/RAMに格納されたプログラムを、RAMに記憶した修正プログラムで置き換えるマイクロプログラム修正方式が開示されている。具体的には、実行されているプログラムが修正したい箇所に達したとき、アドレス生成回路の動作を停止させ、RAMに記憶されていた修正プログラムを実行させる。修正プログラムの最後には無条件分岐命令を置き、この命令により、ROM/RAMに格納されたプログラムの実行に戻り、アドレス生成回路の動作を再開させる。かくして、プログラムを修正して実行できたこととなる。
【0005】
また、特開昭58−31450号では、ROMに格納されたプログラムの所望部分を、1ステップ毎に変更するプログラム変更方式が開示されている。具体的には、プログラムの進行により、命令を記憶したROMのアドレスを指示するアドレスレジスタの値と、変更プログラム・アドレスレジスタの値とが一致したとき、ROMからの命令に代えて、変更データ用レジスタの内容をマイクロプロセッサで実行させた後に、これをストップさせ、変更データ用レジスタと変更プログラム・アドレスレジスタの内容を変更し、マイクロプロセッサにおけるプログラムの実行を再開することで、繰り返し変更動作を行うことができる。かくして、プログラムを修正して実行できたこととなる。
【0006】
【発明が解決しようとする課題】
しかしながら、上述の特開昭61−239330号では、修正プログラム(命令データ)のほか、その最後に無条件分岐命令を置く必要があり、この無条件分岐命令を処理する時間が余分にかかる。また、複雑な構造のマイクロプログラム修正手段を要し、マイクロコンピュータのチップサイズが大きくなるなどコストアップになる。
また、上述の特開昭58−31450号では、命令の変更後にマイクロプロセッサをストップする必要があり、ストップと再開により大きなデッドサイクルが生じる。また、ROMからの命令を、変更データ用レジスタの内容に置き換えて実行させるものであり、命令の追加や削除は不可能である。
本発明はかかる問題点に鑑みてなされたものであって、簡単な構造を有しながら、命令データの追加や削除という修正が可能な計算機、これを1チップに集積した集積回路装置、及び計算機における命令実行方法を提供することを目的とする。
【0007】
【課題を解決するための手段、作用及び効果】
その解決手段は、命令データ列が記憶されたメモリと、命令レジスタ、及び、上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有するCPUと、外部から書き込み可能で、上記命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ−アドレス対を少なくとも1対以上記憶可能に構成されてなる追加命令記憶手段と、上記プログラムカウンタの示す上記特定命令アドレスと上記追加命令記憶手段に記憶された上記追加アドレスとを比較する第1比較手段と、上記特定命令データと上記追加命令データのいずれかを選択して、上記命令レジスタに出力する選択手段と、を備える計算機であって、上記第1比較手段において、上記特定命令アドレスと上記追加アドレスとが不一致であるとき、上記選択手段は上記特定命令データを選択して上記命令レジスタに出力し、上記特定命令アドレスと上記追加アドレスとが一致したとき、上記プログラムカウンタは上記特定命令アドレスの更新を停止し、上記選択手段は上記特定命令データ、及び、上記追加命令記憶手段に記憶された追加命令データであって、上記特定命令アドレスに一致する追加アドレスと上記データ−アドレス対にをなす追加命令データ、のいずれか一方を先に選択して上記命令レジスタに出力し、他方をその後に選択して出力する計算機である。
【0008】
本発明の計算機は、メモリに記憶された命令データ列(プログラム)の所望位置に命令データを追加するに当たり、第1比較手段において、プログラムカウンタ(以下、単にPCともいう)の示す特定命令アドレスと追加する位置を示す追加アドレスとが一致した場合に、プログラムカウンタにおける特定命令アドレスの更新を停止させる。これと共に、メモリに記憶され特定命令アドレスで特定される特定命令データと前後して、一致した追加アドレスとデータ−アドレス対を成して追加命令記憶手段に記憶されている追加命令データを命令レジスタに出力する。従って、CPUで実行しているプログラムを中断することなく、命令データ列の中に追加命令データを追加して実行させることができる。このため、プログラムの中断に伴うデッドサイクルが生じない。
【0009】
ここで、メモリには、マスクROMのほか、フィールドPROMを用いることができる。さらに、EPROM,EEPROM,フラッシュメモリ,RAMなどを用いることもできる。特にマスクROM、フィールドPROMを用いるものに本発明を適用するのが好ましい。これらのROMは、一旦記憶させた命令データ列を修正できないからである。
また、追加命令記憶手段は、データ−アドレス対を成す追加命令データと追加アドレスとを互いに関連づけて記憶できればよく、例えば、レジスタやRAM,PROM,EPROM,EEPROM,フラッシュメモリなどで構成することができる。特に、追加したい命令データが少量(例えば1ワード〜数10ワード程度)の場合には、追加命令記憶手段としてレジスタを用いるのが好ましい。アドレス線などを形成しなくても良く、簡単な構造でレジスタを構成できるからである。一方、追加する命令データが多量の場合には、追加命令記憶手段としてRAMやPROM等を用いるのが好ましい。但し、アドレス制御などが必要になるので、アドレス線を形成する必要があるなど、計算機の回路構成が複雑になる。
【0010】
さらに、請求項1に記載の計算機であって、前記特定命令アドレスに一致する追加アドレスとのデータ−アドレス対をなす追加命令データが、前記命令レジスタに重複なく出力されるようにする重複出力防止手段を備える計算機とすると良い。
【0011】
前述の計算機では、特定命令アドレスと追加アドレスとが一致すると、プログラムカウンタでの特定命令アドレスの更新が停止されるため、プログラムカウンタが示す特定命令アドレスが変化しない。すると、次のサイクルでも再び、特定命令アドレスと追加アドレスとが一致することとなる。このため、同じ追加命令データが無限回追加されることとなり、適切にプログラムの実行ができないおそれがある。
そこで、本発明のように重複出力防止手段を備えることにより、既に出力された追加命令データを重複して出力することが防止されるので、適切に追加命令データを追加したプログラムを実行することができるようになる。
しかも、プログラム(命令データ列)の同じ位置に連続して複数の追加命令データを追加したいために、同じ追加アドレスを有するデータ−アドレス対が複数記憶されている場合でも、この重複出力防止手段を備えることにより、このような同じ追加アドレスを有する複数のデータ−アドレス対に属する各追加命令データを、順次重複なく命令レジスタに出力することができる。このため、1つの追加命令データを追加する場合でも、あるいは複数の追加命令データを連続して追加する場合でも、適切に命令データを追加したプログラムを実行することができる。
【0012】
さらに、請求項2に記載の計算機であって、前記重複出力防止手段は、前記追加命令記憶手段から読み出すべき追加命令データと前記データ−アドレス対をなす前記追加アドレスを指示するポインタであって、上記追加命令記憶手段に記憶されている複数の前記追加アドレスを所定の検索順序で検索して、前記プログラムカウンタが示す前記特定命令アドレスに一致する追加アドレスのうち、最初に検索された追加アドレスを指示するポインタと、上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示していなかったときには、次回に上記所定の検索順序の先頭から順に上記追加アドレスについて上記検索をさせ、上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示しているときには、次回に上記所定の順序のうちポインタが現在指示している上記追加アドレスから見て次以降の検索順序の追加アドレスについて上記検索をさせる検索開始位置変更手段と、を備える計算機とすると良い。
【0013】
本発明の計算機では、重複出力防止手段として、ポインタと検索開始位置変更手段を有している。具体的には、各追加アドレスについて、プログラムカウンタが示す特定命令アドレスと一致するものを検索し、最初に一致する追加アドレスを指示するポインタを備える。さらに、このポインタが特定命令アドレスに一致する追加アドレスを指示していないときには、次回に所定の検索順序の先頭から追加アドレスについて一致検索をする。一方、このポインタが特定命令アドレスに一致する追加アドレスを指示しているときには、このポインタが現在示している追加アドレスから見て次以降の検索順序の追加アドレスについて一致検索をする検索開始位置変更手段を有している。従って、既に出力されたことのある追加命令データが、2回以上重複して出力されることがない。
なお、追加命令データをプログラムのループ部分内に追加したい場合がある。この場合、このループ部分が実行される度に、追加命令データを追加する必要がある。これに対し、本発明の計算機では、ポインタが特定命令アドレスに一致する追加アドレスを指示していないときには、次回に所定の順序の先頭から追加アドレスについて一致検索をするため、ループ部分が実行される度に、繰り返し追加命令データを適切に追加することができる。
【0014】
あるいは、請求項2に記載の計算機であって、前記重複出力防止手段は、記憶されている複数の前記データ−アドレス対とそれぞれ1対1に関連づけられた出力済記憶部と、前記命令レジスタに上記データ−アドレス対に属する前記追加命令データが出力されたときに、対応する上記出力済記憶部に出力済を示す出力済データを記録する出力済記録手段と、上記出力済済データが記録されている上記出力済記憶部に関連づけられた上記データ−アドレス対に属する上記追加命令データの上記命令レジスタへの出力を禁止する出力禁止手段と、を含む計算機とするのが好ましい。
【0015】
この計算機では、各データ−アドレス対と関連づけられた出力済記憶部を備え、この出力済記録手段では、データ−アドレス対に属する追加命令データが出力されたときにこれを出力済データとして記録する。出力禁止手段は、出力済データが記録されている出力済記憶部に関連づけられたデータ−アドレス対に属する追加命令データを命令レジスタへ出力するのを禁止する。このため、既に出力されたことのある追加命令データが、2回以上重複して出力されることがない。
なお、出力済記憶部としては、出力済データが記憶できるものであればよいが、例えば、各データ−アドレス対と関連づけられたフラグビットが挙げられる。フラグビットを用いると、最小の出力済記憶部とすることができ、出力済記憶部を形成したことによるチップ面積の増加などの影響を最小限に抑えることができるので特に好ましい。
【0016】
さらに、上記いずれか1項に記載の計算機であって、前記第1比較手段は、前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された前記追加アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの次回の更新を停止させる計算機とすると良い。
【0017】
本発明の計算機では、特定命令アドレスと追加アドレスとが一致したとき、プログラムカウンタにおける特定命令アドレスの次回の更新を停止させる。従って、追加命令データを1つ追加する場合には、1回だけ更新が停止される。一方、追加命令データを連続して2つ以上(例えば3つ)追加する場合には、連続して追加する追加命令データとデータ−アドレス対を成す複数(例えば3つ)の追加アドレスがいずれも同じ値になっているから、特定命令アドレスと追加アドレスとが、追加する追加命令データの数と同じ回数(例えば3回)連続して一致することとなる。ここで、各回毎に次回の更新が停止されるので、結局連続して追加する追加命令データの数と同じ回数(例えば3回)だけPCが停止されることになる。
そしてその後は、更新が再開される。更新の再開後には、更新された特定命令アドレスと追加アドレスとが不一致となり、再び特定命令アドレスで特定される特定命令データが命令レジスタに出力されてCPUでの処理が実行される。かくして、1または複数の追加命令データを追加してCPUに実行させた後、無条件ジャンプなどを介在させずに、直ちに本来のプログラム(命令データ列)の実行に戻ることができるので、命令追加に伴う処理時間の無駄が生じない。
【0018】
さらに、上記のいずれか1項に記載の計算機であって、前記追加命令記憶手段は、1または複数の追加用レジスタである計算機とすると良い。
【0019】
一般に、データ等を記憶する記憶手段としてRAMやPROMなどを用いる場合には、記憶できる容量を大きくしやすいが、RAM等を制御するに当たって、アドレス線を形成する必要があり、また、制御のため多くの回路が必要となる。従って、命令追加の機能を付加するために増加するチップ面積も大きくなりがちである。一方、レジスタは、簡易な回路構成で構成できるが、多数のレジスタを形成するのは困難である。
ところで、ROMなどのメモリに記憶された命令データ列からなるプログラムを修正する場合には、僅かな追加命令データの追加(例えば数ワード分)で済むことが多く、このためにRAM等を用いると多くの記憶領域が無駄になりやすい。
これに対し、本発明の計算機では、追加命令記憶手段として追加用レジスタを備える。このため、簡易な回路で構成できる追加用レジスタを適数個構成しておけば良く、RAM等を用いる場合のようにアドレス線を形成する必要もなく、簡易な制御で済む。僅かな数の追加命令データの追加であれば、このような追加用レジスタを設けることで足りることが多い。また、このような機能を付加するために増加するチップ面積も小さくて済ませられる。
【0020】
さらに、上記計算機であって、前記メモリに記憶された前記命令データ列のデータ量と、前記追加用レジスタに記憶された前記追加命令データのデータ量と、の和が、上記メモリの記憶容量よりも大きい計算機とすると良い。
【0021】
マイクロコンピュータなどの計算機を製作する場合に、記憶させたいプログラムが計算機に形成するROM等のメモリの記憶容量をやむを得ず越えてしまう場合がある。例えば、256ワードの記憶容量を持つROMを用いることを予定してプログラミングを行ったが、やむを得ずプログラムが260ワードのデータ量となってしまう場合がある。このような場合、通常は、ROMの記憶容量を384ワードや512ワードに増やすことになる。しかし、新たなアドレス線の追加などが必要になる上、数ワード程度(上記では4ワード)の命令データの記憶のために、128ワードや256ワードなど大きな記憶容量を持つメモリを追加形成することとなり無駄が多い。
これに対し、本発明の計算機では、メモリの記憶容量を超える分のプログラムもメモリと追加用レジスタとで記憶し実行することができるので、アドレス線の追加も不要であり、メモリの無駄もない。
【0022】
さらに、上記いずれか1項に記載の計算機であって、外部から書き込み可能で、前記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、前記プログラムカウンタの示す前記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較する第2比較手段と、を備え、上記第2比較手段は、上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新させる計算機とするのが好ましい。
【0023】
この計算機では、プログラムを成す命令データ列に追加命令データを追加することも、命令データ列から命令データを削除することもできる。従って、追加と削除を組み合わせれば、命令データの変更も可能となる。
【0024】
さらに、上記いずれか1項に記載の計算機を、1つの集積回路チップに実現してなる集積回路装置とすると良い。
【0025】
本発明の集積回路装置では、1チップに上述の計算機を実現してなるので、さらに安価にすることができる。
【0026】
他の解決手段は、命令データ列が記憶されたメモリと、命令レジスタ、及び、上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有するCPUと、外部から書き込み可能で、上記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、上記プログラムカウンタの示す上記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較する第2比較手段と、を備え、上記第2比較手段は、上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新させる計算機である。
【0027】
CPUが有するプログラムカウンタは、クロック信号の1周期毎に、特定命令アドレスの値を更新して、次に読み込む特定命令データが記憶されている特定命令アドレスを示す。
これに対し、本発明の計算機では、第2比較手段において、プログラムカウンタの示す特定命令アドレスと削除アドレスとが一致したとき、特定命令アドレスの値を2回分更新する。つまり更新を2回行ったのと同じだけ特定命令アドレスの値を変化させる。例えば、現在、プログラムカウンタで指示している特定命令アドレスの値が3である場合、通常、次にプログラムカウンタで示す特定命令アドレスの値は+1されて4に更新されるはずである。しかるに、記憶されていた削除アドレスが3であるために、現在の特定命令アドレス=3と一致した場合には、第2比較手段はプログラムカウンタの特定命令アドレスを、+1を2回分つまり+2して5(=3+2)に更新する。従って、次にメモリから命令レジスタに出力されるのは、特定命令アドレス=5で特定される記憶領域に記憶されていた特定命令データとなる。つまり、特定命令アドレス=4で特定される記憶領域に記憶されていた特定命令データが命令レジスタに出力されることなくプログラムをなす命令データ列の実行が進行することになる。かくして、プログラムをなす命令データ列から実質的に削除アドレスで特定される命令データを削除できる。
【0028】
さらに、上記計算機であって、前記削除位置記憶手段は、削除用レジスタである計算機とするのが好ましい。
一般に、データ等を記憶する記憶手段としてRAMやPROMなどを用いる場合には、記憶できる容量を大きくしやすいが、RAM等を制御するに当たって、アドレス線を形成する必要があり、また、制御のため多くの回路が必要となる。従って、このような機能を付加するために増加するチップ面積も大きくなりがちである。一方、レジスタは、簡易な回路構成で構成できるが、多数のレジスタを形成するのは困難である。
ところで、ROM等のメモリに記憶された命令データ列からなるプログラムを修正する場合には、僅かな数の命令データ(例えば数ワード分)を削除出来れば済むことが多く、このためにRAM等を用いると多くの記憶領域が無駄になりやすい。
これに対し、本発明の計算機では、削除位置記憶手段として削除用レジスタを備える。このため、簡易な回路で構成できる削除用レジスタを適数個構成しておけば良く、RAM等を用いる場合のようにアドレス線を形成する必要もなく、簡易な制御で済む。僅かな数の命令データの削除であれば、このような削除用レジスタを設けることで足りることが多い。また、このような機能を付加するために増加するチップ面積も小さくて済ませられる。
【0029】
さらに上記計算機を、1つの集積回路チップに実現してなる集積回路装置とするのが好ましい。
この集積回路装置では、1チップに上述の計算機を実現してなるので、さらに安価にすることができる。
【0030】
さらに他の解決手段は、命令データ列が記憶されたメモリと、命令レジスタ、及び、上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有するCPUと、外部から書き込み可能で、上記命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ−アドレス対を少なくとも1対以上記憶可能に構成されてなる追加命令記憶手段と、を備える計算機における命令実行方法であって、上記プログラムカウンタの示す上記特定命令アドレスと上記追加命令記憶手段に記憶された上記追加アドレスとを比較し、上記特定命令アドレスと上記追加アドレスとが不一致であるとき、上記特定命令データを上記命令レジスタに出力して、上記特定命令データを上記CPUで実行し、上記特定命令アドレスと上記追加アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの更新を停止し、上記特定命令データと、上記追加命令記憶手段に記憶された追加命令データであって、上記特定命令アドレスに一致する追加アドレスと上記データ−アドレス対をなす追加命令データと、のいずれか一方を先に上記命令レジスタに出力し、他方をその後に出力して、上記追加命令データ及び上記特定命令データを上記CPUで実行する計算機における命令実行方法である。
【0031】
本発明の計算機における命令実行方法では、メモリに記憶された命令データ列(プログラム)の所望位置に追加命令データを追加するに当たり、プログラムカウンタの示す追加命令アドレスと追加する位置を示す追加アドレスとが一致した場合に、プログラムカウンタにおける特定命令アドレスの更新を停止させる。これと共に、メモリに記憶され特定命令アドレスで特定される特定命令データと前後して、一致した追加アドレスとデータ−アドレス対を成して追加命令記憶手段に記憶されている追加命令データを命令レジスタに出力する。従って、CPUで実行しているプログラムを中断することなく、命令データ列の中に追加命令データを追加して実行させることができる。このため、プログラムの中断に伴うデッドサイクルが生じない。
【0032】
さらに、上記計算機における命令実行方法であって、前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された追加アドレスとが一致したとき、上記特定命令アドレスに一致する追加アドレスと前記データ−アドレス対をなす前記追加命令データを、前記命令レジスタに重複なく出力する計算機における命令実行方法とするのが好ましい。
【0033】
前述の計算機における命令実行方法では、プログラムカウンタの示す特定命令アドレスと追加アドレスとが一致すると、プログラムカウンタでの特定命令アドレスの更新が停止されるため、特定命令アドレスが変化しない。すると、次のサイクルでも再び、特定命令アドレスと追加アドレスとが一致することとなる。このため、同じ追加命令データが無限回追加されることとなり、適切にプログラムの実行ができないおそれがある。
そこで、本発明の計算機における命令実行方法では、特定命令アドレスと追加アドレスとが一致したとき、一致する追加アドレスとデータ−アドレス対をなす追加命令データを、命令レジスタに重複なく出力する。これにより、適切に追加命令データを追加したプログラムを実行することができるようになる。
しかも、プログラム(命令データ列)の同じ位置に連続して複数の追加命令データを追加したいために、同じ追加アドレスを有するデータ−アドレス対が複数記憶されている場合でも、同じ追加アドレスを有する複数のデータ−アドレス対に属する追加命令データを、命令レジスタに重複なく出力することで、複数の追加命令データを順次に命令レジスタに出力することができる。
このため、1つの追加命令データを追加する場合でも、あるいは複数の追加命令データを連続して追加する場合でも、適切に命令データを追加したプログラムを実行することができる。
【0034】
さらに上記計算機における命令実行方法であって、前記計算機は、前記追加命令記憶手段から読み出すべき追加命令データと前記データ−アドレス対をなす追加アドレスを指示するポインタであって、上記追加命令記憶手段に記憶されている複数の前記追加アドレスを所定の検索順序で検索して、前記プログラムカウンタが示す前記特定命令アドレスに一致する追加アドレスのうち、最初に検索された追加アドレスを指示するポインタを備え、上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示していなかったときには、次回に上記所定の検索順序の先頭から順に上記追加アドレスについて上記検索をし、上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示しているときには、次回に上記所定の検索順序のうちポインタが現在指示している追加アドレスから見て次以降の検索順序の追加アドレスについて上記検索をする計算機における命令実行方法とするのが好ましい。
【0035】
この計算機における命令実行方法では、ポインタを用い、このポインタの検出結果によって検索の開始位置を変更している。具体的には、各追加アドレスについて、プログラムカウンタが示す特定命令アドレスと一致するものを検索し、最初に一致する追加アドレスを指示するポインタを備える。さらに、このポインタが一致する追加アドレスを指示していないときには、次回に所定の検索順序の先頭から追加アドレスについて一致検索をする。一方、このポインタが一致する追加アドレスを指示しているときには、このポインタが現在指示している追加アドレスから見て次以降の検索順序の追加アドレスについて一致検索をする。従って、既に出力されたことのある追加命令データが、2回以上重複して出力されることがない。
なお、追加命令データをプログラムのループ内に追加したい場合がある。この場合、このループ部分が実行される度に、追加命令データを追加する必要がある。これに対し、この計算機の命令実行方法では、ポインタが一致する追加アドレスを指示していないときには、次回に所定の検索順序の先頭から追加アドレスについて一致検索をするため、ループ部分が実行される度に、繰り返し追加命令データを適切に追加することができる。
【0036】
あるいは、前記計算機における命令実行方法であって、前記計算機は、記憶されている複数の前記データ−アドレス対とそれぞれ1対1に関連づけられた出力済記憶部を備え、前記命令レジスタに上記データ−アドレス対に属する前記追加命令データを出力したときに、対応する上記出力済記憶部に出力済を示す出力済データを記録し、その後、上記出力済データが記録されている上記出力済記憶部に関連づけられた上記データ−アドレス対に属する上記追加命令データの上記命令レジスタへの出力を禁止する計算機における命令実行方法とするのが好ましい。
【0037】
この計算機における命令実行方法では、計算機は各データ−アドレス対と関連づけられた出力済記憶部を備える。そして、データ−アドレス対に属する追加命令データが出力されたときにこれを出力済データとして記録し、出力済データが記録されている出力済記憶部に関連づけられたデータ−アドレス対に属する追加命令データの命令レジスタへの出力を禁止する。このため、既に出力されたことのある追加命令データが、2回以上重複して出力されることがない。
なお、出力済記憶部としては、出力済データが記憶できるものであればよいが、例えば、各データ−アドレス対と関連づけられたフラグビットが挙げられる。フラグビットを用いると、最小の出力済記憶部とすることができ、出力済記憶部を形成したことによるチップ面積の増加などの影響を最小限に抑えることができるので特に好ましい。
【0038】
さらに、上記いずれか1項に記載の計算機における命令実行方法であって、前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された前記追加アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの次回の更新を停止させる計算機における命令実行方法とするのが好ましい。
【0039】
この計算機における命令実行方法では、特定命令アドレスと追加アドレスとが一致したとき、プログラムカウンタにおける特定命令アドレスの次回の更新を停止させる。従って、追加命令データを1つ追加する場合には、1回だけ更新が停止される。一方、追加命令データを連続して2つ以上(例えば3つ)追加する場合には、特定命令アドレスと追加アドレスとが、一致するたびに次回の更新が停止されるので、結局連続して追加する追加命令データの数と同じ回数(例えば3回)だけPCが停止されることになる。
そしてその後は、更新が再開される。更新の再開後には、更新された特定命令アドレスと追加アドレスとが不一致となり、再びメモリに記憶され特定命令アドレスで特定される特定命令データ列が命令レジスタに出力されてCPUでの処理が実行される。かくして、1または複数の追加命令データを追加してCPUに実行させた後、無条件ジャンプなどを介在させずに、直ちに本来のプログラム(命令データ列)の実行に戻ることができるので、命令追加に伴う処理時間の無駄が生じない。
【0040】
さらに上記いずれか1項に記載の計算機における命令実行方法であって、前記追加命令記憶手段は、1または複数の追加用レジスタである
計算機における命令実行方法とするのが好ましい。
【0041】
ROM等のメモリに記憶された命令データ列からなるプログラムを修正する場合には、僅かな追加命令データの追加(例えば数ワード分)で済むことが多く、RAM等を用いると多くのメモリが無駄になりやすい。
これに対し、この計算機における命令実行方法では、追加命令記憶手段として追加用レジスタを備える。このため、簡易な回路で構成できる追加用レジスタを適数個構成しておけば良く、RAM等を用いる場合に比して簡易な制御で済む。僅かな数の追加命令データの追加であれば、このような追加用レジスタを設けることで足りることが多い。また、このような機能を付加するために増加するチップ面積も小さくて済ませられる。
【0042】
さらに上記計算機における命令実行方法であって、前記メモリに記憶された前記命令データ列のデータ量と、前記追加用レジスタに記憶された前記追加命令データのデータ量と、の和が、上記メモリの記憶容量よりも大きい計算機における命令実行方法とするのが好ましい。
マイクロコンピュータなどの計算機を製作する場合に、記憶させたいプログラムが計算機に形成するROM等のメモリの記憶容量をやむを得ず越えてしまう場合がある。このような場合、メモリの記憶容量を増やすと新たなアドレス線の追加などが必要になる上、数ワード程度の命令データの記憶のために、大きな記憶容量を持つメモリを形成することとなり無駄が多い。
これに対し、この計算機における命令実行方法では、メモリの記憶容量を超える分のプログラムもメモリと追加用レジスタとで記憶し実行することができるので、アドレス線の追加も不要であり、メモリの無駄もない。
【0043】
さらに上記いずれか1項に記載の計算機における命令実行方法であって、前記計算機は、外部から書き込み可能で、前記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段を備え、前記プログラムカウンタの示す前記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較し、上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新し、その後、上記プログラムカウンタの示す更新された特定命令アドレスに従って、前記メモリから前記特定命令データを前記命令レジスタに出力し、前記CPUで実行するを備える計算機における命令実行方法とするのが好ましい。
この計算機における命令実行方法では、プログラムを成す命令データ列に追加命令データを追加することも、命令データ列から命令データを削除することもできる。従って、追加と削除を組み合わせれば、命令データの変更も可能である。
【0044】
さらに他の解決手段は、命令データ列が記憶されたメモリと、命令レジスタ、及び、上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有するCPUと、外部から書き込み可能で、上記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、を備える計算機における命令実行方法であって、上記プログラムカウンタの示す上記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較し、上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新し、その後、上記プログラムカウンタの示す更新された特定命令アドレスに従って、上記メモリから上記特定命令データを上記命令レジスタに出力し、上記CPUで実行する計算機における命令実行方法である。
【0045】
CPUが有するプログラムカウンタは、クロック信号の1周期毎に、命令アドレスの値を更新して、次に読み込む命令データが記憶されている命令アドレスを示す。
これに対し、本発明の計算機における命令実行方法では、プログラムカウンタの示す特定命令アドレスと削除アドレスとが一致したとき、特定命令アドレスの値を2回分更新する。つまり更新を2回行ったのと同じだけ特定命令アドレスの値を変化させる。従って、次に出力されることが予定されていた特定命令データが出力されず、次々回に出力される予定の命令データが、1回分早い次回に命令レジスタに出力されて、プログラムをなす命令データ列の実行が進行することになる。かくして、プログラムをなす命令データ列から実質的に削除アドレスで特定される命令データを削除できる。
【0046】
さらに、上記計算機における命令実行方法であって、前記削除位置記憶手段は、削除用レジスタである計算機における命令実行方法とするのが好ましい。
ROM等のメモリに記憶された命令データ列からなるプログラムを修正する場合には、僅かな数の命令データ(例えば数ワード分)を削除出来れば済むことが多く、RAM等を用いると多くの記憶領域が無駄になりやすい。
これに対し、この計算機における命令実行方法では、削除位置記憶手段として削除用レジスタを備える。このため、簡易な回路で構成できる削除用レジスタを適数個構成しておけば良く、RAM等を用いる場合のようにアドレス線を形成する必要もなく、簡易な制御で済む。僅かな数の命令データの削除であれば、このような削除用レジスタを設けることで足りることが多い。また、このような機能を付加するために増加するチップ面積も小さくて済ませられる。
【0047】
【発明の実施の形態】
(実施形態)
本発明の実施の形態を図1〜図6を参照して説明する。本実施形態にかかるマイクロコンピュータ100は、図1に示すように、シリコンからなる1つの半導体基板上にCPU,ROM等の各機能を実現した、いわゆる1チップ型のマイクロコンピュータである。前述した従来のマイクロコンピュータと同様に、このマイクロコンピュータ100は、インストラクションレジスタ(以下、単にIRともいう)111及びプログラムカウンタ(以下、単にPCともいう)112を含むCPU110とマスクROM120とを有している(図2参照)。このマスクROM120は256ワードの記憶容量を持ち、各命令アドレス(図2では、0,1,2,3,…)で特定される領域にそれぞれ命令データ(図2では、AAAA,BBBB,CCCC,DDDD,…)が記憶されている。プログラムを成すこれら命令データの列うち、PC112が示す特定命令アドレスSIAで特定される特定命令データSIDをIR111に読み込みCPU110で実行することで所定の結果を得るようにされている。なお、PC112は、分岐命令などを実行しない場合には、クロック信号の1周期毎に、通常、特定命令アドレスSIAの値を1つインクリメントする。従って、通常、クロック信号の1周期毎に、特定命令アドレスSIAが1ずつカウントアップされる。
【0048】
さらにこのマイクロコンピュータ100には、マスクROM120に記憶されている命令データ列(プログラム)に命令データを追加したい場合に用いる命令追加レジスタ130、追加アドレス比較回路140、及び命令セレクタ150を備える。命令追加レジスタ130は、実際には、16ヶの命令追加レジスタ131,132,133…からなる。各命令追加レジスタ131等は、いずれも、外部からの書込処理により、命令データを追加する位置を指定する追加アドレス(例えば「3」など)を記憶するための追加アドレス記憶部131A,132A…と、追加すべき命令データである追加データ(たとえば「XXXX」など)を記憶するための追加データ記憶部131D,132D,…とを有しており、追加アドレスと追加データとを対(データ−アドレス対)を成すようにして記憶可能になっている。
さらに、命令セレクタ150は、マスクROM120及び命令追加レジスタ130とCPU110のIR111との間に介在する。この命令セレクタ150には、PC112が示す特定命令アドレスSIAで特定される特定命令データSIDと、後述するようにして選択した命令追加レジスタ131等の追加データ記憶部131D等に記憶されている追加データ131D等とが入力される。
【0049】
一方、追加アドレス比較回路140は、PC112の示す特定命令アドレスSIAと、追加データ記憶部131D等に記憶され、後述するようにして選択した追加アドレスとを比較する。
ここで、特定命令アドレスSIAと追加アドレス記憶部131A等に記憶した追加アドレスとが一致した場合には、出力するPC更新停止信号をクロック信号の1周期分だけハイレベルとすることで、このハイレベルとした期間だけ、従って、1回だけPC112における特定命令アドレスSIAの更新を停止させる。このため、PC112で示す特定命令アドレスSIAの値が1回分だけ変化しないことになる。さらにこの場合に、PC更新停止信号より1周期分遅れて追加データセレクト信号を1周期分だけハイレベルにすることにより、この回だけ、命令セレクタ150は、入力されている追加データ131D等をIR111に出力する。
【0050】
さらにこのマイクロコンピュータ100には、マスクROM120に記憶されている命令データ列(プログラム)のうち一部の命令データを削除したい場合に用いる命令削除レジスタ160と削除アドレス比較回路170を備える。命令削除レジスタ160は、実際には、8ヶの削除追加レジスタ161,162,163…からなる。各命令削除レジスタ161等は、いずれも、外部からの書込処理により、命令データを削除する位置を指定する削除アドレス161A,162A…を記憶可能になっている。また、削除アドレス比較回路170は、PC112の示す特定命令アドレスSIAと、削除レジスタ161等に記憶されている削除アドレスとを比較する。
ここで、特定命令アドレスSIAと削除アドレス161等に記憶されている削除アドレスとが一致した場合には、出力する削除信号をクロック信号の1周期分だけハイレベルとすることで、このハイレベルとした期間だけ、従って、1回だけPC112における特定命令アドレスSIAを+2する。つまり更新を2回行った分だけ特定命令アドレスSIAの値を変化させる。
【0051】
次いで、このマイクロコンピュータ100を用いて、命令データを追加する場合について説明する。まず、1つの追加データ「XXXX」を、ROM120に記憶した命令データ列のうち、3番目の「CCCC」と4番目の「DDDD」との間に追加して実行する場合について、図3を参照して説明する。
命令追加レジスタ131のうち、追加アドレス記憶部131Aには追加アドレスとして「3」が、追加データ記憶部131Dには追加データとして「XXXX」が記憶されているとする。
まず、後述するPC更新停止信号がローレベルにされているので、クロック信号の立ち上がりタイミングに従って、PC112が示す特定命令アドレスSIAの値はインクリメントされ、その値が「0」,「1」,「2」というように順に変化する。すると、これに従って、マスクROM120からは、クロック信号で1周期分遅れて特定命令データSIAで特定される特定命令データSIDが、「AAAA」,「BBBB」,「CCCC」というように順に出力され、命令セレクタ150に入力される。
特定命令アドレスSIAが、「0」,「1」,「2」というように、「3」でない場合には、追加データセレクト信号もローレベルにされるので、命令セレクタ150からは、特定命令データSIAが選択され、そのまま出力される。すると、次の周期(クロック信号の次の立ち上がりタイミング)に、IR111に読み込まれ、その後CPU110で実行される。
【0052】
しかし、PC112の示す特定命令アドレスSIAが「3」(SIA=3)となったとき(図3において第4クロック目)には、追加アドレス比較回路140に入力された特定命令アドレスSIAと命令追加レジスタ131の追加アドレス記憶部131Aに記憶された追加アドレスとが一致する。すると、追加アドレス比較回路140は、PC更新停止信号をクロック信号の1周期分だけハイレベルにする。これにより、PC112におけるインクリメントが停止され、次の周期(図3において第5クロック目)における特定命令アドレスSIAは「3」のままとなる。このため、ROM120から読み出される特定命令データSIDは、2回続けて「DDDD」となる。
なお、PC更新停止信号がローレベルに戻ると、PC112での更新が再開され、特定命令アドレスSIAが、「4」,「5」,「6」というように変化する。
【0053】
また、追加アドレス比較回路140は、PC更新停止信号より1周期遅れて、追加データセレクト信号を1周期分だけハイレベルにする。これにより、命令セレクタ150は、この期間だけ追加データ記憶部131Aに記憶されている内容「XXXX」を選択して出力する。従って、図3に示すように、命令セレクタ出力の内容について見ると、「CCCC」の後に「XXXX」が続くことになる。次いで、クロック信号の次の立ち上がりタイミング(図3において第6クロック目)にIR111に読み込まれて、以降CPU110で実行される。
さらに、追加データセレクト信号がローレベルに戻ると、命令セレクタ150は、特定命令アドレスSIA=3で特定される特定命令データSIDの内容「DDDD」を選択して出力する。従って、図3に示すように、命令セレクタ出力の内容について見ると、「XXXX」の後に「DDDD」が続くことになる。次いで、クロック信号の次の立ち上がりタイミング(図3において第7クロック目)にIR111に読み込まれて、以降CPU110で実行される。
かくして、ROM120に記憶した命令データ列のうち、3番目の「CCCC」と4番目の「DDDD」との間に「XXXX」を追加し、実行することができたことになる。
【0054】
次いで、2つの追加データ「XXXX」と「YYYY」とを、ROM120に記憶した命令データ列のうち、3番目の「CCCC」と4番目の「DDDD」との間に連続して追加して実行する場合について、図4を参照して説明する。
命令追加レジスタ131のうち、追加アドレス記憶部131Aには追加アドレスとして「3」が、追加データ記憶部131Dには追加データとして「XXXX」が記憶されているとする。また、命令追加レジスタ132のうち、追加アドレス記憶部132Aには追加アドレスとして「3」が、追加データ記憶部131Dには追加データとして「YYYY」が記憶されているとする。
当初、PC更新停止信号がローレベルにされているので、クロック信号の立ち上がりタイミングに従って、PC112が示す特定命令アドレスSIAの値はインクリメントされ、「0」,「1」,「2」というように順に変化する。すると、これに従って、マスクROM120からは1周期遅れて特定命令データSIDが、「AAAA」,「BBBB」,「CCCC」というように順に出力され、命令セレクタ150に入力される。
特定命令アドレスSIAが、「3」でない場合には、追加データセレクト信号もローレベルにされるので、命令セレクタ150からは、特定命令データSIAが選択され、そのまま出力される。すると、次の周期にIR111に読み込まれ、その後CPU110で実行される。
【0055】
しかし、PC112の示す特定命令アドレスSIAが「3」(SIA=3)となったとき(図4において第4クロック目)には、特定命令アドレスSIAと追加アドレス記憶部131Aに記憶された追加アドレスとが一致する。そこで、追加アドレス比較回路140は、PC更新停止信号をクロック信号の1周期分だけハイレベルにする。すると、PC112におけるインクリメントが停止され、次の周期(図4において第5クロック目)における特定命令アドレスSIAは「3」のままとなる。すると、図4において第5クロック目には、特定命令アドレスSIAと追加アドレス記憶部132Aに記憶された追加アドレスとが一致する。このため、追加アドレス比較回路140は、PC更新停止信号をさらに1周期分だけハイレベルにする。かくして、ROM120から読み出される特定命令データSIDは、3回続けて「DDDD」となる。
なお、その後にPC更新停止信号がローレベルに戻ると、PC112での更新が再開され、特定命令アドレスSIAが、「4」,「5」,「6」というように変化する。
【0056】
また、追加アドレス比較回路140は、PC更新停止信号より1周期遅れて、追加データセレクト信号をハイレベルにする。これにより、命令セレクタ150は、この期間だけ追加データ記憶部131Dに記憶された追加データの内容「XXXX」を選択して出力する。従って、図4に示すように、命令セレクタ出力の内容について見ると、「CCCC」の後に「XXXX」が続くことになる。次いで、クロック信号の次の立ち上がりタイミング(図4において第6クロック目)にIR111に読み込まれて、以降CPU110で実行される。
さらに、上述したように、特定命令アドレスSIAが追加アドレス記憶部131Aに記憶された追加データと一致し、続いて追加アドレス記憶部132Aに記憶された追加データと一致することにより、2回連続して一致した。このため、追加アドレス比較回路140は2周期分続けて追加データセレクト信号をハイレベルにする。これにより、命令セレクタ150は、さらに追加データ記憶部132Dに記憶された追加データの内容「YYYY」を選択して出力する。従って、図4に示すように、命令セレクタ出力の内容について見ると、「CCCC」の後に「XXXX」が、さらに「YYYY」が続くことになる。次いで、クロック信号の次の立ち上がりタイミング(図4において第7クロック目)にIR111に読み込まれて、以降CPU110で実行される。
【0057】
さらに、追加データセレクト信号がローレベルに戻ると、命令セレクタ150は、特定命令アドレスSIA=3で特定される特定命令データSIDの内容「DDDD」を選択して出力する。従って、図4に示すように、命令セレクタ出力の内容について見ると、「YYYY」の後に「DDDD」が続くことになる。次いで、クロック信号の次の立ち上がりタイミング(図4において第8クロック目)にIR111に読み込まれて、以降CPU110で実行される。
かくして、ROM120に記憶した命令データ列のうち、3番目の「CCCC」と4番目の「DDDD」との間に、「XXXX」、「YYYY」を連続して追加し、実行することができたことになる。
【0058】
なお、上述した本実施形態における追加データの追加においては、特定命令アドレスSIAと追加アドレス131A等に記憶した追加アドレスとが一致すると、追加アドレス比較回路140からPC更新停止信号を出力し、PC112における特定命令アドレスSIAの更新を停止した。このため、例えば、図4に示す例では、図4において第4クロック目のみならず、第5,第6クロック目でも、特定命令アドレスSIA=3となる。そこで、もし、第4クロック目に既に特定命令アドレスSIAと一致したと判断した追加アドレス記憶部131Aの内容が、第5クロック目でも重複して追加アドレス比較回路140に入力されれば、追加データ記憶部131Dの内容である「XXXX」が重複して追加される虞がある。
【0059】
そこで、本実施形態では、下記するようにして、特定命令アドレスSIAに一致する追加アドレスとデータ−アドレス対を成すすべての追加データが、命令セレクタ150を通じてIR111に重複なく出力されるようにする。具体的には、ポインタ190及び追加アドレス選択手段180を用いて(図5参照)、PC112の更新の停止及び再開を指示すると共に、追加アドレス記憶部131A等に記憶された追加アドレスのうち、特定命令アドレスSIAに一致する追加アドレスが記憶されている追加アドレス記憶部131A等を順次指定する。そして、指定された追加データ記憶部131D等に記憶されている追加データが、命令セレクタ150を通じてIR111に重複なく出力されるようにする。なお、追加アドレス選択手段180のうちのポインタ制御手段188及びポインタ190によって、重複出力防止手段が構成されている。また、回路181及び回路186により、追加アドレス比較回路140におけるPC更新停止信号の動作が実現されている。
【0060】
まず、本例においては、図5(a)に示すように、命令追加レジスタ130のうち、各命令追加レジスタ131,132…の追加アドレス記憶部131A,132A等及び追加データ記憶部131D,132D等に追加アドレス及び追加データを記憶させてあるとする。そのうち、命令追加レジスタ131,132の追加アドレス記憶部131A,132Aには、共通した「3」の値が記憶されているとする。また、命令追加レジスタ131,132…等には、固有の番号が付されており、その番号が小さいほど、検索順位の高い(高位)の命令追加レジスタあるとする。本例では、命令追加レジスタ131には0が、命令追加レジスタ132には1が、命令追加レジスタ133には2…という固有番号が付されているとする。
【0061】
そして、ポインタPは、複数の命令追加レジスタ131等(追加データ記憶部131D等)から読み出すべき追加データとデータ−アドレス対をなす追加アドレスを指示する変数である。具体的には、ポインタPは、各追加アドレス記憶部131D等に記憶されている複数の追加アドレスを、検索順位の高い命令追加レジスタに記憶されている追加アドレスから順に、つまり、図5(a)に矢印で示すように、命令追加レジスタの固有番号について昇順で検索する。そして、PC112が示す特定命令アドレスSIAに一致する追加アドレスが存在した場合には、ポインタPは、そのうち最初に検索された追加アドレスが記憶されている命令追加レジスタ(追加アドレス記憶部)を、例えばポインタP=3というようにして、その固有番号で指示する。
【0062】
また、追加アドレス選択手段180(図5(b)参照)における各回路181〜187は、スタートからエンドまでをクロック信号の1周期以内に終了するように構成された論理回路からなる。なお、マイクロコンピュータ100に電源が投入され、動作を開始したときのポインタPの初期値は、P=0とする。
クロック信号が立ち上がると、回路181でPC112の更新(更新再開)を指示する。具体的には、PC更新停止信号をローレベルにする。
回路182では、ポインタPの示す値(固有番号)で指示される命令追加レジスタ131等の追加アドレス記憶部131A等に記憶された追加アドレスが、特定命令アドレスSIAと一致しているか否かを判断する。
【0063】
ここでNo、即ち、ポインタPで指定された追加アドレス記憶部131A等に記憶された追加アドレスと特定命令アドレスSIAとが不一致のときには、回路183で、ポインタPの値を1つインクリメントする。つまり、ポインタPで指示する命令追加レジスタ131等を検索順序で見て次の命令追加レジスタに切り換える。
さらに、回路184では、ポインタPが上限値つまりこれ以上インクリメントできない値となったか否かを判断し、Noつまり、まだインクリメントできる場合には、回路182の判断に戻す。一方、Yesつまり、ポインタPが上限値であるときには、回路185において、ポインタP=0として処理を終了する。この場合には、次の周期において、検索順位が先頭の命令追加レジスタ131から検索を行うことになる。
【0064】
一方、回路182において、Yes、即ち、ポインタPで指定された追加アドレス記憶部131A等に記憶された追加アドレスと特定命令アドレスSIAとが一致するときには、回路186でPC112での更新の停止を指示する。具体的には、PC更新停止信号をハイレベルにする。なお、回路181で予めPC更新停止信号をローレベルとしているが、先に説明したように、各回路181〜187は、スタートからエンドまでをクロック信号の1周期以内に終了するように構成されているため、次の周期におけるPC112の更新停止には何等影響しない。
さらに、回路187では、ポインタP=P+1、つまり1つ分インクリメントして処理を終了する。この場合、次の周期には、現在ポインタPが指示する命令追加レジスタから見て次の検索順位の命令追加レジスタから検索を行うことになる。
【0065】
命令追加レジスタ131等の内容を用いながら、具体的に説明する。ポインタPは初期値P=0となっているとする。回路181でPC更新停止信号をローレベルとする。P=0であるので、回路182では命令追加レジスタ131の追加アドレス記憶部131Aに記憶されている追加アドレス「3」を、現在の特定命令アドレスSIA(=0)と比較する。両者が一致しないので、回路183に進み、ポインタPをインクリメントしてP=1とする。次いで回路184でポインタPが上限値(例えば15)でないと判断されると、回路182に戻る。
回路182では、P=1であるので、命令追加レジスタ132の追加アドレス記憶部132Aに記憶されている追加アドレス「3」を、現在の特定命令アドレスSIA(=0)と比較する。ここでも両者が一致しないので、回路183に進み、ポインタPをインクリメントする。このようにして、回路184でポインタPが上限値であると判断されるまで、回路182,183,184の処理を繰り返す。そしてついにポインタP=15(上限値)になると、回路185に進み、ポインタPはP=0に戻されて終了する。かくして、この周期には、PC更新停止信号をローレベルにされたままとなり、次回には、特定命令アドレスSIAの値が更新される。
【0066】
次の周期には、PC112に示す特定命令アドレスSIAが更新されてSIA=1となる。この状態で再び追加アドレス選択手段180での処理が開始される。まず、回路181でPC更新停止信号をローレベルとする。P=0であるので、回路182で追加アドレス記憶部131Aに記憶されている追加アドレス「3」を、現在の特定命令アドレスSIA(=1)と比較する。両者が一致しないので、回路183に進み、ポインタPをインクリメントしてP=2とする。以下、上記と同様にして、回路182,183,184の間を循環し、回路184でポインタPが上限値であると判断されると、回路185に進み、ポインタPはP=0に戻されて終了する。かくして、この周期にも、PC更新停止信号をローレベルにされたままとなり、次回にも、特定命令アドレスSIAの値が更新される。
さらに次の周期には、PC112に示す特定命令アドレスSIAが更新されてSIA=2となるが、各追加アドレス記憶部131A等に記憶されている追加アドレスとは一致しないので、ここでも、ポインタPはP=0に戻されて終了し、次回に特定命令アドレスSIAの値が更新される。
【0067】
しかるに、4番目の周期には、PC112に示す特定命令アドレスSIAが更新されてSIA=3となる。この状態で再び追加アドレス選択手段180での処理が開始される。まず、回路181でPC更新停止信号をローレベルとする。P=0であるので、回路182で追加アドレス記憶部131Aに記憶されている追加アドレス「3」を、現在の特定命令アドレスSIA(=3)と比較する。両者が一致したので、回路186に進み、PC更新停止信号をハイレベルとする。さらに回路187に進み、ポインタPをインクリメントしてP=1として終了する。かくして、この周期には、PC更新停止信号がハイレベルにされるので、次の周期(5番目の周期)には、PC112は特定命令アドレスSIAの値を更新しない。つまりSIA=1のままとなる。
なお、この周期では、PC更新停止信号を一旦ローレベルとした後にハイレベルとしたが、次の周期におけるPC112の更新停止には何等影響しないことは既に述べた。
また、この周期において追加アドレス記憶部131Aに記憶されている追加アドレス「3」が、現在の特定命令アドレスSIA(=3)と一致したので、図5(b)には示さないが、図2〜図4を参照して説明したように、1周期遅れて命令セレクタ150がハイレベルとなり、追加データ記憶部131Dに記憶されている追加データの内容「XXXX」が出力され、さらにIR111に読み込まれ実行される。
【0068】
次いで、5番目の周期では、PC112に示す特定命令アドレスSIAが更新されずにSIA=3を維持する。この状態で再び追加アドレス選択手段180での処理が開始され、回路181でPC更新停止信号をローレベルとする。P=1であるので、回路182では、追加アドレス記憶部132Aに記憶されている追加アドレス「3」を、現在の特定命令アドレスSIA(=3)と比較する。再び両者が一致したので、回路186に進み、PC更新停止信号をハイレベルとする。さらに回路187に進み、ポインタPをインクリメントしてP=2として終了する。かくして、この周期にも、PC更新停止信号がハイレベルにされるので、次の周期(6番目の周期)には、PC112は特定命令アドレスSIAの値を更新しない。つまりSIA=3のままとなる。
なお、追加アドレス記憶部132Aに記憶されている追加アドレス「3」が、現在の特定命令アドレスSIA(=3)と一致したので、追加データ記憶部132Dに記憶されている追加データの内容「YYYY」が追加され、実行される。
【0069】
さらに6番目の周期には、上述のようにSIA=3のままとなる。この状態で再び追加アドレス選択手段180での処理が開始される。まず、回路181でPC更新停止信号をローレベルとする。P=2であるので、回路182で追加アドレス記憶部133Aに記憶されている追加アドレス「6」を、現在の特定命令アドレスSIA(=3)と比較する。両者が一致しないので、回路183に進み、ポインタPをインクリメントしてP=3とする。次いで回路184でポインタPが上限値でないと判断されると、回路182に戻る。追加アドレスの内容が「3」である追加アドレス記憶部が存在しないので、以下、回路182,183,184の間を循環し、回路184でポインタPが上限値であると判断されると、回路185に進み、ポインタPはP=0に戻されて終了する。かくして、この周期には、PC更新停止信号をローレベルにされたままとなり、次回には特定命令アドレスSIAの値が更新されて、SIA=4となる。
なお、追加アドレス記憶部133Aに記憶されている追加アドレス「6」が、現在の特定命令アドレスSIA(=3)と一致しないので、通常通り、特定命令アドレスSIA=3で特定される特定命令データが命令セレクタ150で選択される。
【0070】
このように、ポインタP及び追加アドレス選択手段180(ポインタ制御手段188)を用いることにより、命令データ列に追加データが重複なく順に追加できる。
なお、プログラムに繰り返し実行するループ部分があり、追加データをこのループ内に追加したい場合がある。この場合、このループ部分が実行される度に、追加データを追加する必要がある。上述したポインタPと追加アドレス選択手段180を用いた場合には、ポインタPが、特定命令アドレスSIAと一致する追加アドレスを指示していないとき、つまり、命令追加レジスタ131等の追加アドレス記憶部131A等に特定命令アドレスSIAと一致する追加アドレスが記憶されていないときには、回路185においてP=0とする。このため、次回には、検索順序の先頭から追加アドレスの一致検索をするから、ループ部分が実行される度に、繰り返して追加データを適切に追加することができる利点もある。
【0071】
次いで、このマイクロコンピュータ100を用いて、命令データを削除する場合について説明する。ROM120に記憶した命令データ列のうち、命令アドレス「3」に対応する命令データ「DDDD」を削除して実行する場合について、図6を参照して説明する。
命令削除レジスタ161には削除アドレスとして「2」が記憶されているとする。また、命令セレクタ150は命令データの削除の場合には不要である。そこで、追加データセレクト信号はローレベルにされているとする。
まず、PC更新停止信号がローレベルにされているので、クロック信号の立ち上がりタイミングに従って、PC112が示す特定命令アドレスSIAの値はインクリメントされ、その値が「0」,「1」というように順に変化する。すると、これに従って、マスクROM120からは、クロック信号で1周期分遅れて特定命令データSIAで特定される特定命令データSIDが、「AAAA」,「BBBB」というように順に出力され、命令セレクタ150に入力される。
追加データセレクト信号がローレベルにされているので、命令セレクタ150に入力された特定命令データSIDは、そのまま出力され、次の周期(クロック信号の次の立ち上がりタイミング)に、IR111に読み込まれ、その後CPU110で実行される。
【0072】
その後(図6において第3クロック目)、PC112の示す特定命令アドレスSIAが更新されて「2」(SIA=2)となる。すると、ROM120からは特定命令データSID=2で特定される特定命令データ「CCCC」が読み出される。さらにこのときには、削除アドレス比較回路170に入力された特定命令アドレスSIAと命令削除レジスタ131に記憶された削除アドレスとが一致する。すると、削除アドレス比較回路170は、削除信号をクロック信号の1周期分だけハイレベルにする。これにより、PC112におけるインクリメントが2回分行われ、つまりSIA=SIA+2=4とされる。
【0073】
すると、次の周期(図6において第4クロック目)における特定命令アドレスSIAが「4」であるため、ROM120から読み出される特定命令データSIDは、「EEEE」となる。また、特定命令アドレスSIAと命令削除レジスタ161に記憶された削除アドレスとが一致しないので、削除アドレス比較回路170は、削除信号をローレベルに戻す。これにより、PC112において、通常通りインクリメントが1回分だけ行われ、つまりSIA=SIA+1=5とされる。かくして、IR111に読み込まれる特定命令データSIDは、「CCCC」、「EEEE」、「FFFF」…の順になり、命令アドレス「3」に対応する命令データ「DDDD」が削除された状態で実行される。
なお、上記例では、命令削除レジスタ161のみを用いた例で説明したが、図2に示したように、複数の削除命令レジスタ161,162…を備えるようにしても良いことは明らかである。
【0074】
(変形形態1)
次いで、上記実施形態の変形形態について、図7を参照して説明する。上記実施形態では、ポインタPと追加アドレス選択手段180(ポインタ制御手段188)とを用いることにより、同じ追加データ記憶部131D等に記憶されていた追加データを重複して追加するのを防止した。これに対して、本変形形態1では、命令追加レジスタ131等に、追加アドレス記憶部131A等や追加データ記憶部131D等のほか、フラグビット131F等を備えており、このフラグビット131F等と、ポインタP及び追加アドレス選択手段280を用いる点で異なる。従って、上記した実施形態と異なる部分を中心に説明し、同様な部分については説明を簡略化あるいは省略する。
図7(a)に示し、上述したように命令追加レジスタ130は、各命令追加レジスタ131等に、それぞれ追加アドレス記憶部131A等や追加データ記憶部131D等のほか、フラグビット131F等を備える。
また、実施形態と同様に、命令追加レジスタ131,132…等には、固有の番号(0,1,2…)が付されており、その番号が小さいほど、検索順位の高いの命令追加レジスタである。また、ポインタPは、各命令追加レジスタ131等に記憶されている追加アドレスを、検索順位に従い、矢印で示すように固有番号について昇順で検索して、複数の命令追加レジスタ131等のうち、読み出すべき追加データが記憶された命令追加レジスタを指示する。また、追加アドレス選択手段280は、スタートからエンドまでをクロック信号の1周期以内に終了するように構成されている。
【0075】
追加アドレス選択手段280について説明する(図7(b)参照)。
クロック信号が立ち上がると、回路281でポインタPをP=0に揃える。次いで、回路282でPC112の更新(更新再開)を指示する。具体的には、PC更新停止信号をローレベルにする。
回路283では、ポインタPの示す値(固有番号)で指示される命令追加レジスタ131等のフラグビット131F等におけるフラグの値FLG(P)=0であるか否かを判断する。ここで、No、即ちポインタPで指定されたフラグビット131F等におけるフラグの値FLG(P)=1のときには、回路285に進む。一方、ポインタPで指定されたフラグの値FLG(P)=0であるときは、回路284に進む。
【0076】
回路284では、ポインタPの示す値(固有番号)で指示される追加アドレス記憶部131A等に記憶された追加アドレスが、特定命令アドレスSIAと一致しているか否かを判断する。
ここでNo、即ち、ポインタPで指定された追加アドレス記憶部131A等に記憶された追加アドレスと特定命令アドレスSIAとが不一致のときには、回路285に進む。一方、ポインタPで指定された追加アドレス記憶部131A等に記憶された追加アドレスと特定命令アドレスSIAとが一致するときには、回路286に進む。
【0077】
回路285では、ポインタPの値を1つインクリメントする。つまり、ポインタPで指示するデータ−アドレス対、従ってこれを記憶する命令追加レジスタ131等を検索順序で見て次の命令追加レジスタに切り換える。
さらに、回路286では、ポインタPが上限値つまりこれ以上インクリメントできない値となったか否かを判断し、Noつまり、まだインクリメントできる場合には、回路283及び回路284の判断に戻す。一方、Yesつまり、ポインタPが上限値であるときには、処理を終了する。
【0078】
一方、回路287では、PC112での更新の停止を指示する。具体的には、PC更新停止信号をハイレベルにする。なお、回路282で予めPC更新停止信号をローレベルとし、その後回路287でPC更新停止信号をハイレベルしても、次の周期におけるPC112の更新停止には何等影響しない。
また、追加アドレス記憶部131A等に記憶されている追加アドレスが、特定命令アドレスSIAと一致したので、図2〜図4を参照して説明したように、1周期遅れて命令セレクタ150がハイレベルとなり、追加データ記憶部131D等に記憶されている追加データの内容が追加され、後に実行されることになる。
【0079】
続いて回路288では、ポインタPで指定されたフラグビット131F等におけるフラグの値FLG(P)を、FLG(P)=1に書き換え、処理を終了する。このように、ある追加命令レジスタのフラグビットの値FLGを1に書き換えると、これ以降、ポインタPがこの追加命令レジスタを指示しても、回路283において必ずNoと判断されるため、回路284,287,288を通ることが無くなる。従って、フラグビットの値を1にすることで、既に追加した追加データが記憶されている命令追加レジスタからは、重複して追加データを用いることが無くなり、命令データ列に追加データが重複なく順に追加できる。
【0080】
(変形形態2)
上記実施形態及び変形形態1では、このマイクロコンピュータ100を用い、マスクROM120に記憶させた命令データ列の一部に追加データを追加したり、一部の命令データを削除した。しかし、マスクROM120の記憶容量を僅かに超える大きさのプログラム(命令データ列)を記憶させ、実行させたい場合がある。このような場合には、図8に示すようにすることで、ROMの記憶容量を大きくするなどの設計変更を経ずに、プログラム(命令データ列)を記憶させ、実行させることができる。
【0081】
マイクロコンピュータ100は、記憶容量が256ワードのマスクROM120と、命令追加レジスタ130として4つの命令追加レジスタ131〜134を有しているとする。本来は、マスクROM120にプログラム(命令データ列)のすべてを記憶させておくべきであるが、プログラムの大きさがやむを得ず、260ワードになったとする。
この場合に、図8に示すように、予めマスクROM120に、先頭から255ワード分の命令データ(「AAAA」〜「UUUU」)を記憶させると共に、命令アドレス255には最後の命令データ(「ZZZZ」)を記憶させておく。さらに、4つの命令追加レジスタ131〜134に、外部から、残る4ワード分(プログラムの先頭から256,257,258,259ワード目)の追加データと追加アドレスを、それぞれ命令追加レジスタ131〜134に書き込む。具体的には、ROM120の最後の命令アドレスである「255」を共通の追加アドレスとして追加アドレス記憶部131A〜134Aに記憶させると共に、追加データ記憶部131D〜134Dに上述の残る4ワード分の命令データ(「VVVV」,「WWWW」,「XXXX」,「YYYY」)を記憶させる。
【0082】
このようにすれば、プログラムが進行してPC112が示す特定命令アドレスSIA=255となった場合には、4つの命令データ「VVVV」,「WWWW」,「XXXX」,「YYYY」を順に追加し、さらにその後、ROM120の最後の命令アドレス255に記憶されている「ZZZZ」を実行することができる。かくして、このマイクロコンピュータ100によれば、4つの命令追加レジスタ131〜134を形成しておき、後に外部から4ワード分の追加データ及び追加アドレスを記憶させることにより、記憶容量が256ワードのマスクROM120を用いながらも、260ワードの大きさのプログラムを実行することができる。
【0083】
以上において、本発明を実施形態及び変形形態1,2に即して説明したが、本発明は上記実施形態等に限定されるものではなく、その要旨を逸脱しない範囲で、適宜変更して適用できることはいうまでもない。
例えば、前述した実施形態(図3参照)では、特定命令アドレスSIAと追加アドレス131A等とが一致した場合には、PC更新停止信号を1周期だけハイレベルとすると共に、これに1周期だけ遅れて、追加データセレクト信号を1周期だけハイレベルにした。このため、例えば、追加アドレス131Aに「3」を記憶させた場合、ROM120の命令アドレス=3に記憶した命令データ「DDDD」よりも前に追加データ「XXXX」が追加された。しかし、追加データセレクト信号をPC更新停止信号より2周期遅れてハイレベルにすることもできる。すると、図3に括弧で示すように、命令データ「DDDD」の後に追加データ「XXXX」を追加することができる。また、図4に括弧で示すように、命令データ「DDDD」の後に追加データ「XXXX」及び「YYYY」を追加することができる。
【0084】
(付記1)
命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ−アドレス対を少なくとも1対以上記憶可能に構成されてなる追加命令記憶手段と、
上記プログラムカウンタの示す上記特定命令アドレスと上記追加命令記憶手段に記憶された上記追加アドレスとを比較する第1比較手段と、
上記特定命令データと上記追加命令データのいずれかを選択して、上記命令レジスタに出力する選択手段と、
を備える計算機であって、
上記第1比較手段において、
上記特定命令アドレスと上記追加アドレスとが不一致であるとき、
上記選択手段は上記特定命令データを選択して上記命令レジスタに出力し、
上記特定命令アドレスと上記追加アドレスとが一致したとき、
上記プログラムカウンタは上記特定命令アドレスの更新を停止し、
上記選択手段は上記特定命令データ、及び、上記追加命令記憶手段に記憶された追加命令データであって、上記特定命令アドレスに一致する追加アドレスと上記データ−アドレス対をなす追加命令データ、のいずれか一方を先に選択して上記命令レジスタに出力し、他方をその後に選択して出力する
計算機。
(付記2)
付記1に記載の計算機であって、
前記特定命令アドレスに一致する追加アドレスとデータ−アドレス対をなす追加命令データが、前記命令レジスタに重複なく出力されるようにする重複出力防止手段
を備える計算機。
(付記3)
付記2に記載の計算機であって、
前記重複出力防止手段は、
前記追加命令記憶手段から読み出すべき追加命令データと前記データ−アドレス対をなす前記追加アドレスを指示するポインタであって、
上記追加命令記憶手段に記憶されている複数の前記追加アドレスを所定の検索順序で検索して、前記プログラムカウンタが示す前記特定命令アドレスに一致する追加アドレスのうち、最初に検索された追加アドレスを指示するポインタと、
上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示していなかったときには、次回に上記所定の検索順序の先頭から順に上記追加アドレスについて上記検索をさせ、
上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示しているときには、次回に上記所定の順序のうちポインタが現在指示している上記追加アドレスから見て次以降の検索順序の追加アドレスについて上記検索をさせる
検索開始位置変更手段と、を備える
計算機。
(付記4)
付記2に記載の計算機であって、
前記重複出力防止手段は、
記憶されている複数の前記データ−アドレス対とそれぞれ1対1に関連づけられた出力済記憶部と、
前記命令レジスタに上記データ−アドレス対に属する前記追加命令データが出力されたときに、対応する上記出力済記憶部に出力済を示す出力済データを記録する出力済記録手段と、
上記出力済データが記録されている上記出力済記憶部に関連づけられた上記データ−アドレス対に属する上記追加命令データの上記命令レジスタへの出力を禁止する出力禁止手段と、を含む
計算機。
(付記5)
付記1〜付記4のいずれか1項に記載の計算機であって、
前記第1比較手段は、
前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された前記追加アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの次回の更新を停止させる
計算機。
(付記6)
付記1〜付記5のいずれか1項に記載の計算機であって、
前記追加命令記憶手段は、1または複数の追加用レジスタである
計算機。
(付記7)
付記6に記載の計算機であって、
前記メモリに記憶された前記命令データ列のデータ量と、
前記追加用レジスタに記憶された前記追加命令データのデータ量と、
の和が、上記メモリの記憶容量よりも大きい
計算機。
(付記8)
付記1〜付記5のいずれか1項に記載の計算機であって、
外部から書き込み可能で、前記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、
前記プログラムカウンタの示す前記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較する第2比較手段と、を備え、
上記第2比較手段は、
上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新させる
計算機。
(付記9)
付記1〜付記8のいずれか1項に記載の計算機を、1つの集積回路チップに実現してなる集積回路装置。
(付記10)
命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、
上記プログラムカウンタの示す上記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較する第2比較手段と、を備え、
上記第2比較手段は、
上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新させる
計算機。
(付記11)
付記9に記載の計算機であって、
前記削除位置記憶手段は、削除用レジスタである
計算機。
(付記12)
付記10または付記11に記載の計算機を、1つの集積回路チップに実現してなる集積回路装置。
(付記13)
命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ−アドレス対を少なくとも1対以上記憶可能に構成されてなる追加命令記憶手段と、
を備える計算機における命令実行方法であって、
上記プログラムカウンタの示す上記特定命令アドレスと上記追加命令記憶手段に記憶された上記追加アドレスとを比較し、
上記特定命令アドレスと上記追加アドレスとが不一致であるとき、
上記特定命令データを上記命令レジスタに出力して、上記特定命令データを上記CPUで実行し、
上記特定命令アドレスと上記追加アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの更新を停止し、
上記特定命令データと、上記追加命令記憶手段に記憶された追加命令データであって、上記特定命令アドレスに一致する追加アドレスと上記データ−アドレス対をなす追加命令データと、のいずれか一方を先に上記命令レジスタに出力し、他方をその後に出力して、上記追加命令データ及び上記特定命令データを上記CPUで実行する
計算機における命令実行方法。
(付記14)
付記13に記載の計算機における命令実行方法であって、
前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された追加アドレスとが一致したとき、
上記特定命令アドレスに一致する追加アドレスと前記データ−アドレス対をなす前記追加命令データを、前記命令レジスタに重複なく出力する
計算機における命令実行方法。
(付記15)
付記14に記載の計算機における命令実行方法であって、
前記計算機は、前記追加命令記憶手段から読み出すべき追加命令データと前記データ−アドレス対をなす追加アドレスを指示するポインタであって、上記追加命令記憶手段に記憶されている複数の前記追加アドレスを所定の検索順序で検索して、前記プログラムカウンタが示す前記特定命令アドレスに一致する追加アドレスのうち、最初に検索された追加アドレスを指示するポインタを備え、
上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示していなかったときには、次回に上記所定の検索順序の先頭から順に上記追加アドレスについて上記検索をし、
上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示しているときには、次回に上記所定の検索順序のうちポインタが現在指示している追加アドレスから見て次以降の検索順序の追加アドレスについて上記検索をする
計算機における命令実行方法。
(付記16)
付記14に記載の計算機における命令実行方法であって、
前記計算機は、記憶されている複数の前記データ−アドレス対とそれぞれ1対1に関連づけられた出力済記憶部を備え、
前記命令レジスタに上記データ−アドレス対に属する前記追加命令データを出力したときに、対応する上記出力済記憶部に出力済を示す出力済データを記録し、
その後、上記出力済データが記録されている上記出力済記憶部に関連づけられた上記データ−アドレス対に属する上記追加命令データの上記命令レジスタへの出力を禁止する
計算機における命令実行方法。
(付記17)
付記13〜付記16のいずれか1項に記載の計算機における命令実行方法であって、
前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された前記追加アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの次回の更新を停止させる
計算機における命令実行方法。
(付記18)
付記13〜付記17のいずれか1項に記載の計算機における命令実行方法であって、
前記追加命令記憶手段は、1または複数の追加用レジスタである
計算機における命令実行方法。
(付記19)
付記18に記載の計算機における命令実行方法であって、
前記メモリに記憶された前記命令データ列のデータ量と、
前記追加用レジスタに記憶された前記追加命令データのデータ量と、
の和が、上記メモリの記憶容量よりも大きい
計算機における命令実行方法。
(付記20)
付記13〜付記16のいずれか1項に記載の計算機における命令実行方法であって、
前記計算機は、外部から書き込み可能で、前記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段を備え、
前記プログラムカウンタの示す前記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較し、
上記特定命令アドレスと上記削除アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新し、
その後、上記プログラムカウンタの示す更新された特定命令アドレスに従って、前記メモリから前記特定命令データを前記命令レジスタに出力し、前記CPUで実行する
を備える計算機における命令実行方法。
(付記21)
命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、
を備える計算機における命令実行方法であって、
上記プログラムカウンタの示す上記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較し、
上記特定命令アドレスと上記削除アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新し、
その後、上記プログラムカウンタの示す更新された特定命令アドレスに従って、上記メモリから上記特定命令データを上記命令レジスタに出力し、上記CPUで実行する
計算機における命令実行方法。
(付記22)
付記21に記載の計算機における命令実行方法であって、
前記削除位置記憶手段は、削除用レジスタである
計算機における命令実行方法。
【図面の簡単な説明】
【図1】実施形態にかかる、1チップ型のマイクロコンピュータを示す説明図である。
【図2】実施形態にかかるマイクロコンピュータにおけるCPUとROMとの命令データの受け渡し及び命令データの追加削除を示す説明図である。
【図3】1ヶの追加命令データを追加する場合の各部の動作を示すタイミングチャートである。
【図4】2ヶの追加命令データを連続して追加する場合の各部の動作を示すタイミングチャートである。
【図5】ポインタを利用した命令追加レジスタの検索・選択を示す説明図である。
【図6】命令データを1ヶ削除する場合の各部の動作を示すタイミングチャートである。
【図7】変形形態1にかかり、フラグビットを利用した命令追加レジスタの検索・選択を示す説明図である。
【図8】変形形態2にかかり、ROMの記憶容量を超える命令データ列を記憶する場合の説明図である。
【図9】従来技術にかかるマイクロコンピュータにおけるCPUとROMとの間の命令データの受け渡しを示す概念図である。
【符号の説明】
100 マイクロコンピュータ(計算機、集積回路装置)
110 CPU
111 インストラクションレジスタ(命令レジスタ)
112 プログラムカウンタ
120 マスクROM(メモリ)
130 命令追加レジスタ(追加命令記憶手段、追加用レジスタ)
131,132,133,… 命令追加レジスタ(追加命令記憶手段、追加用レジスタ)
131A,132A,133A,… 追加アドレス記憶部
131D,132D,133D,… 追加データ記憶部
131F,132F,133F,… フラグビット(出力済記憶部)
140 追加アドレス比較回路(第1比較手段)
150 命令セレクタ(選択手段)
160 命令削除レジスタ(削除位置記憶手段)
161,162,163,… 命令削除レジスタ(削除位置記憶手段)
170 削除アドレス比較回路(第2比較手段)
180,280 追加アドレス選択手段
188 ポインタ制御手段(検索開始位置変更手段)
283 回路(出力禁止手段)
287 回路(出力済記録手段)
SIA 特定命令アドレス
SID 特定命令データ
P ポインタ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a computer and an instruction execution method thereof, and more particularly to a computer capable of modifying (adding or deleting) instructions, an integrated circuit device in which the instructions are integrated on a single chip, and such correction (addition or deletion) in a computer. It relates to an instruction execution method.
[0002]
[Prior art]
As shown in FIG. 9, some microcomputers 10 include a mask ROM 4 in addition to the CPU 1. In the microcomputer 10, among instruction data strings stored in the mask ROM 4 and forming a program, specific instruction data specified by a specific instruction address indicated by the program counter 3 are sequentially read into the instruction register 2 and executed by the CPU 1. You are going to get the result.
[0003]
However, if a bug is found in the program (instruction data string) stored in the mask ROM 4, the program cannot be corrected, and the microcomputer must be discarded.
[0004]
On the other hand, Japanese Patent Application Laid-Open No. 61-239330 discloses a microprogram correction method in which a program stored in a ROM / RAM is replaced with a correction program stored in a RAM. Specifically, when the program being executed reaches a point to be corrected, the operation of the address generation circuit is stopped, and the correction program stored in the RAM is executed. An unconditional branch instruction is placed at the end of the correction program, and the instruction returns to execution of the program stored in the ROM / RAM and restarts the operation of the address generation circuit. Thus, the program was corrected and executed.
[0005]
Japanese Patent Application Laid-Open No. 58-31450 discloses a program change method for changing a desired portion of a program stored in a ROM for each step. More specifically, when the value of the address register indicating the address of the ROM storing the instruction matches the value of the changed program address register as the program proceeds, instead of the instruction from the ROM, the changed data After the contents of the register are executed by the microprocessor, the operation is stopped by stopping the operation, the contents of the change data register and the change program address register are changed, and the microprocessor is restarted to execute the program, thereby repeatedly performing the change operation. be able to. Thus, the program was corrected and executed.
[0006]
[Problems to be solved by the invention]
However, in the above-mentioned Japanese Patent Application Laid-Open No. 61-239330, it is necessary to place an unconditional branch instruction at the end in addition to the correction program (instruction data), and it takes extra time to process the unconditional branch instruction. Further, a microprogram correcting means having a complicated structure is required, and the cost is increased, for example, the chip size of the microcomputer is increased.
Further, in the above-mentioned Japanese Patent Application Laid-Open No. 58-31450, it is necessary to stop the microprocessor after the change of the instruction, and a large dead cycle occurs due to the stop and restart. Further, the instruction from the ROM is replaced with the contents of the change data register and executed, and addition or deletion of the instruction is impossible.
The present invention has been made in view of such a problem, and has a simple structure, a computer capable of correcting addition or deletion of instruction data, an integrated circuit device having the same integrated on a single chip, and a computer It is an object of the present invention to provide a method for executing an instruction.
[0007]
Means for Solving the Problems, Functions and Effects
The solving means includes a memory storing an instruction data string, an instruction register, and a program indicating a specific instruction address at which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored. At least one or more data-address pairs can be stored that include a CPU having a counter, an externally writable additional instruction data to be added to the instruction data string, and an additional address indicating a position where the additional instruction data is to be added. Additional instruction storage means configured; first comparison means for comparing the specific instruction address indicated by the program counter with the additional address stored in the additional instruction storage means; the specific instruction data and the additional instruction Selecting means for selecting any of the data and outputting the selected data to the instruction register. In the first comparing means, when the specific instruction address and the additional address do not match, the selecting means selects the specific instruction data and outputs the selected instruction data to the instruction register. When the additional address matches, the program counter stops updating the specific instruction address, and the selecting means is the specific instruction data and the additional instruction data stored in the additional instruction storage means, A computer which selects one of an additional address corresponding to a specific instruction address and additional instruction data forming the data-address pair first and outputs the selected instruction data to the instruction register, and then selects and outputs the other. .
[0008]
According to the computer of the present invention, when adding the instruction data to a desired position of the instruction data string (program) stored in the memory, the first comparison means uses a specific instruction address indicated by a program counter (hereinafter, also simply referred to as PC). When the additional address indicating the position to be added matches, the updating of the specific instruction address in the program counter is stopped. At the same time, before and after the specific instruction data stored in the memory and specified by the specific instruction address, the additional instruction data stored in the additional instruction storage means in a data-address pair with the matched additional address is stored in the instruction register. Output to Therefore, additional instruction data can be added to the instruction data sequence and executed without interrupting the program being executed by the CPU. Therefore, a dead cycle does not occur due to the interruption of the program.
[0009]
Here, a field PROM other than the mask ROM can be used as the memory. Further, an EPROM, an EEPROM, a flash memory, a RAM, or the like can be used. In particular, it is preferable to apply the present invention to a device using a mask ROM and a field PROM. This is because these ROMs cannot modify the instruction data sequence once stored.
The additional command storage means only needs to be able to store the additional command data and the additional address forming a data-address pair in association with each other, and may be constituted by a register, a RAM, a PROM, an EPROM, an EEPROM, a flash memory, or the like. . In particular, when the instruction data to be added is small (for example, about one word to several tens of words), it is preferable to use a register as the additional instruction storage means. This is because it is not necessary to form an address line or the like, and the register can be configured with a simple structure. On the other hand, when a large amount of instruction data is added, it is preferable to use a RAM, a PROM, or the like as the additional instruction storage means. However, since address control and the like are required, the circuit configuration of the computer becomes complicated, such as the need to form address lines.
[0010]
2. The computer according to claim 1, wherein additional instruction data forming a data-address pair with an additional address that matches the specific instruction address is output to the instruction register without duplication. 3. It is good to be a computer provided with the means.
[0011]
In the above-described computer, when the specific instruction address and the additional address match, the update of the specific instruction address in the program counter is stopped, so that the specific instruction address indicated by the program counter does not change. Then, even in the next cycle, the specific instruction address matches the additional address again. Therefore, the same additional instruction data is added indefinitely, and there is a possibility that the program cannot be properly executed.
Therefore, the provision of the duplication output preventing means as in the present invention prevents duplication of already output additional instruction data, so that it is possible to execute a program to which the additional instruction data is appropriately added. become able to.
In addition, since it is desired to add a plurality of additional instruction data continuously at the same position in the program (instruction data string), even when a plurality of data-address pairs having the same additional address are stored, this duplicate output prevention means is not used. With this arrangement, the additional instruction data belonging to the plurality of data-address pairs having the same additional address can be sequentially output to the instruction register without duplication. Therefore, even when one additional instruction data is added, or when a plurality of additional instruction data are continuously added, a program to which the instruction data is appropriately added can be executed.
[0012]
Further, the computer according to claim 2, wherein the duplicate output preventing means is a pointer for indicating the additional address forming the data-address pair with additional instruction data to be read from the additional instruction storage means, The plurality of additional addresses stored in the additional instruction storage means are searched in a predetermined search order, and among the additional addresses matching the specific instruction address indicated by the program counter, the first searched additional address is determined. When the pointer to be pointed and the pointer do not point to the additional address that matches the specific instruction address, the search for the additional address is performed next from the top of the predetermined search order next time, and the pointer is If an additional address that matches the instruction address is indicated, Out pointer as seen from the additional address that is currently indicated for additional address order of the search after the next may be a computer and a search start position changing means for the search.
[0013]
The computer according to the present invention has a pointer and a search start position changing unit as a duplication output preventing unit. Specifically, for each additional address, a search is made for one that matches the specific instruction address indicated by the program counter, and a pointer is provided to indicate the first additional address that matches. Further, when this pointer does not point to an additional address that matches the specific instruction address, a match search is performed next for the additional address from the beginning of the predetermined search order. On the other hand, when the pointer points to an additional address that matches the specific instruction address, a search start position changing unit that performs a match search for the additional addresses in the next and subsequent search orders when viewed from the additional address currently indicated by the pointer. have. Therefore, the additional instruction data that has already been output is not output twice or more.
In some cases, additional instruction data may be required to be added to a loop portion of a program. In this case, it is necessary to add additional instruction data every time the loop is executed. On the other hand, in the computer of the present invention, when the pointer does not point to the additional address that matches the specific instruction address, a loop portion is executed in order to perform a match search for the additional address from the head of a predetermined order next time. Each time, the additional instruction data can be appropriately added.
[0014]
Alternatively, the computer according to claim 2, wherein the duplicate output prevention unit includes an output storage unit associated with the stored data-address pairs in a one-to-one correspondence with each other, and the instruction register. When the additional command data belonging to the data-address pair is output, output-completed recording means for recording output-completed data indicating output completion in the corresponding output-complete storage unit; Preferably, the computer includes an output prohibiting unit that prohibits the additional instruction data belonging to the data-address pair associated with the output-completed storage unit from being output to the instruction register.
[0015]
In this computer, an output storage unit associated with each data-address pair is provided, and in this output recording means, when additional instruction data belonging to the data-address pair is output, this is recorded as output data. . The output prohibiting unit prohibits the output of the additional instruction data belonging to the data-address pair associated with the output storage unit in which the output data is recorded to the instruction register. Therefore, the additional instruction data that has already been output is not output twice or more.
The output storage unit may be any storage unit that can store the output data. For example, a flag bit associated with each data-address pair may be used. The use of the flag bit is particularly preferable because the output-completed storage unit can be minimized, and the effect of forming the output-completed storage unit, such as an increase in chip area, can be minimized.
[0016]
Further, in the computer according to any one of the above, the first comparing means, when the specific instruction address indicated by the program counter and the additional address stored in the additional instruction storage means match, The computer may stop the next update of the specific instruction address in the program counter.
[0017]
In the computer of the present invention, when the specific instruction address matches the additional address, the next update of the specific instruction address in the program counter is stopped. Therefore, when one additional instruction data is added, the update is stopped only once. On the other hand, when two or more (for example, three) additional instruction data are successively added, any of a plurality of (for example, three) additional addresses forming a data-address pair with the additional instruction data to be continuously added is required. Since the values are the same, the specific instruction address and the additional address are continuously matched with the number of additional instruction data to be added (for example, three times). Here, since the next update is stopped each time, after all, the PC is stopped by the same number of times (for example, three times) as the number of additional instruction data to be continuously added.
After that, the update is restarted. After the update is restarted, the updated specific instruction address does not match the additional address, the specific instruction data specified by the specific instruction address is output to the instruction register again, and the processing in the CPU is executed. Thus, after one or more additional instruction data is added and executed by the CPU, it is possible to immediately return to the execution of the original program (instruction data string) without intervening an unconditional jump or the like. No processing time is wasted.
[0018]
Furthermore, in the computer according to any one of the above, it is preferable that the additional instruction storage unit is a computer that is one or a plurality of additional registers.
[0019]
In general, when a RAM, PROM, or the like is used as a storage unit for storing data or the like, it is easy to increase the storage capacity. However, it is necessary to form an address line in controlling the RAM or the like. Many circuits are required. Therefore, the chip area which increases due to the addition of the instruction addition function tends to be large. On the other hand, registers can be configured with a simple circuit configuration, but it is difficult to form a large number of registers.
By the way, when modifying a program consisting of an instruction data string stored in a memory such as a ROM, it is often necessary to add a small amount of additional instruction data (for example, for several words). Many storage areas are likely to be wasted.
On the other hand, the computer according to the present invention includes an additional register as additional instruction storage means. Therefore, it is sufficient to configure an appropriate number of additional registers that can be formed by a simple circuit, and it is not necessary to form an address line as in the case of using a RAM or the like, and simple control can be performed. In the case of adding a small number of additional instruction data, it is often sufficient to provide such an additional register. In addition, a chip area which increases to add such a function can be reduced.
[0020]
Further, in the computer, a sum of a data amount of the instruction data string stored in the memory and a data amount of the additional instruction data stored in the additional register may be greater than a storage capacity of the memory. Should be a large computer.
[0021]
When a computer such as a microcomputer is manufactured, a program to be stored may inevitably exceed the storage capacity of a memory such as a ROM formed in the computer. For example, although programming was performed with the intention of using a ROM having a storage capacity of 256 words, the program may have a data amount of 260 words inevitably. In such a case, usually, the storage capacity of the ROM is increased to 384 words or 512 words. However, it is necessary to add a new address line or the like, and to additionally form a memory having a large storage capacity such as 128 words or 256 words for storing instruction data of about several words (four words in the above). There is much waste.
On the other hand, in the computer of the present invention, a program exceeding the storage capacity of the memory can be stored and executed by the memory and the additional register. .
[0022]
Furthermore, the computer according to any one of the above, wherein a deletion position which is writable from the outside and is configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence. Storage means; and second comparison means for comparing the specific instruction address indicated by the program counter with the deletion address stored in the deletion position storage means, wherein the second comparison means comprises the specific instruction address. It is preferable that the computer be configured to update the value of the specific instruction address in the program counter twice when the deleted address matches the deleted address.
[0023]
In this computer, additional instruction data can be added to an instruction data string forming a program, or instruction data can be deleted from the instruction data string. Therefore, if the addition and the deletion are combined, the instruction data can be changed.
[0024]
Furthermore, the computer according to any one of the above items may be an integrated circuit device realized on one integrated circuit chip.
[0025]
In the integrated circuit device of the present invention, since the above-described computer is realized on one chip, the cost can be further reduced.
[0026]
Another solution is to indicate a memory in which an instruction data sequence is stored, an instruction register, and a specific instruction address in which, among the instruction data stored in the memory, specific instruction data to be output to the instruction register is stored. A CPU having a program counter; a deletion position storage means which is externally writable and is capable of storing at least one deletion address indicating a position of instruction data to be deleted from the instruction data string; Second comparing means for comparing the specific instruction address shown with the deleted address stored in the deletion position storage means, wherein the second comparing means matches the specific instruction address with the deleted address. At this time, the computer updates the value of the specific instruction address in the program counter twice.
[0027]
The program counter of the CPU updates the value of the specific instruction address for each cycle of the clock signal, and indicates the specific instruction address where the specific instruction data to be read next is stored.
On the other hand, in the computer of the present invention, when the specific instruction address indicated by the program counter matches the deletion address, the value of the specific instruction address is updated twice by the second comparing means. That is, the value of the specific instruction address is changed by the same amount as when the update is performed twice. For example, if the value of the specific instruction address currently indicated by the program counter is 3, the value of the specific instruction address next indicated by the program counter should normally be updated to 4 by +1. However, since the stored delete address is 3, if the current specific instruction address is equal to 3, the second comparing means increments the specific instruction address of the program counter by two times, that is, +2, that is, +2. Update to 5 (= 3 + 2). Accordingly, the next instruction data output from the memory to the instruction register is the specific instruction data stored in the storage area specified by the specific instruction address = 5. That is, the execution of the instruction data string forming the program proceeds without the specific instruction data stored in the storage area specified by the specific instruction address = 4 being output to the instruction register. Thus, the instruction data specified by the deletion address can be substantially deleted from the instruction data sequence forming the program.
[0028]
Further, in the above-mentioned computer, it is preferable that the deletion position storage means is a computer which is a deletion register.
In general, when a RAM, PROM, or the like is used as a storage unit for storing data or the like, it is easy to increase the storage capacity. However, it is necessary to form an address line in controlling the RAM or the like. Many circuits are required. Therefore, the chip area which increases to add such a function tends to be large. On the other hand, registers can be configured with a simple circuit configuration, but it is difficult to form a large number of registers.
By the way, when modifying a program consisting of a sequence of instruction data stored in a memory such as a ROM, it is often sufficient to delete only a small number of instruction data (for example, several words). If used, many storage areas are likely to be wasted.
On the other hand, the computer of the present invention includes a deletion register as deletion position storage means. Therefore, it is only necessary to configure an appropriate number of deletion registers that can be configured with a simple circuit, and it is not necessary to form an address line as in the case of using a RAM or the like, and simple control can be performed. In order to delete a small number of instruction data, it is often sufficient to provide such a deletion register. In addition, a chip area which increases to add such a function can be reduced.
[0029]
Further, the computer is preferably an integrated circuit device realized on one integrated circuit chip.
In this integrated circuit device, since the above-described computer is realized on one chip, the cost can be further reduced.
[0030]
Still another solution is to provide a memory in which an instruction data string is stored, an instruction register, and a specific instruction address in which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored. At least one or more data-address pairs, each of which includes a CPU having a program counter and an additional address that is writable from the outside and that is added to the instruction data string and that indicates a position where the additional instruction data is added, are stored. An additional instruction storage means configured to be capable of, and an instruction execution method in a computer, comprising: comparing the specific instruction address indicated by the program counter with the additional address stored in the additional instruction storage means, When the specific instruction address and the additional address do not match, the specific instruction data The specific instruction data is output to the instruction register, the specific instruction data is executed by the CPU, and when the specific instruction address matches the additional address, updating of the specific instruction address in the program counter is stopped. Data and additional instruction data stored in the additional instruction storage means, the additional instruction data corresponding to the specific instruction address and the additional instruction data forming the data-address pair, An instruction execution method in a computer in which the additional instruction data and the specific instruction data are output to a register and the other is output thereafter, and the CPU executes the additional instruction data and the specific instruction data.
[0031]
In the instruction execution method in the computer according to the present invention, when adding the additional instruction data to a desired position of the instruction data string (program) stored in the memory, the additional instruction address indicated by the program counter and the additional address indicating the position to be added are added. If they match, the update of the specific instruction address in the program counter is stopped. At the same time, before and after the specific instruction data stored in the memory and specified by the specific instruction address, the additional instruction data stored in the additional instruction storage means in a data-address pair with the matched additional address is stored in the instruction register. Output to Therefore, additional instruction data can be added to the instruction data sequence and executed without interrupting the program being executed by the CPU. Therefore, a dead cycle does not occur due to the interruption of the program.
[0032]
Further, in the instruction execution method in the computer, when the specific instruction address indicated by the program counter matches the additional address stored in the additional instruction storage unit, the additional address matching the specific instruction address is It is preferable that the instruction execution method in a computer that outputs the additional instruction data forming a data-address pair to the instruction register without duplication.
[0033]
In the above-described instruction execution method in the computer, when the specific instruction address indicated by the program counter matches the additional address, the update of the specific instruction address in the program counter is stopped, so that the specific instruction address does not change. Then, even in the next cycle, the specific instruction address matches the additional address again. Therefore, the same additional instruction data is added indefinitely, and there is a possibility that the program cannot be properly executed.
Therefore, in the instruction execution method in the computer according to the present invention, when the specific instruction address and the additional address match, the additional instruction data forming a data-address pair with the matching additional address is output to the instruction register without duplication. As a result, it becomes possible to execute the program to which the additional instruction data is appropriately added.
Moreover, since it is desired to continuously add a plurality of additional instruction data at the same position in the program (instruction data string), even if a plurality of data-address pairs having the same additional address are stored, a plurality of the same By outputting the additional instruction data belonging to the data-address pair to the instruction register without duplication, a plurality of additional instruction data can be sequentially output to the instruction register.
Therefore, even when one additional instruction data is added, or when a plurality of additional instruction data are continuously added, a program to which the instruction data is appropriately added can be executed.
[0034]
Further, in the instruction execution method in the computer, the computer is a pointer that points to an additional address forming the data-address pair with additional instruction data to be read from the additional instruction storage means, Searching the stored plurality of additional addresses in a predetermined search order, among the additional addresses matching the specific instruction address indicated by the program counter, comprises a pointer indicating the first searched additional address, When the pointer does not point to the additional address that matches the specific instruction address, the search is performed for the additional address sequentially from the beginning of the predetermined search order next time, and the pointer matches the specific instruction address. When an additional address is indicated, the next time the specified search order is Preferably in the instruction execution method in a computer for the search for as viewed from the additional address Chi pointer is currently indicated additional address order of the search after the next.
[0035]
In the instruction execution method in this computer, a pointer is used, and the search start position is changed according to the detection result of the pointer. Specifically, for each additional address, a search is made for one that matches the specific instruction address indicated by the program counter, and a pointer is provided to indicate the first additional address that matches. Further, when the pointer does not indicate a matching additional address, a matching search is performed next for the additional address from the top of the predetermined search order. On the other hand, when the pointer points to an additional address that matches, a match search is performed for additional addresses in the next and subsequent search orders as viewed from the additional address currently pointed to by this pointer. Therefore, the additional instruction data that has already been output is not output twice or more.
In some cases, additional instruction data may be required to be added in a loop of a program. In this case, it is necessary to add additional instruction data every time the loop is executed. On the other hand, according to the instruction execution method of this computer, when the pointer does not point to an additional address that matches, a match search is performed for the additional address from the beginning of the predetermined search order next time. In addition, it is possible to appropriately add repeatedly additional instruction data.
[0036]
Alternatively, in the instruction execution method in the computer, the computer includes an output storage unit associated with the stored data-address pairs on a one-to-one basis. When the additional command data belonging to the address pair is output, output data indicating that output has been completed is recorded in the corresponding output storage section, and then, in the output storage section where the output data is recorded. An instruction execution method in a computer for inhibiting output of the additional instruction data belonging to the associated data-address pair to the instruction register is preferable.
[0037]
In the method of executing instructions in the computer, the computer includes an output storage unit associated with each data-address pair. When the additional instruction data belonging to the data-address pair is output, the additional instruction data is recorded as output data, and the additional instruction data belonging to the data-address pair associated with the output storage unit in which the output data is recorded. Disable output of data to the instruction register. Therefore, the additional instruction data that has already been output is not output twice or more.
The output storage unit may be any storage unit that can store the output data. For example, a flag bit associated with each data-address pair may be used. The use of the flag bit is particularly preferable because the output-completed storage unit can be minimized, and the effect of forming the output-completed storage unit, such as an increase in chip area, can be minimized.
[0038]
Furthermore, the instruction execution method in the computer according to any one of the above, wherein when the specific instruction address indicated by the program counter matches the additional address stored in the additional instruction storage means, the program counter is executed. It is preferable to use an instruction execution method in a computer for stopping the next update of the specific instruction address in the above.
[0039]
In the instruction execution method of this computer, the next update of the specific instruction address in the program counter is stopped when the specific instruction address matches the additional address. Therefore, when one additional instruction data is added, the update is stopped only once. On the other hand, when two or more (for example, three) additional instruction data are successively added, the next update is stopped every time the specific instruction address and the additional address match. The PC is stopped the same number of times as the number of additional instruction data to be executed (for example, three times).
After that, the update is restarted. After the update is resumed, the updated specific instruction address does not match the additional address, and the specific instruction data string stored in the memory again and specified by the specific instruction address is output to the instruction register, and the processing by the CPU is executed. You. Thus, after one or more additional instruction data is added and executed by the CPU, it is possible to immediately return to the execution of the original program (instruction data string) without intervening an unconditional jump or the like. No processing time is wasted.
[0040]
Further, in the instruction execution method in the computer according to any one of the above, the additional instruction storage means is one or more additional registers.
It is preferable to use an instruction execution method in a computer.
[0041]
When modifying a program consisting of an instruction data string stored in a memory such as a ROM, it is often necessary to add a small amount of additional instruction data (for example, several words), and if a RAM or the like is used, a large amount of memory is wasted. Easy to be.
On the other hand, in the instruction execution method in this computer, an additional register is provided as additional instruction storage means. Therefore, it is only necessary to configure an appropriate number of additional registers that can be configured by a simple circuit, and simple control can be performed as compared with the case where a RAM or the like is used. In the case of adding a small number of additional instruction data, it is often sufficient to provide such an additional register. In addition, a chip area which increases to add such a function can be reduced.
[0042]
Further, in the instruction execution method in the computer, a sum of a data amount of the instruction data string stored in the memory and a data amount of the additional instruction data stored in the additional register may be set in the memory. It is preferable to use an instruction execution method in a computer larger than the storage capacity.
When a computer such as a microcomputer is manufactured, a program to be stored may inevitably exceed the storage capacity of a memory such as a ROM formed in the computer. In such a case, if the storage capacity of the memory is increased, it is necessary to add a new address line or the like, and a memory having a large storage capacity is formed for storing instruction data of about several words, resulting in waste. Many.
On the other hand, according to the instruction execution method in this computer, a program exceeding the storage capacity of the memory can be stored and executed by the memory and the additional register. Nor.
[0043]
The method of executing an instruction in a computer according to any one of the preceding claims, wherein the computer is writable from the outside and can store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence. Comparing the specific instruction address indicated by the program counter with the delete address stored in the delete position storage means, and determining whether the specific instruction address matches the delete address. Then, the value of the specific instruction address in the program counter is updated twice, and then the specific instruction data is output from the memory to the instruction register according to the updated specific instruction address indicated by the program counter, An instruction execution method in a computer having a CPU execution Masui.
According to the instruction execution method in this computer, it is possible to add additional instruction data to an instruction data string forming a program or to delete instruction data from the instruction data string. Therefore, the instruction data can be changed by combining the addition and the deletion.
[0044]
Still another solution is to provide a memory in which an instruction data string is stored, an instruction register, and a specific instruction address in which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored. Comprising: a CPU having a program counter shown therein; and a deletion position storage means which is externally writable and is capable of storing at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data string. Comparing the specific instruction address indicated by the program counter with the delete address stored in the delete position storage means, and when the specific instruction address and the delete address match, The value of the specific instruction address in the program counter is updated twice, According to the updated identified instruction address indicated by the program counter, the specific instruction data from the memory and outputs to the instruction register, an instruction execution method in a computer executing the above CPU.
[0045]
The program counter of the CPU updates the value of the instruction address for each cycle of the clock signal, and indicates the instruction address where the instruction data to be read next is stored.
On the other hand, in the instruction execution method in the computer according to the present invention, when the specific instruction address indicated by the program counter matches the deletion address, the value of the specific instruction address is updated twice. That is, the value of the specific instruction address is changed by the same amount as when the update is performed twice. Therefore, the specific instruction data that is to be output next is not output, and the instruction data that is to be output one after another is output to the instruction register one time earlier and next time, and the instruction data string forming the program is output. Execution will proceed. Thus, the instruction data specified by the deletion address can be substantially deleted from the instruction data sequence forming the program.
[0046]
Further, in the instruction execution method in the computer, it is preferable that the deletion position storage means is an instruction execution method in the computer which is a deletion register.
When modifying a program consisting of a sequence of instruction data stored in a memory such as a ROM, it is often necessary to delete only a small number of instruction data (for example, several words). The area is likely to be wasted.
On the other hand, in the instruction execution method in this computer, a deletion register is provided as the deletion position storage means. Therefore, it is only necessary to configure an appropriate number of deletion registers that can be configured with a simple circuit, and it is not necessary to form an address line as in the case of using a RAM or the like, and simple control can be performed. In order to delete a small number of instruction data, it is often sufficient to provide such a deletion register. In addition, a chip area which increases to add such a function can be reduced.
[0047]
BEST MODE FOR CARRYING OUT THE INVENTION
(Embodiment)
An embodiment of the present invention will be described with reference to FIGS. As shown in FIG. 1, the microcomputer 100 according to the present embodiment is a so-called one-chip microcomputer that realizes various functions such as a CPU and a ROM on one semiconductor substrate made of silicon. Like the above-described conventional microcomputer, the microcomputer 100 includes a CPU 110 including an instruction register (hereinafter, also simply referred to as IR) 111 and a program counter (hereinafter, also simply referred to as PC) 112, and a mask ROM 120. (See FIG. 2). The mask ROM 120 has a storage capacity of 256 words, and stores instruction data (AAAAA, BBBB, CCCC, and CCAA in FIG. 2) in an area specified by each instruction address (0, 1, 2, 3,... In FIG. 2). DDDD,...) Are stored. A predetermined result is obtained by reading the specific instruction data SID specified by the specific instruction address SIA indicated by the PC 112 into the IR 111 among the sequences of the instruction data forming the program and executing it by the CPU 110. When the branch instruction is not executed, the PC 112 usually increments the value of the specific instruction address SIA by one for each cycle of the clock signal. Therefore, the specific instruction address SIA is normally counted up by one for each cycle of the clock signal.
[0048]
The microcomputer 100 further includes an instruction addition register 130, an additional address comparison circuit 140, and an instruction selector 150 that are used to add instruction data to an instruction data string (program) stored in the mask ROM 120. The instruction addition register 130 is actually composed of 16 instruction addition registers 131, 132, 133,... Each of the instruction addition registers 131 and the like has an additional address storage unit 131A, 132A,... For storing an additional address (for example, “3”) for specifying a position to add instruction data by an external write process. And additional data storage units 131D, 132D,... For storing additional data (eg, “XXXX”) which is instruction data to be added. (Address pairs).
Further, the instruction selector 150 is interposed between the mask ROM 120 and the instruction addition register 130 and the IR 111 of the CPU 110. The instruction selector 150 includes the specific instruction data SID specified by the specific instruction address SIA indicated by the PC 112 and the additional data stored in the additional data storage unit 131D such as the instruction additional register 131 selected as described later. 131D and the like are input.
[0049]
On the other hand, the additional address comparison circuit 140 compares the specific instruction address SIA indicated by the PC 112 with the additional address stored in the additional data storage unit 131D and the like and selected as described later.
Here, when the specific instruction address SIA matches the additional address stored in the additional address storage unit 131A or the like, the PC update stop signal to be output is set to the high level for one cycle of the clock signal, thereby making this high level. The update of the specific instruction address SIA in the PC 112 is stopped only once during the level setting period. Therefore, the value of the specific instruction address SIA indicated by the PC 112 does not change for one time. Further, in this case, the instruction selector 150 sets the additional data select signal to the high level for one cycle later than the PC update stop signal by one cycle, so that the instruction selector 150 shifts the input additional data 131D and the like to the IR 111 this time. Output to
[0050]
The microcomputer 100 further includes an instruction deletion register 160 and a deletion address comparison circuit 170 that are used to delete a part of the instruction data in the instruction data string (program) stored in the mask ROM 120. The instruction deletion register 160 actually includes eight deletion addition registers 161, 162, 163,... Each of the instruction deletion registers 161 and the like can store deletion addresses 161A, 162A,... That specify a position where instruction data is deleted by an external writing process. The deletion address comparison circuit 170 compares the specific instruction address SIA indicated by the PC 112 with the deletion address stored in the deletion register 161 or the like.
Here, when the specific instruction address SIA matches the delete address stored in the delete address 161 or the like, the output delete signal is set to the high level for one cycle of the clock signal, and this high level During this period, the specific instruction address SIA in the PC 112 is incremented by +2 only once. That is, the value of the specific instruction address SIA is changed by the amount of the update performed twice.
[0051]
Next, a case where instruction data is added using the microcomputer 100 will be described. First, FIG. 3 shows a case where one additional data “XXXX” is added and executed between the third “CCCC” and the fourth “DDDD” in the instruction data string stored in the ROM 120. Will be explained.
In the instruction addition register 131, it is assumed that “3” is stored as an additional address in the additional address storage unit 131A, and “XXXX” is stored as additional data in the additional data storage unit 131D.
First, since a PC update stop signal to be described later is at a low level, the value of the specific instruction address SIA indicated by the PC 112 is incremented according to the rising timing of the clock signal, and the value is set to “0”, “1”, “2”. And so on. Then, according to this, the specific instruction data SID specified by the specific instruction data SIA is output from the mask ROM 120 in the order of “AAAAA”, “BBBB”, “CCCC” with a delay of one cycle by the clock signal, It is input to the instruction selector 150.
If the specific instruction address SIA is not “3”, such as “0”, “1”, “2”, the additional data select signal is also set to the low level. SIA is selected and output as it is. Then, in the next cycle (the next rising timing of the clock signal), the data is read into the IR 111 and thereafter executed by the CPU 110.
[0052]
However, when the specific instruction address SIA indicated by the PC 112 becomes “3” (SIA = 3) (fourth clock in FIG. 3), the specific instruction address SIA input to the additional address comparison circuit 140 and the instruction addition The additional address stored in the additional address storage unit 131A of the register 131 matches. Then, the additional address comparison circuit 140 sets the PC update stop signal to the high level for one cycle of the clock signal. Thus, the increment in the PC 112 is stopped, and the specific instruction address SIA in the next cycle (the fifth clock in FIG. 3) remains at “3”. Therefore, the specific command data SID read from the ROM 120 becomes “DDDD” twice in succession.
When the PC update stop signal returns to the low level, the update in the PC 112 is restarted, and the specific instruction address SIA changes to “4”, “5”, “6”.
[0053]
Further, the additional address comparison circuit 140 sets the additional data select signal to the high level for one cycle, one cycle later than the PC update stop signal. Thus, the instruction selector 150 selects and outputs the content “XXXX” stored in the additional data storage unit 131A for this period. Therefore, as shown in FIG. 3, when looking at the contents of the instruction selector output, "XXXX" follows "CCCC". Next, the signal is read into the IR 111 at the next rising timing of the clock signal (the sixth clock in FIG. 3), and is thereafter executed by the CPU 110.
Further, when the additional data select signal returns to the low level, the instruction selector 150 selects and outputs the content “DDDD” of the specific instruction data SID specified by the specific instruction address SIA = 3. Therefore, as shown in FIG. 3, looking at the contents of the instruction selector output, “XXXX” is followed by “DDDD”. Next, the signal is read by the IR 111 at the next rising timing of the clock signal (the seventh clock in FIG. 3), and is thereafter executed by the CPU 110.
Thus, "XXXX" is added between the third "CCCC" and the fourth "DDDD" in the instruction data string stored in the ROM 120, and the instruction can be executed.
[0054]
Next, two additional data “XXXX” and “YYYY” are successively added and executed between the third “CCCC” and the fourth “DDDD” in the instruction data sequence stored in the ROM 120. The case in which this is performed will be described with reference to FIG.
In the instruction addition register 131, it is assumed that “3” is stored as an additional address in the additional address storage unit 131A, and “XXXX” is stored as additional data in the additional data storage unit 131D. Further, in the instruction addition register 132, it is assumed that “3” is stored as an additional address in the additional address storage unit 132A and “YYYY” is stored as additional data in the additional data storage unit 131D.
Initially, the PC update stop signal is at a low level, so the value of the specific instruction address SIA indicated by the PC 112 is incremented in accordance with the rising timing of the clock signal, and sequentially becomes "0", "1", "2", and the like. Change. Then, the specific instruction data SID is sequentially output from the mask ROM 120 one cycle later, such as “AAAAA”, “BBBB”, “CCCC”, and input to the instruction selector 150.
When the specific instruction address SIA is not “3”, the additional data select signal is also set to low level, so that the specific instruction data SIA is selected from the instruction selector 150 and output as it is. Then, the data is read into the IR 111 in the next cycle, and is thereafter executed by the CPU 110.
[0055]
However, when the specific instruction address SIA indicated by the PC 112 becomes “3” (SIA = 3) (fourth clock in FIG. 4), the specific instruction address SIA and the additional address stored in the additional address storage unit 131A are stored. Matches. Therefore, the additional address comparison circuit 140 sets the PC update stop signal to the high level for one cycle of the clock signal. Then, the increment in the PC 112 is stopped, and the specific instruction address SIA in the next cycle (the fifth clock in FIG. 4) remains “3”. Then, at the fifth clock in FIG. 4, the specific instruction address SIA matches the additional address stored in the additional address storage unit 132A. Therefore, the additional address comparison circuit 140 sets the PC update stop signal to the high level for one cycle. Thus, the specific command data SID read from the ROM 120 becomes "DDDD" three times in a row.
After that, when the PC update stop signal returns to the low level, the update in the PC 112 is restarted, and the specific instruction address SIA changes to “4”, “5”, “6”.
[0056]
Further, the additional address comparison circuit 140 sets the additional data select signal to high level one cycle later than the PC update stop signal. Thus, the instruction selector 150 selects and outputs the content “XXXX” of the additional data stored in the additional data storage unit 131D for this period. Accordingly, as shown in FIG. 4, when looking at the contents of the instruction selector output, "XXXX" follows "CCCC". Next, the signal is read by the IR 111 at the next rising timing of the clock signal (the sixth clock in FIG. 4) and thereafter executed by the CPU 110.
Further, as described above, the specific instruction address SIA matches the additional data stored in the additional address storage unit 131A, and subsequently matches the additional data stored in the additional address storage unit 132A, so that two consecutive times are obtained. And matched. Therefore, the additional address comparison circuit 140 sets the additional data select signal to the high level continuously for two cycles. Accordingly, the instruction selector 150 further selects and outputs the content “YYYY” of the additional data stored in the additional data storage unit 132D. Therefore, as shown in FIG. 4, when looking at the contents of the instruction selector output, "CCXXX" is followed by "XXXX" and further "YYYY". Next, the signal is read by the IR 111 at the next rising timing of the clock signal (the seventh clock in FIG. 4) and thereafter executed by the CPU 110.
[0057]
Further, when the additional data select signal returns to the low level, the instruction selector 150 selects and outputs the content “DDDD” of the specific instruction data SID specified by the specific instruction address SIA = 3. Therefore, as shown in FIG. 4, when looking at the contents of the instruction selector output, “DDDD” follows “YYYY”. Next, the signal is read into the IR 111 at the next rising timing of the clock signal (the eighth clock in FIG. 4), and is thereafter executed by the CPU 110.
Thus, “XXXX” and “YYYY” were continuously added and executed between the third “CCCC” and the fourth “DDDD” in the instruction data string stored in the ROM 120. Will be.
[0058]
In addition, in the above-described addition of the additional data in the present embodiment, when the specific instruction address SIA matches the additional address stored in the additional address 131A or the like, the additional address comparison circuit 140 outputs a PC update stop signal, and the PC 112 The update of the specific instruction address SIA has been stopped. Therefore, for example, in the example shown in FIG. 4, the specific instruction address SIA = 3 at the fifth and sixth clocks as well as at the fourth clock in FIG. Therefore, if the content of the additional address storage unit 131A, which has already been determined to match the specific instruction address SIA at the fourth clock, is also input to the additional address comparison circuit 140 at the fifth clock, the additional data There is a possibility that “XXXX”, which is the content of the storage unit 131D, may be redundantly added.
[0059]
Thus, in the present embodiment, as described below, all the additional data forming a data-address pair with the additional address that matches the specific instruction address SIA is output to the IR 111 through the instruction selector 150 without duplication. Specifically, by using the pointer 190 and the additional address selection means 180 (see FIG. 5), the update of the PC 112 is instructed to stop and restart, and the additional address stored in the additional address storage unit 131A or the like is specified. The additional address storage unit 131A or the like in which an additional address matching the instruction address SIA is stored is sequentially designated. Then, the additional data stored in the designated additional data storage unit 131D or the like is output to the IR 111 through the instruction selector 150 without duplication. The duplicate output prevention means is constituted by the pointer control means 188 and the pointer 190 of the additional address selection means 180. The circuit 181 and the circuit 186 implement the operation of the PC update stop signal in the additional address comparison circuit 140.
[0060]
First, in the present example, as shown in FIG. 5A, among the instruction addition registers 130, the additional address storage units 131A, 132A and the like and the additional data storage units 131D, 132D and the like of each of the instruction addition registers 131, 132. Is stored with an additional address and additional data. It is assumed that a common value of “3” is stored in the additional address storage units 131A and 132A of the instruction additional registers 131 and 132. The instruction addition registers 131, 132,... Are assigned unique numbers, and the smaller the number is, the higher (higher) the instruction addition register is in the search order. In this example, it is assumed that 0 is assigned to the instruction addition register 131, 1 is assigned to the instruction addition register 132, 2 is assigned to the instruction addition register 133, and so on.
[0061]
The pointer P is a variable that indicates an additional address that forms a data-address pair with additional data to be read from the plurality of instruction additional registers 131 and the like (the additional data storage unit 131D and the like). To be more specific, the pointer P indicates a plurality of additional addresses stored in each of the additional address storage units 131D and the like in order from the additional address stored in the instruction additional register having a higher search order, that is, as shown in FIG. As shown by the arrow in the parentheses, the unique number of the instruction addition register is searched in ascending order. If there is an additional address that matches the specific instruction address SIA indicated by the PC 112, the pointer P points to the instruction additional register (additional address storage unit) storing the first searched additional address. The pointer is designated by the unique number, such as P = 3.
[0062]
Each of the circuits 181 to 187 in the additional address selecting means 180 (see FIG. 5B) is composed of a logic circuit configured to end from the start to the end within one cycle of the clock signal. It is assumed that the initial value of the pointer P when the microcomputer 100 is powered on and starts operating is P = 0.
When the clock signal rises, the circuit 181 instructs the PC 112 to update (restart the update). Specifically, the PC update stop signal is set to low level.
The circuit 182 determines whether or not the additional address stored in the additional address storage unit 131A or the like of the instruction additional register 131 or the like indicated by the value (unique number) indicated by the pointer P matches the specific instruction address SIA. I do.
[0063]
If No, that is, if the additional address stored in the additional address storage unit 131A or the like specified by the pointer P does not match the specific instruction address SIA, the value of the pointer P is incremented by one in the circuit 183. In other words, the instruction addition register 131 and the like indicated by the pointer P are switched to the next instruction addition register in the search order.
Further, the circuit 184 determines whether or not the pointer P has reached an upper limit value, that is, a value that cannot be further incremented. If No, that is, if the pointer P can still be incremented, the process returns to the determination of the circuit 182. On the other hand, if Yes, that is, if the pointer P is at the upper limit, the circuit 185 sets the pointer P to 0, and ends the processing. In this case, in the next cycle, the search is performed from the instruction addition register 131 whose search order is the top.
[0064]
On the other hand, in the circuit 182, when the Yes, that is, the additional address stored in the additional address storage unit 131A or the like designated by the pointer P matches the specific instruction address SIA, the circuit 186 instructs the PC 112 to stop updating in the PC 112. I do. Specifically, the PC update stop signal is set to a high level. The PC update stop signal is previously set to the low level in the circuit 181. However, as described above, each of the circuits 181 to 187 is configured to end from the start to the end within one cycle of the clock signal. Therefore, the update stop of the PC 112 in the next cycle is not affected at all.
Further, the circuit 187 increments the pointer P = P + 1, that is, by one, and ends the processing. In this case, in the next cycle, the search is performed from the instruction addition register of the next search order when viewed from the instruction addition register indicated by the current pointer P.
[0065]
A specific description will be given using the contents of the instruction addition register 131 and the like. It is assumed that the pointer P has an initial value P = 0. The circuit 181 sets the PC update stop signal to low level. Since P = 0, the circuit 182 compares the additional address “3” stored in the additional address storage unit 131A of the instruction additional register 131 with the current specific instruction address SIA (= 0). Since they do not match, the process proceeds to the circuit 183, where the pointer P is incremented to P = 1. Next, when the circuit 184 determines that the pointer P is not at the upper limit value (for example, 15), the process returns to the circuit 182.
In the circuit 182, since P = 1, the additional address “3” stored in the additional address storage unit 132A of the instruction additional register 132 is compared with the current specific instruction address SIA (= 0). Here again, since they do not match, the process proceeds to the circuit 183, where the pointer P is incremented. In this way, the processing of the circuits 182, 183, and 184 is repeated until the circuit 184 determines that the pointer P is at the upper limit. When the pointer P finally reaches 15 (upper limit value), the process proceeds to the circuit 185, where the pointer P is returned to P = 0 and the processing ends. Thus, in this cycle, the PC update stop signal is kept at the low level, and the value of the specific instruction address SIA is updated next time.
[0066]
In the next cycle, the specific instruction address SIA indicated in the PC 112 is updated so that SIA = 1. In this state, the processing by the additional address selecting means 180 is started again. First, the PC 181 sets the PC update stop signal to low level. Since P = 0, the circuit 182 compares the additional address “3” stored in the additional address storage unit 131A with the current specific instruction address SIA (= 1). Since they do not match, the process proceeds to the circuit 183, where the pointer P is incremented to P = 2. Thereafter, in the same manner as described above, the circuit circulates between the circuits 182, 183, and 184, and when the circuit 184 determines that the pointer P is at the upper limit value, the process proceeds to the circuit 185, where the pointer P is returned to P = 0. To end. Thus, also in this period, the PC update stop signal is kept at the low level, and the value of the specific instruction address SIA is updated again next time.
In the next cycle, the specific instruction address SIA indicated in the PC 112 is updated to SIA = 2, but does not match the additional address stored in each of the additional address storage units 131A and the like. Is returned to P = 0 and the processing ends, and the value of the specific instruction address SIA is updated next time.
[0067]
However, in the fourth cycle, the specific instruction address SIA indicated in the PC 112 is updated to SIA = 3. In this state, the processing by the additional address selecting means 180 is started again. First, the PC 181 sets the PC update stop signal to low level. Since P = 0, the circuit 182 compares the additional address “3” stored in the additional address storage unit 131A with the current specific instruction address SIA (= 3). Since they match, the process proceeds to the circuit 186, where the PC update stop signal is set to the high level. Further, the processing proceeds to the circuit 187, where the pointer P is incremented, and the processing is terminated with P = 1. Thus, in this cycle, the PC update stop signal is set to the high level, so that the PC 112 does not update the value of the specific instruction address SIA in the next cycle (fifth cycle). That is, SIA = 1 remains.
In this cycle, the PC update stop signal is temporarily set to the low level and then to the high level. However, it has already been described that the update stop of the PC 112 in the next cycle is not affected at all.
Further, since the additional address “3” stored in the additional address storage unit 131A in this cycle matches the current specific instruction address SIA (= 3), it is not shown in FIG. As described with reference to FIG. 4, the instruction selector 150 goes high one cycle later, the content "XXXX" of the additional data stored in the additional data storage unit 131D is output, and further read into the IR 111. Be executed.
[0068]
Next, in the fifth cycle, the specific instruction address SIA indicated in the PC 112 is not updated, and SIA = 3 is maintained. In this state, the processing by the additional address selection means 180 is started again, and the PC update stop signal is set to the low level in the circuit 181. Since P = 1, the circuit 182 compares the additional address “3” stored in the additional address storage unit 132A with the current specific instruction address SIA (= 3). Since they match again, the process proceeds to the circuit 186, where the PC update stop signal is set to the high level. Further, the processing proceeds to the circuit 187, where the pointer P is incremented, and the processing is terminated with P = 2. Thus, the PC update stop signal is set to the high level also in this cycle, so that the PC 112 does not update the value of the specific instruction address SIA in the next cycle (sixth cycle). That is, SIA = 3 remains.
Since the additional address “3” stored in the additional address storage unit 132A matches the current specific instruction address SIA (= 3), the content “YYYY” of the additional data stored in the additional data storage unit 132D. Is added and executed.
[0069]
Further, in the sixth period, SIA = 3 remains as described above. In this state, the processing by the additional address selecting means 180 is started again. First, the PC 181 sets the PC update stop signal to low level. Since P = 2, the circuit 182 compares the additional address “6” stored in the additional address storage unit 133A with the current specific instruction address SIA (= 3). Since they do not match, the process proceeds to the circuit 183, where the pointer P is incremented to P = 3. Next, when the circuit 184 determines that the pointer P is not the upper limit value, the process returns to the circuit 182. Since there is no additional address storage unit whose content of the additional address is "3", the circuit circulates between the circuits 182, 183, and 184, and when the circuit 184 determines that the pointer P is the upper limit value, the circuit Proceeding to 185, the pointer P returns to P = 0 and ends. Thus, in this cycle, the PC update stop signal is kept at the low level, and the value of the specific instruction address SIA is updated next time, and SIA = 4.
Since the additional address “6” stored in the additional address storage unit 133A does not match the current specific instruction address SIA (= 3), the specific instruction data specified by the specific instruction address SIA = 3 as usual. Is selected by the instruction selector 150.
[0070]
As described above, by using the pointer P and the additional address selection unit 180 (pointer control unit 188), additional data can be sequentially added to the instruction data sequence without duplication.
It should be noted that there is a loop portion that is repeatedly executed in a program, and there is a case where additional data is desired to be added in this loop. In this case, it is necessary to add additional data every time the loop is executed. When the pointer P and the additional address selecting means 180 are used, when the pointer P does not point to an additional address that matches the specific instruction address SIA, that is, the additional address storage unit 131A such as the instruction additional register 131 For example, when an additional address that matches the specific instruction address SIA is not stored, the circuit 185 sets P = 0. Therefore, the next time the additional address is searched for a match from the beginning of the search order, there is an advantage that additional data can be appropriately added repeatedly each time the loop is executed.
[0071]
Next, a case where instruction data is deleted using the microcomputer 100 will be described. A case where the instruction data “DDDD” corresponding to the instruction address “3” is deleted from the instruction data string stored in the ROM 120 and executed is described with reference to FIG.
It is assumed that “2” is stored in the instruction deletion register 161 as a deletion address. Further, the instruction selector 150 is unnecessary when deleting instruction data. Therefore, it is assumed that the additional data select signal is at a low level.
First, since the PC update stop signal is at the low level, the value of the specific instruction address SIA indicated by the PC 112 is incremented according to the rising timing of the clock signal, and the value changes in order of “0”, “1”. I do. Then, according to this, the specific instruction data SID specified by the specific instruction data SIA is output from the mask ROM 120 in order of “AAAAA”, “BBBB” with a delay of one cycle with the clock signal, and is output to the instruction selector 150. Is entered.
Since the additional data select signal is at the low level, the specific command data SID input to the command selector 150 is output as it is, and is read into the IR 111 in the next cycle (next rising timing of the clock signal). It is executed by the CPU 110.
[0072]
Thereafter (the third clock in FIG. 6), the specific instruction address SIA indicated by the PC 112 is updated to “2” (SIA = 2). Then, the specific command data “CCCC” specified by the specific command data SID = 2 is read from the ROM 120. Further, at this time, the specific instruction address SIA input to the deletion address comparison circuit 170 matches the deletion address stored in the instruction deletion register 131. Then, the deletion address comparison circuit 170 sets the deletion signal to the high level for one cycle of the clock signal. As a result, the increment in the PC 112 is performed twice, that is, SIA = SIA + 2 = 4.
[0073]
Then, since the specific instruction address SIA in the next cycle (the fourth clock in FIG. 6) is “4”, the specific instruction data SID read from the ROM 120 is “EEEE”. In addition, since the specific instruction address SIA does not match the deletion address stored in the instruction deletion register 161, the deletion address comparison circuit 170 returns the deletion signal to a low level. As a result, in the PC 112, the increment is performed only once as usual, that is, SIA = SIA + 1 = 5. Thus, the specific instruction data SID read into the IR 111 is in the order of “CCCC”, “EEEE”, “FFFF”,..., And is executed with the instruction data “DDDD” corresponding to the instruction address “3” deleted. .
In the above example, an example using only the instruction deletion register 161 has been described. However, it is apparent that a plurality of deletion instruction registers 161, 162... May be provided as shown in FIG.
[0074]
(Modification 1)
Next, a modification of the above embodiment will be described with reference to FIG. In the above embodiment, by using the pointer P and the additional address selection means 180 (pointer control means 188), additional data stored in the same additional data storage unit 131D or the like is prevented from being redundantly added. On the other hand, in the first modification, the instruction additional register 131 and the like include a flag bit 131F and the like in addition to the additional address storage unit 131A and the additional data storage unit 131D and the like. The difference is that a pointer P and an additional address selection means 280 are used. Therefore, the following description focuses on portions that are different from the above-described embodiment, and description of similar portions is simplified or omitted.
As shown in FIG. 7A, as described above, the instruction addition register 130 includes a flag bit 131F in addition to the additional address storage unit 131A and the additional data storage unit 131D in each instruction addition register 131 and the like.
Also, as in the embodiment, the instruction addition registers 131, 132,... Are assigned unique numbers (0, 1, 2,...). It is. The pointer P searches the additional addresses stored in the instruction additional registers 131 and the like in ascending order of the unique numbers as indicated by arrows in accordance with the search order, and reads out the plurality of instruction additional registers 131 and the like. Indicates the instruction additional register in which additional data to be stored is stored. Further, the additional address selecting means 280 is configured to end from the start to the end within one cycle of the clock signal.
[0075]
The additional address selection means 280 will be described (see FIG. 7B).
When the clock signal rises, the circuit 281 sets the pointer P to P = 0. Next, the circuit 282 instructs the PC 112 to update (restart the update). Specifically, the PC update stop signal is set to low level.
The circuit 283 determines whether or not the flag value FLG (P) = 0 in the flag bit 131F of the instruction addition register 131 and the like indicated by the value (unique number) indicated by the pointer P. Here, when No, that is, when the flag value FLG (P) = 1 in the flag bit 131F or the like designated by the pointer P, the flow proceeds to the circuit 285. On the other hand, when the value of the flag designated by the pointer P is FLG (P) = 0, the flow proceeds to the circuit 284.
[0076]
The circuit 284 determines whether the additional address stored in the additional address storage unit 131A or the like indicated by the value (unique number) indicated by the pointer P matches the specific instruction address SIA.
Here, if No, that is, if the additional address stored in the additional address storage section 131A or the like designated by the pointer P does not match the specific instruction address SIA, the flow proceeds to the circuit 285. On the other hand, when the additional address stored in the additional address storage unit 131A or the like designated by the pointer P matches the specific instruction address SIA, the flow proceeds to the circuit 286.
[0077]
The circuit 285 increments the value of the pointer P by one. That is, the data-address pair indicated by the pointer P, that is, the instruction additional register 131 storing the data-address pair is switched to the next instruction additional register in the search order.
Further, the circuit 286 determines whether or not the pointer P has reached an upper limit value, that is, a value that cannot be further incremented. If No, that is, if the pointer P can still be incremented, the process returns to the determination of the circuits 283 and 284. On the other hand, if Yes, that is, if the pointer P is at the upper limit value, the process ends.
[0078]
On the other hand, the circuit 287 instructs the PC 112 to stop updating. Specifically, the PC update stop signal is set to a high level. Note that even if the PC update stop signal is previously set to the low level in the circuit 282 and then the PC update stop signal is set to the high level in the circuit 287, the update stop of the PC 112 in the next cycle is not affected.
Further, since the additional address stored in the additional address storage unit 131A or the like matches the specific instruction address SIA, as described with reference to FIGS. Thus, the contents of the additional data stored in the additional data storage unit 131D and the like are added and executed later.
[0079]
Subsequently, the circuit 288 rewrites the flag value FLG (P) in the flag bit 131F or the like designated by the pointer P to FLG (P) = 1, and ends the processing. As described above, when the value FLG of the flag bit of a certain additional instruction register is rewritten to 1, even if the pointer P points to this additional instruction register thereafter, the circuit 283 always determines No. It does not pass through 287 and 288. Therefore, by setting the value of the flag bit to 1, no additional data is used from the instruction additional register in which the additional data that has already been added is stored, and the additional data is sequentially stored in the instruction data string without duplication. Can be added.
[0080]
(Modification 2)
In the above-described embodiment and Modification 1, the microcomputer 100 is used to add additional data to a part of the instruction data string stored in the mask ROM 120 or delete some instruction data. However, there may be a case where a program (instruction data sequence) having a size slightly exceeding the storage capacity of the mask ROM 120 is to be stored and executed. In such a case, the program (instruction data string) can be stored and executed by making the configuration shown in FIG. 8 without changing the design such as increasing the storage capacity of the ROM.
[0081]
The microcomputer 100 is assumed to have a mask ROM 120 having a storage capacity of 256 words and four instruction additional registers 131 to 134 as the instruction additional register 130. Originally, the entire program (instruction data sequence) should be stored in the mask ROM 120. However, it is assumed that the size of the program is unavoidable and the size of the program becomes 260 words.
In this case, as shown in FIG. 8, the first 255 words of instruction data (“AAAAA” to “UUUU”) are stored in advance in the mask ROM 120, and the last instruction data (“ZZZZ” is stored in the instruction address 255. ") Is stored. Further, externally, additional data and additional addresses for the remaining four words (the 256th, 257th, 258th, and 259th words from the beginning of the program) are stored in the four instruction addition registers 131 to 134, respectively. Write. Specifically, "255" which is the last instruction address of the ROM 120 is stored in the additional address storage units 131A to 134A as a common additional address, and the instruction of the remaining four words is stored in the additional data storage units 131D to 134D. Data (“VVVV”, “WWWW”, “XXXX”, “YYYY”) is stored.
[0082]
In this way, when the program proceeds and the specific instruction address SIA indicated by the PC 112 becomes 255, four instruction data “VVVV”, “WWWW”, “XXXX”, and “YYYY” are sequentially added. Then, “ZZZZ” stored in the last instruction address 255 of the ROM 120 can be executed. Thus, according to the microcomputer 100, four instruction additional registers 131 to 134 are formed, and additional data and additional addresses for four words are externally stored later, so that the mask ROM 120 having a storage capacity of 256 words is provided. And a program having a size of 260 words can be executed.
[0083]
In the above, the present invention has been described with reference to the embodiment and Modifications 1 and 2. However, the present invention is not limited to the above-described embodiment and the like, and may be appropriately modified and applied without departing from the gist thereof. It goes without saying that you can do it.
For example, in the above-described embodiment (see FIG. 3), when the specific instruction address SIA matches the additional address 131A or the like, the PC update stop signal is set to the high level for one cycle and delayed by one cycle. Thus, the additional data select signal is set to the high level for one cycle. Therefore, for example, when “3” is stored in the additional address 131A, the additional data “XXXX” is added before the instruction data “DDDD” stored in the ROM 120 at the instruction address = 3. However, the additional data select signal can be made high level two cycles later than the PC update stop signal. Then, as shown in parentheses in FIG. 3, additional data “XXXX” can be added after the instruction data “DDDD”. Further, as shown in parentheses in FIG. 4, additional data “XXXX” and “YYYY” can be added after the instruction data “DDDD”.
[0084]
(Appendix 1)
A memory in which a sequence of instruction data is stored;
An instruction register; and
A program counter indicating a specific instruction address at which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
A CPU,
An additional instruction that is writable from the outside and is configured to be able to store at least one data-address pair consisting of additional instruction data to be added to the instruction data string and an additional address indicating a position to add the additional instruction data. Storage means;
First comparing means for comparing the specific instruction address indicated by the program counter with the additional address stored in the additional instruction storage means;
Selecting means for selecting any of the specific instruction data and the additional instruction data and outputting the selected instruction data to the instruction register;
A computer comprising:
In the first comparing means,
When the specific instruction address and the additional address do not match,
The selecting means selects the specific instruction data and outputs the selected instruction data to the instruction register,
When the specific instruction address and the additional address match,
The program counter stops updating the specific instruction address,
The selection means may be any one of the specific instruction data and the additional instruction data stored in the additional instruction storage means, the additional instruction data being an additional address matching the specific instruction address and the data-address pair. Select one of them first and output it to the instruction register, then select the other and output it
calculator.
(Appendix 2)
The computer according to Supplementary Note 1, wherein
Duplicate output prevention means for outputting additional instruction data forming a data-address pair with an additional address matching the specific instruction address without duplication to the instruction register
Calculator equipped with.
(Appendix 3)
The computer according to Supplementary Note 2, wherein
The duplicate output prevention means,
A pointer indicating the additional address forming the data-address pair with the additional instruction data to be read from the additional instruction storage means,
The plurality of additional addresses stored in the additional instruction storage means are searched in a predetermined search order, and among the additional addresses matching the specific instruction address indicated by the program counter, the first searched additional address is determined. A pointer to indicate,
When the pointer has not pointed to an additional address that matches the specific instruction address, the next time the search is performed for the additional address in order from the top of the predetermined search order,
When the pointer points to an additional address that matches the specific instruction address, the next time in the predetermined order, the additional address in the next or subsequent search order as viewed from the additional address currently pointed to by the pointer is Make search
Search start position changing means.
calculator.
(Appendix 4)
The computer according to Supplementary Note 2, wherein
The duplicate output prevention means,
An output storage unit associated with each of the plurality of stored data-address pairs on a one-to-one basis;
When the additional instruction data belonging to the data-address pair is output to the instruction register, output-completed recording means for recording output-completed data indicating that output has been completed in the corresponding output-complete storage unit;
Output inhibiting means for inhibiting output of the additional instruction data belonging to the data-address pair associated with the output-completed storage unit storing the output-completed data to the instruction register.
calculator.
(Appendix 5)
The computer according to any one of Supplementary Notes 1 to 4, wherein
The first comparing means includes:
When the specific instruction address indicated by the program counter matches the additional address stored in the additional instruction storage means,
Halt the next update of the specific instruction address in the program counter
calculator.
(Appendix 6)
The computer according to any one of Supplementary Notes 1 to 5, wherein
The additional instruction storage means is one or more additional registers.
calculator.
(Appendix 7)
The computer according to Supplementary Note 6, wherein
A data amount of the instruction data string stored in the memory;
A data amount of the additional instruction data stored in the additional register;
Is greater than the storage capacity of the memory.
calculator.
(Appendix 8)
The computer according to any one of Supplementary Notes 1 to 5, wherein
Deletion position storage means which is writable from the outside and is configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence;
A second comparing unit that compares the specific instruction address indicated by the program counter with the deletion address stored in the deletion position storage unit,
The second comparing means includes:
When the specific instruction address matches the deletion address, the value of the specific instruction address in the program counter is updated twice.
calculator.
(Appendix 9)
An integrated circuit device, wherein the computer according to any one of Supplementary Notes 1 to 8 is realized on one integrated circuit chip.
(Appendix 10)
A memory in which a sequence of instruction data is stored;
An instruction register; and
A program counter indicating a specific instruction address at which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
A CPU,
Deletion position storage means which is writable from the outside and is configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence;
Second comparing means for comparing the specific instruction address indicated by the program counter with the deletion address stored in the deletion position storage means,
The second comparing means includes:
When the specific instruction address matches the deletion address, the value of the specific instruction address in the program counter is updated twice.
calculator.
(Appendix 11)
The computer according to Supplementary Note 9, wherein
The deletion position storage means is a deletion register.
calculator.
(Appendix 12)
An integrated circuit device in which the computer according to Supplementary Note 10 or 11 is realized on one integrated circuit chip.
(Appendix 13)
A memory in which a sequence of instruction data is stored;
An instruction register; and
A program counter indicating a specific instruction address at which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
A CPU,
An additional instruction that is writable from the outside and is configured to be able to store at least one data-address pair consisting of additional instruction data to be added to the instruction data string and an additional address indicating a position to add the additional instruction data. Storage means;
An instruction execution method in a computer comprising:
Comparing the specific instruction address indicated by the program counter with the additional address stored in the additional instruction storage means,
When the specific instruction address and the additional address do not match,
Outputting the specific instruction data to the instruction register, executing the specific instruction data on the CPU,
When the specific instruction address and the additional address match,
Stop updating the specific instruction address in the program counter,
One of the specific instruction data and the additional instruction data stored in the additional instruction storage means, the additional address coinciding with the specific instruction address, and the additional instruction data forming the data-address pair are stored first. To the instruction register, and the other after that, the additional instruction data and the specific instruction data are executed by the CPU.
Instruction execution method in a computer.
(Appendix 14)
An instruction execution method in a computer according to supplementary note 13, wherein:
When the specific instruction address indicated by the program counter matches the additional address stored in the additional instruction storage means,
The additional instruction data forming the data-address pair with the additional address that matches the specific instruction address is output to the instruction register without duplication.
Instruction execution method in a computer.
(Appendix 15)
An instruction execution method in a computer according to supplementary note 14, wherein:
The computer is a pointer that points to additional instruction data to be read from the additional instruction storage unit and an additional address that forms the data-address pair, and stores a plurality of the additional addresses stored in the additional instruction storage unit. A search is performed in the search order, and among the additional addresses matching the specific instruction address indicated by the program counter, a pointer indicating the first searched additional address is provided.
When the pointer has not pointed to an additional address that matches the specific instruction address, the next time the search is performed for the additional address sequentially from the top of the predetermined search order,
When the pointer points to an additional address that matches the specific instruction address, the next additional search order in the next search order when viewed from the additional address pointed to by the pointer in the predetermined search order next time Do a search
Instruction execution method in a computer.
(Appendix 16)
An instruction execution method in a computer according to supplementary note 14, wherein:
The computer includes an output storage unit associated with each of the stored data-address pairs on a one-to-one basis.
When outputting the additional instruction data belonging to the data-address pair to the instruction register, recording output-completed data indicating that output has been completed in the corresponding output-complete storage unit;
After that, the output of the additional instruction data belonging to the data-address pair associated with the output storage storing the output data is prohibited to the instruction register.
Instruction execution method in a computer.
(Appendix 17)
An instruction execution method in a computer according to any one of Supplementary Notes 13 to 16, wherein
When the specific instruction address indicated by the program counter matches the additional address stored in the additional instruction storage means,
Halt the next update of the specific instruction address in the program counter
Instruction execution method in a computer.
(Appendix 18)
18. A method for executing instructions in a computer according to any one of Supplementary Notes 13 to 17, wherein
The additional instruction storage means is one or more additional registers.
Instruction execution method in a computer.
(Appendix 19)
An instruction execution method in a computer according to supplementary note 18, wherein
A data amount of the instruction data string stored in the memory;
A data amount of the additional instruction data stored in the additional register;
Is greater than the storage capacity of the memory.
Instruction execution method in a computer.
(Appendix 20)
An instruction execution method in a computer according to any one of Supplementary Notes 13 to 16, wherein
The computer further includes a deletion position storage unit configured to be writable from the outside, and configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence,
Comparing the specific instruction address indicated by the program counter with the delete address stored in the delete position storage means,
When the specific instruction address matches the delete address,
Updating the value of the specific instruction address in the program counter twice,
Then, the specific instruction data is output from the memory to the instruction register according to the updated specific instruction address indicated by the program counter, and is executed by the CPU.
An instruction execution method in a computer comprising:
(Appendix 21)
A memory in which a sequence of instruction data is stored;
An instruction register; and
A program counter indicating a specific instruction address at which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
A CPU,
Deletion position storage means which is writable from the outside and is configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence;
An instruction execution method in a computer comprising:
Comparing the specific instruction address indicated by the program counter with the delete address stored in the delete position storage means,
When the specific instruction address matches the deletion address,
Updating the value of the specific instruction address in the program counter twice,
Thereafter, the specific instruction data is output from the memory to the instruction register according to the updated specific instruction address indicated by the program counter, and is executed by the CPU.
Instruction execution method in a computer.
(Appendix 22)
A method for executing instructions in a computer according to Supplementary Note 21, wherein
The deletion position storage means is a deletion register.
Instruction execution method in a computer.
[Brief description of the drawings]
FIG. 1 is an explanatory diagram showing a one-chip microcomputer according to an embodiment;
FIG. 2 is an explanatory diagram showing transfer of instruction data between a CPU and a ROM and addition and deletion of instruction data in the microcomputer according to the embodiment;
FIG. 3 is a timing chart showing the operation of each unit when one additional instruction data is added.
FIG. 4 is a timing chart showing the operation of each unit when two additional instruction data are successively added.
FIG. 5 is an explanatory diagram showing search / selection of an instruction addition register using a pointer.
FIG. 6 is a timing chart showing the operation of each unit when one instruction data is deleted.
FIG. 7 is an explanatory diagram showing search / selection of an instruction addition register using a flag bit according to the first modification.
FIG. 8 is an explanatory diagram of a case where an instruction data string exceeding a storage capacity of a ROM is stored according to a second modification.
FIG. 9 is a conceptual diagram showing the transfer of instruction data between a CPU and a ROM in a microcomputer according to the related art.
[Explanation of symbols]
100 microcomputers (computers, integrated circuit devices)
110 CPU
111 Instruction Register (Instruction Register)
112 Program counter
120 Mask ROM (Memory)
130 Instruction additional register (additional instruction storage means, additional register)
131, 132, 133,... Instruction additional register (additional instruction storage means, additional register)
131A, 132A, 133A, ... additional address storage unit
131D, 132D, 133D, ... additional data storage unit
131F, 132F, 133F,... Flag bits (output completed storage unit)
140 Additional address comparison circuit (first comparison means)
150 Instruction selector (selection means)
160 instruction deletion register (deletion position storage means)
161, 162, 163, ... Instruction deletion register (deletion position storage means)
170 Deleted address comparison circuit (second comparison means)
180,280 additional address selection means
188 Pointer control means (search start position change means)
283 circuit (output inhibiting means)
287 circuit (output completed recording means)
SIA specific instruction address
SID specific instruction data
P pointer

Claims (10)

命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ−アドレス対を少なくとも1対以上記憶可能に構成されてなる追加命令記憶手段と、
上記プログラムカウンタの示す上記特定命令アドレスと上記追加命令記憶手段に記憶された上記追加アドレスとを比較する第1比較手段と、
上記特定命令データと上記追加命令データのいずれかを選択して、上記命令レジスタに出力する選択手段と、
を備える計算機であって、
上記第1比較手段において、
上記特定命令アドレスと上記追加アドレスとが不一致であるとき、
上記選択手段は上記特定命令データを選択して上記命令レジスタに出力し、
上記特定命令アドレスと上記追加アドレスとが一致したとき、
上記プログラムカウンタは上記特定命令アドレスの更新を停止し、
上記選択手段は上記特定命令データ、及び、上記追加命令記憶手段に記憶された追加命令データであって、上記特定命令アドレスに一致する追加アドレスと上記データ−アドレス対をなす追加命令データ、のいずれか一方を先に選択して上記命令レジスタに出力し、他方をその後に選択して出力する
計算機。
A memory in which a sequence of instruction data is stored;
An instruction register; and
A CPU having a program counter indicating a specific instruction address in which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
An additional instruction that is writable from the outside and is configured to be able to store at least one data-address pair consisting of additional instruction data to be added to the instruction data string and an additional address indicating a position to add the additional instruction data. Storage means;
First comparing means for comparing the specific instruction address indicated by the program counter with the additional address stored in the additional instruction storage means;
Selecting means for selecting any of the specific instruction data and the additional instruction data and outputting the selected instruction data to the instruction register;
A computer comprising:
In the first comparing means,
When the specific instruction address and the additional address do not match,
The selecting means selects the specific instruction data and outputs the selected instruction data to the instruction register,
When the specific instruction address and the additional address match,
The program counter stops updating the specific instruction address,
The selection means is any one of the specific instruction data and the additional instruction data stored in the additional instruction storage means, the additional instruction data being an additional address coinciding with the specific instruction address and the additional instruction data forming the data-address pair. A computer that selects one of them first and outputs it to the instruction register, and the other selects and outputs it later.
請求項1に記載の計算機であって、
前記特定命令アドレスに一致する追加アドレスとデータ−アドレス対をなす追加命令データが、前記命令レジスタに重複なく出力されるようにする重複出力防止手段
を備える計算機。
The computer according to claim 1,
A computer comprising a duplication output preventing means for outputting additional instruction data forming a data-address pair with an additional address matching the specific instruction address to the instruction register without duplication.
請求項2に記載の計算機であって、
前記重複出力防止手段は、
前記追加命令記憶手段から読み出すべき追加命令データと前記データ−アドレス対をなす前記追加アドレスを指示するポインタであって、
上記追加命令記憶手段に記憶されている複数の前記追加アドレスを所定の検索順序で検索して、前記プログラムカウンタが示す前記特定命令アドレスに一致する追加アドレスのうち、最初に検索された追加アドレスを指示するポインタと、
上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示していなかったときには、次回に上記所定の検索順序の先頭から順に上記追加アドレスについて上記検索をさせ、
上記ポインタが上記特定命令アドレスに一致する追加アドレスを指示しているときには、次回に上記所定の順序のうちポインタが現在指示している上記追加アドレスから見て次以降の検索順序の追加アドレスについて上記検索をさせる
検索開始位置変更手段と、を備える
計算機。
The computer according to claim 2, wherein
The duplicate output prevention means,
A pointer indicating the additional address forming the data-address pair with the additional instruction data to be read from the additional instruction storage means,
The plurality of additional addresses stored in the additional instruction storage means are searched in a predetermined search order, and among the additional addresses matching the specific instruction address indicated by the program counter, the first searched additional address is determined. A pointer to indicate,
When the pointer has not pointed to an additional address that matches the specific instruction address, the next time the search is performed for the additional address in order from the top of the predetermined search order,
When the pointer points to an additional address that matches the specific instruction address, the next time in the predetermined order, the additional address in the next or subsequent search order as viewed from the additional address currently pointed to by the pointer is A search start position changing means for performing a search.
請求項1〜請求項3のいずれか1項に記載の計算機であって、
前記第1比較手段は、
前記プログラムカウンタの示す前記特定命令アドレスと前記追加命令記憶手段に記憶された追加アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの次回の更新を停止させる
計算機。
A computer according to any one of claims 1 to 3, wherein
The first comparing means includes:
When the specific instruction address indicated by the program counter matches the additional address stored in the additional instruction storage means,
A computer for stopping the next update of the specific instruction address in the program counter.
請求項1〜請求項4のいずれか1項に記載の計算機であって、
前記追加命令記憶手段は、1または複数の追加用レジスタである
計算機。
A computer according to any one of claims 1 to 4, wherein
The computer in which the additional instruction storage means is one or more additional registers.
請求項5に記載の計算機であって、
前記メモリに記憶された前記命令データ列のデータ量と、
前記追加用レジスタに記憶された前記追加命令データのデータ量と、
の和が、上記メモリの記憶容量よりも大きい
計算機。
The computer according to claim 5, wherein
A data amount of the instruction data string stored in the memory;
A data amount of the additional instruction data stored in the additional register;
Is a computer whose sum is larger than the storage capacity of the memory.
請求項1〜請求項6のいずれか1項に記載の計算機を、1つの集積回路チップに実現してなる集積回路装置。An integrated circuit device comprising the computer according to any one of claims 1 to 6 implemented on one integrated circuit chip. 命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、
上記プログラムカウンタの示す上記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較する第2比較手段と、を備え、
上記第2比較手段は、
上記特定命令アドレスと上記削除アドレスとが一致したとき、上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新させる
計算機。
A memory in which a sequence of instruction data is stored;
An instruction register; and
A CPU having a program counter indicating a specific instruction address in which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
Deletion position storage means which is writable from the outside and is configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence;
Second comparing means for comparing the specific instruction address indicated by the program counter with the deletion address stored in the deletion position storage means,
The second comparing means includes:
A computer that updates the value of the specific instruction address in the program counter twice when the specific instruction address matches the deletion address.
命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ−アドレス対を少なくとも1対以上記憶可能に構成されてなる追加命令記憶手段と、
を備える計算機における命令実行方法であって、
上記プログラムカウンタの示す上記特定命令アドレスと上記追加命令記憶手段に記憶された追加アドレスとを比較し、
上記特定命令アドレスと上記追加アドレスとが不一致であるとき、
上記特定命令データを上記命令レジスタに出力して、上記特定命令データを上記CPUで実行し、
上記特定命令アドレスと上記追加アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの更新を停止し、
上記特定命令データと、上記追加命令記憶手段に記憶された追加命令データであって、上記特定命令アドレスに一致する追加アドレスと上記データ−アドレス対をなす追加命令データと、のいずれか一方を先に上記命令レジスタに出力し、他方をその後に出力して、上記追加命令データ及び上記特定命令データを上記CPUで実行する
計算機における命令実行方法。
A memory in which a sequence of instruction data is stored;
An instruction register; and
A CPU having a program counter indicating a specific instruction address in which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
An additional instruction that is writable from the outside and is configured to be able to store at least one data-address pair consisting of additional instruction data to be added to the instruction data string and an additional address indicating a position to add the additional instruction data. Storage means;
An instruction execution method in a computer comprising:
Comparing the specific instruction address indicated by the program counter with the additional address stored in the additional instruction storage means,
When the specific instruction address and the additional address do not match,
Outputting the specific instruction data to the instruction register, executing the specific instruction data on the CPU,
When the specific instruction address and the additional address match,
Stop updating the specific instruction address in the program counter,
One of the specific instruction data and the additional instruction data stored in the additional instruction storage means, the additional address coinciding with the specific instruction address, and the additional instruction data forming the data-address pair are stored first. And outputting the additional instruction data and the specific instruction data to the instruction register in the computer.
命令データ列が記憶されたメモリと、
命令レジスタ、及び、
上記メモリに記憶された命令データのうち上記命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有する
CPUと、
外部から書き込み可能で、上記命令データ列から削除する命令データの位置を示す削除アドレスを少なくとも1つ以上記憶可能に構成されてなる削除位置記憶手段と、
を備える計算機における命令実行方法であって、
上記プログラムカウンタの示す上記特定命令アドレスと上記削除位置記憶手段に記憶された上記削除アドレスとを比較し、
上記特定命令アドレスと上記削除アドレスとが一致したとき、
上記プログラムカウンタにおける上記特定命令アドレスの値を2回分更新し、
その後、上記プログラムカウンタの示す更新された特定命令アドレスに従って、上記メモリから上記特定命令データを上記命令レジスタに出力し、上記CPUで実行する
計算機における命令実行方法。
A memory in which a sequence of instruction data is stored;
An instruction register; and
A CPU having a program counter indicating a specific instruction address in which specific instruction data to be output to the instruction register among the instruction data stored in the memory is stored;
Deletion position storage means which is writable from the outside and is configured to be able to store at least one or more deletion addresses indicating positions of instruction data to be deleted from the instruction data sequence;
An instruction execution method in a computer comprising:
Comparing the specific instruction address indicated by the program counter with the delete address stored in the delete position storage means,
When the specific instruction address matches the deletion address,
Updating the value of the specific instruction address in the program counter twice,
Then, the instruction execution method in the computer which outputs the specific instruction data from the memory to the instruction register according to the updated specific instruction address indicated by the program counter, and executes the instruction in the CPU.
JP2002199577A 2002-07-09 2002-07-09 Computer, integrated circuit device and method for instruction execution in computer Pending JP2004046318A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002199577A JP2004046318A (en) 2002-07-09 2002-07-09 Computer, integrated circuit device and method for instruction execution in computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002199577A JP2004046318A (en) 2002-07-09 2002-07-09 Computer, integrated circuit device and method for instruction execution in computer

Publications (1)

Publication Number Publication Date
JP2004046318A true JP2004046318A (en) 2004-02-12

Family

ID=31706674

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002199577A Pending JP2004046318A (en) 2002-07-09 2002-07-09 Computer, integrated circuit device and method for instruction execution in computer

Country Status (1)

Country Link
JP (1) JP2004046318A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013128624A1 (en) * 2012-03-02 2013-09-06 ルネサスエレクトロニクス株式会社 Microcomputer and non-volatile semiconductor device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013128624A1 (en) * 2012-03-02 2013-09-06 ルネサスエレクトロニクス株式会社 Microcomputer and non-volatile semiconductor device
JPWO2013128624A1 (en) * 2012-03-02 2015-07-30 ルネサスエレクトロニクス株式会社 Microcomputer and nonvolatile semiconductor device

Similar Documents

Publication Publication Date Title
USRE45278E1 (en) Method and apparatus for changing microcode to be executed in a processor
US6804772B2 (en) Dynamic field patchable microarchitecture
CN109284132A (en) Improved return stack caching
JPH02140831A (en) Data processor
US7971040B2 (en) Method and device for saving and restoring a set of registers of a microprocessor in an interruptible manner
KR0184346B1 (en) Microcomputer having rom program which can be altered
JPS6044699B2 (en) Special address generator
US7051231B2 (en) Microprocessor system architecture to correct built-in ROM code
JP2005063438A (en) System for repair of rom programming errors or defects
CN116719581B (en) Chip multi-instance module initializing system
JP3725547B2 (en) Limited run branch prediction
JP2002229852A (en) Cache system control circuit
US11126435B2 (en) Branch destination prediction based on accord or discord of previous load data from a data cache line corresponding to a load instruction and present load data
JP2004046318A (en) Computer, integrated circuit device and method for instruction execution in computer
US20210232422A1 (en) Method and apparatus for predicting and scheduling copy instruction for software pipelined loops
US20170147498A1 (en) System and method for updating an instruction cache following a branch instruction in a semiconductor device
US6442058B2 (en) Control circuit and semiconductor device including same
US20100146332A1 (en) Data correction circuit and semiconductor integrated circuit
KR100355630B1 (en) Computer system having a rom correction unit
JP3462245B2 (en) Central processing unit
JP5237671B2 (en) Data processor
JP2003022182A (en) Controller
JP2008181596A (en) Semiconductor storage device
WO2013014779A1 (en) Electronic device, device access method, and program
JP7350699B2 (en) write-back cache device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050704

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080215

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080507

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080702

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20080728

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20080729