Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP3588951B2 - Microcomputer program change device - Google Patents
[go: Go Back, main page]

JP3588951B2 - Microcomputer program change device - Google Patents

Microcomputer program change device Download PDF

Info

Publication number
JP3588951B2
JP3588951B2 JP00600697A JP600697A JP3588951B2 JP 3588951 B2 JP3588951 B2 JP 3588951B2 JP 00600697 A JP00600697 A JP 00600697A JP 600697 A JP600697 A JP 600697A JP 3588951 B2 JP3588951 B2 JP 3588951B2
Authority
JP
Japan
Prior art keywords
instruction
address
program
correction
ram
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.)
Expired - Fee Related
Application number
JP00600697A
Other languages
Japanese (ja)
Other versions
JPH10207704A (en
Inventor
啓介 田中
敏道 松崎
始修 西村
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.)
Panasonic Corp
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial Co 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 Panasonic Corp, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP00600697A priority Critical patent/JP3588951B2/en
Publication of JPH10207704A publication Critical patent/JPH10207704A/en
Application granted granted Critical
Publication of JP3588951B2 publication Critical patent/JP3588951B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Description

【0001】
【発明の属する技術分野】
本発明はマイクロコンピュータに内蔵されたROMに固定記憶されたプログラムを半導体集積回路の製造後に修正し、正常に動作させる事ができるマイクロコンピュータのプログラム変更装置に関するものである。
【0002】
【従来の技術】
近年の電子機器にはその高機能化、高性能化に対応する為にマイクロコンピュータが多く利用されている。一般的にこれらのマイクロコンピュータの動作を決めるプログラムは読み出し専用メモリ(以下ROMと略す)に格納される。特に民生機器等の大量生産されるような機器に使用される場合は、その単価が安い等の理由から半導体集積回路の製造工程時にプログラムを固定設置するマスクROMが用いられる場合が多い。しかしながら前記マスクROMは製造工程時にプログラムを固定設置する為、製造後に仕様変更の発生やプログラムミスの発覚等の理由によりプログラムに修正を加えたくても不可能であり、最悪の場合は完成品を廃棄せざるをえなかった。また、プログラムに修正を加えるためには再度マイクロコンピュータを製造するしか方法が無く費用と時間を浪費すると言う問題があった。
【0003】
これらの問題を解決するために従来よりいくつかのプログラム変更装置が考案され、この装置をマイクロコンピュータに内蔵することで製造後のマイクロコンピュータに対してプログラムの修正を可能ならしめている。
【0004】
図8は従来のプログラム変更装置の第1の実施例である。
図において1はプログラムカウンタ、2はプログラムが格納されるROM、31は修正アドレスレジスタ、32は比較回路、33は修正命令レジスタ、4は選択回路、5は命令解読器である。
【0005】
通常マイクロコンピュータはプログラムカウンタ1により指し示されたROM2上の命令を順次読み出し、命令解読器5で解読後、マイクロ命令等の実行により基本動作を行う。
【0006】
本従来例のプログラム変更装置では、修正が必要な命令が格納されるアドレスを修正アドレスレジスタ31に、修正後の命令を修正命令レジスタに格納する。修正アドレスレジスタ31とプログラムカウンタ1の値は常に比較回路32により比較され、一致を検出すると選択回路4を修正命令レジスタ側に切り替え、ROMからではなく、修正命令レジスタに格納される命令コードを命令解読器へ供給する事で命令の修正を行っている。修正アドレスレジスタ31と比較回路32及び修正命令レジスタ33で構成されるプログラム変更装置3aは、一つのアドレスに格納される命令を修正する為に一組必要であり、通常は複数のアドレスの命令を修正する為に複数組のプログラム変更装置3a〜3nが実装される。
【0007】
図9は従来のプログラム変更装置の第2の実施例である。
図において1はプログラムカウンタ、2はプログラムが格納されるROM、31は修正アドレスレジスタ、32は比較回路、34は割込ベクタレジスタ、5は命令解読器、6はRAMである。
【0008】
本従来例のプログラム変更装置では、修正が必要な命令が格納されるアドレスを修正アドレスレジスタ31に、一連の修正プログラムをRAM6に、修正プログラムの開始アドレスを割込ベクタレジスタ34に格納する。修正アドレスレジスタ31とプログラムカウンタ1の値は常に比較回路32により比較され、一致を検出すると割込要求信号を発生する。CPUが割込要求信号を受理すると、現在のプログラムカウンタ値等をスタックに退避し、割込ベクタレジスタ34から割込分岐先のアドレスを読み出し、プログラムカウンタ1に設定する。この場合割込ベクタレジスタにはRAM上に格納した修正プログラムの開始番地が格納されており、割込処理プログラムとして、修正プログラムを実行することになる。
【0009】
図10は従来のプログラム変更装置の第3の実施例である。
図において1はプログラムカウンタ、2はプログラムが格納されるROM、31は修正アドレスレジスタ、32は比較回路、35は分岐アドレスレジスタ、4は選択回路、5は命令解読器、36は分岐命令発生回路である。
【0010】
本従来例のプログラム変更装置では、修正が必要な命令が格納されるアドレスを修正アドレスレジスタ31に、一連の修正プログラムをRAM6に、修正プログラムの開始アドレスを分岐アドレスレジスタ35に格納する。修正アドレスレジスタ31とプログラムカウンタ1の値は常に比較回路32により比較され、一致を検出すると選択回路4を分岐命令発生回路側に切り替え、ROMからではなく、分岐命令発生回路により生成される分岐命令コードを命令解読器へ供給する。前記分岐命令発生回路では分岐命令の命令オペレーションコードと、それに続くオペランドとして分岐アドレスレジスタに格納される値を発生する。すなわちCPUは修正プログラムの開始番地への分岐命令を解読・実行する事になり、結果として修正プログラムを実行することになる。
【0011】
【発明が解決しようとする課題】
しかしながら従来のプログラム変更装置には下記のような問題があった。
【0012】
第1の従来例では、比較回路32、修正アドレスレジスタ31、修正命令レジスタ33からなる一組のプログラム変更装置で修正可能な命令は一箇所のアドレスに対応する命令コード(例えば8ビットマイクロコンピュータでは1バイトの命令コード)のみである。プログラム変更装置と修正命令コードが1対1に対応する為、複数の命令コードを修正可能とするには複数組のプログラム変更装置を実装する必要がある。通常は8組から16組程度実装される場合が多い。一般的な8ビットマイクロコンピュータでは16ビット〜24ビット、16ビットマイクロコンピュータでは24ビット〜32ビットのアドレス線を有している。すなわち前記プログラム変更装置の比較回路及び修正アドレスレジスタはアドレス線と同じビット幅を備える必要があり、またそれらと同じ数の修正命令レジスタ(一組あたりのビット幅は一般的には8ビットマイクロコンピュータの場合は8ビット、16ビットマイクロコンピュータの場合は16ビット)が必要となり、複数組備えるとなると回路規模を増大するという問題を生じる。また逆に修正プログラムの大きさは実装されるプログラム変更装置の組数に制限されてしまうという問題もある。
【0013】
第2の従来例では、一般的な割込を用いて修正プログラムを実行させる方式である為、プログラムカウンタ1やプログラム状態語PSW(図示せず)のスタックへの退避動作を伴う。従ってその為のスタック領域の確保が必要であり、RAMを浪費するという問題がある。またスタックへの退避動作の為の時間が必要となり、実行までの時間的なロスを発生する。この事はスピードを要する処理に取っては致命的になりかねない。更に、近年のマイクロコンピュータでは処理速度の高速化の為に命令の先読みという技術を用いられることが一般的で、ROMの読み出しの為のプリフェッチアドレスと、実際にCPUが実行している命令の実行アドレスとは異なっている。その為プリフェッチアドレスと修正アドレスレジスタ31の値を比較回路32で比較して、一致した場合に割込を発生させ、修正プログラムを実行させたとしても正しくその命令を修正したこととはならないという問題を生じる。なぜなら、例えば一致を検出した時に実行中の命令が分岐命令であった場合修正アドレスレジスタで指定した命令を実行しない場合がある。従って命令先読み技術を利用したマイクロコンピュータにおいては実行アドレスとの比較が必要であるが、一般的には命令実行アドレスを保持するレジスタは実装されていない場合が多く、プログラム変更装置の為に前記実行アドレスレジスタを設けることは回路規模を増大させるという問題を生じる。
【0014】
第3の従来例では、修正アドレスレジスタ31とプログラムカウンタ1を比較回路32で比較し一致した場合に分岐命令を発生するという方式であり、特定の分岐命令を発生させる為の分岐命令発生回路36が必要となり回路規模を増大させるという問題がある。更に以下に示す問題も発生する。
【0015】
近年のマイクロコンピュータでは命令のコードサイズを縮小する為に命令コードのビット長の基本単位をROMからの読み出しビット幅よりも小さくする場合がある。図7は縮小化命令コードのフォーマットの一例を示す。例えば図は16ビットマイクロコンピュータであるとする。一般的な16ビットマイクロコンピュータでは命令コードのビット長の基本単位は16ビットとなり、命令オペレーションコードとそれに続くオペランドを合わせた命令の全ビット長は16ビットの倍数になる。また一般的な16ビットマイクロコンピュータではROMからの命令の読み出しを16ビット幅で行う為、連続する命令の境界が読み出したROMデータの中間に存在することはあり得ない。しかし縮小化命令コードのマイクロコンピュータでは図7(a)の命令nに示すように命令オペレーションコードが16ビット(M0〜M1の2バイト)で続くオペランドが24ビット(M2〜M4の3バイト)であるような場合が存在する。この場合の命令コードの全ビット長は40ビット(M0〜M4の5バイト)となり16ビット(2バイト)の整数倍にはならない。このような場合ROMからの読み出しが16ビット幅であると図7(b)に示すように読み出したROMデータの中間に連続する命令の境界が存在する場合が存在する。同様のことが8ビットマイクロコンピュータや32ビットマイクロコンピュータでも存在し得る。ROMへの命令フェッチアドレスだけを比較して命令コードを分岐命令のコードにすり替える従来の方式では、読み出しデータの中間を命令の境界として分岐命令を生成する事は不可能である。なぜなら分岐命令に同梱される修正命令直前の命令の最終コードを一意に決める事ができないからである。
【0016】
本発明は前述の課題を解決し、
(1)回路規模の増大を最小限に留め、
(2)修正プログラムの大きさの制限を緩和し、
(3)修正プログラムの実行を開始するまでの時間遅れを最小限に留め、
(4)命令先読み技術を用いたマイクロコンピュータでも修正箇所のアドレスを直接指定可能で、
(5)縮小化命令を用いたマイクロコンピュータでも修正箇所のアドレスを直接指定可能なマイクロコンピュータのプログラム変更装置を提供する事で、ROMに固定記憶された命令の修正をマイクロコンピュータの製造後に可能ならしめる事を目的とする。
【0017】
【課題を解決するための手段】
前述の課題を解決するために本発明のプログラム変更装置は、修正アドレスレジスタと比較回路と一致検出手段を備え、ROMフェッチアドレスと修正アドレスレジスタの値を比較回路で比較し、その結果を命令解読器へ送出し、命令解読器では一致検出手段にて比較回路での一致を検出するとマイクロ命令の実行によりRAM上の所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させるという構成を有している。これにより
(1)回路規模の増大を最小限に留め、
(2)修正プログラムの大きさの制限を緩和し、
(3)修正プログラムの実行を開始するまでの時間遅れを最小限に留め、
(4)命令先読み技術を用いたマイクロコンピュータでも修正箇所のアドレスを直接指定可能で、
(5)縮小化命令を用いたマイクロコンピュータでも修正箇所のアドレスを直接指定可能なマイクロコンピュータのプログラム変更装置が得られる。
【0018】
【発明の実施の形態】
本発明の請求項1に記載の発明は、修正アドレスレジスタと比較回路と一致検出手段を備え、ROMフェッチアドレスと修正アドレスレジスタの値を比較回路で比較し、その結果を命令解読器へ送出し、命令解読器では一致検出手段にて比較回路での一致を検出するとマイクロ命令の実行によりRAM上の所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させる様にしたもので、プログラム変更装置を実現する為に必要な回路規模を最小限に留めることができるという作用を有する。
【0019】
本発明の請求項2に記載の発明は、比較回路からの一致信号を命令の解読タイミングまで保持するようにしたもので、命令先読み技術を用いたマイクロコンピュータで実行アドレスと、ROM読み出しアドレスが異なる場合でも、単にROM読み出しアドレスとの比較を行うだけで、該当命令の実行時に修正が可能であるという作用を有する。
【0020】
本発明の請求項3に記載の発明は、修正アドレス記憶手段と比較回路を複数組備えたものであり、複数箇所のプログラムの修正が可能であるという作用を有する。
【0021】
本発明の請求項4に記載の発明は、修正アドレス記憶手段と比較回路を複数組備え、更に比較回路の一致出力信号をデコードした信号を命令の解読タイミングまで保持するようにしたもので、前述の請求項1から請求項3までの作用に加え、修正箇所を複数にした場合でも、一致信号の保持に必要な回路規模を最小限に留めることができるという作用を有する。
【0022】
本発明の請求項5に記載の発明は、一致信号を命令コードの転送に同期して転送するもので、一致信号の転送タイミングと命令コード転送タイミングを共用化できるという作用を有する。
【0023】
本発明の請求項6に記載の発明は、一致信号を直接命令解読器に入力するようにしたもので、一致の検出を容易に実現できるという作用を有する。
【0024】
本発明の請求項7に記載の発明は、一致の検出手段として命令解読器に入力される命令レジスタとマイクロアドレスポインタに特定の値を設定するようにしたもので、命令解読器への入力信号を増加させることなく一致の検出ができるという作用を有する。
【0025】
本発明の請求項8に記載の発明は、一致信号のデコード値を直接RAMアドレスの一部として使用するようにしたもので、修正プログラムの開始アドレス取得手段としてのアドレス発生回路の回路規模を増大させることなく容易に実現できるという作用を有する。
【0026】
本発明の請求項9に記載の発明は、修正が必要な命令の解読タイミングで一致の検出を行うようにしたもので、縮小化命令コードを用いたマイクロコンピュータであっても、ROM読み出しアドレスとの比較を行う事で、該当命令の修正が可能であるという作用を有する。
【0027】
以下本発明の実施例について、図面を参照しながら説明する。
図1は本発明の一つの実施例を示すブロック図であり、1はプログラムカウンタ、2はプログラムが格納されるROM、31は修正アドレスレジスタ、32は比較回路、5は命令解読器、6はRAM、7は一致信号である。修正アドレスレジスタ31と比較回路32からなるプログラム変更装置は複数の命令を修正するために複数組実装される(3a〜3n)。プログラムカウンタ1とROM2、比較回路32及びRAM6はアドレスバスにより接続され、ROM2と命令解読器5及びRAM6はデータバスにより接続される。
【0028】
修正アドレスレジスタ31にはROM2に格納される一連の命令コードの修正箇所(不具合箇所)のアドレスを格納する。修正箇所が複数行に及ぶ場合は、その修正箇所の先頭の命令コードが格納されるアドレスを格納する。
【0029】
比較回路32は修正アドレスレジスタに格納されたアドレス値とROM2に格納された命令コードを読み出すためにプログラムカウンタ1からアドレスバスに出力されたアドレス値とを比較し、両アドレス値の一致を検出すると一致信号7を出力する。
【0030】
通常マイクロコンピュータは、プログラムカウンタ1によりアドレス指示されたデータをROM2から順次読み出し、読み出したデータ中の命令オペレーションコードを命令解読器5で解読し、マイクロ命令を起動することで各種動作を実行する。一般的なマイクロコンピュータではROM2とRAM6が同一のメモリ空間に配置されることが多く、マイクロコンピュータに内蔵されるRAMにはCPU(図示せず)の実行に必要な情報がデータとして格納保持されることが多いが、プログラムカウンタ1がRAM6上のアドレスを指示する事で、RAM6上の命令コードを実行することも可能である。
【0031】
次に本プログラム変更装置にてROMに固定記憶された命令を修正する方法について説明する。
(1)ROM2上に固定記憶されたプログラムに不具合や仕様変更等の理由により修正の必要が生じた場合、その被修正命令コード、又は一連の被修正プログラムの先頭の命令コードが格納されるアドレス値を修正アドレスレジスタ31に格納する。
(2)修正プログラムをRAM6に格納する。
(3)RAM6に格納された修正プログラムの開始アドレスを、RAM6上の予め決められた所定のアドレスに格納する。
【0032】
以上の操作をマイクロコンピュータのリセットスタート時に外部の不揮発性メモリ等から、マイクロコンピュータに一般的に装備されるシリアルインターフェースやパラレルインタフェース等を介して必要なデータを読み込む事で行う。
【0033】
これらの動作は予めROM2上に、外部の不揮発性メモリの特定のアドレスに記憶されたデータの状態や、マイクロコンピュータの端子の状態により、マイクロコンピュータのリセットスタート後起動される初期設定プログラムの中で起動されるようなプログラムを組み込んでおけばよい。
【0034】
上記の設定がなされたマイクロコンピュータが動作中に、被修正命令コードの読み出し動作を行うと、比較回路32により修正アドレスレジスタに格納されたアドレス値との一致が検出され、一致信号を出力する。
【0035】
一致信号は命令解読器5に入力され、命令オペレーションコードの解読タイミングに前記命令解読器5に備えられた一致信号検知手段により一致が検知され、解読しようとする命令オペレーションコードが被修正命令コードである事を検知すると以下の動作を行うマイクロ命令を起動する。
(1)RAM6上の所定のアドレスから修正プログラムの開始アドレス値を取得する。
(2)取得した開始アドレス値に無条件分岐し、プログラムカウンタ1にそのアドレス値を設定する。
【0036】
以下プログラムカウンタ1を順次インクリメント(又はデクリメント)する事でRAM6上に格納された修正プログラムを読み出し、実行する。
【0037】
修正プログラムの最後でROM2上のアドレスへの分岐命令を実行させることで一連のプログラム修正を完了させる。
【0038】
修正アドレスレジスタ31と比較回路32からなるプログラム変更装置が1組につき一箇所のプログラム修正が可能である。従ってプログラム変更装置を複数組(3a〜3n)備えることにより、複数箇所のプログラムの修正が可能である。通常は2〜4組程度実装すれば十分である。
【0039】
一般的にプログラム変更装置の組数が増大すると一致信号の本数も増大し、一致信号の保持手段や、命令解読器における一致の検知手段の回路規模が増大する。そこで回路規模の増大を最小限に留める為に以下の対策を行う。
【0040】
図2は本発明におけるプログラム変更装置と一致信号出力手段を示すブロック図である。本図に於いてはプログラム変更装置が3組(2−1)の場合について示すが、プログラム変更装置の組数が最大(2−1)組の場合についても同様である。
【0041】
図2(a)において3a〜3cは3組のプログラム変更装置、31a〜31cは修正アドレスレジスタ、32a〜32cは比較回路、7a〜7cは一致信号、8はデコーダ、81、82は一致デコード信号である。
【0042】
修正アドレスレジスタ31a、31bにROM上の修正が必要な命令コードが格納されるアドレスを設定し、比較回路32a〜32cを用いてアドレスバス上に出力された命令フェッチアドレスとの比較を行っている。命令フェッチアドレスと修正アドレスレジスタの値が一致すると比較回路32a〜32cは一致信号7a〜7cを出力する。マイクロコンピュータの命令実行により修正アドレスレジスタへのデータの書き込みや、読み出しが可能な事は言うまでもない。
【0043】
デコーダ8は前記一致信号7a〜7cを受け、図2(b)に示す真理値表に従って一致デコード信号81、82に変換する。具体的にはどの比較回路も一致信号を出力していない場合は一致デコード信号として(一致デコード信号82、一致デコード信号81)=(0、0)を、比較回路32aが一致信号を出力している場合は(0、1)を、比較回路32bが一致信号を出力している場合は(1、0)を、比較回路32cが一致信号を出力している場合は(1、1)を出力する。本真理値表では、プログラム変更装置の性格上複数の修正アドレスレジスタ31a〜31cに同じ修正アドレスを指定することを想定していないが、必要であれば複数の一致信号7a、7bが同時に出力された場合は一致デコード信号として優先順位を付ければよい。例えば番号の若い比較回路の一致出力を優先する事等が考えられる。この場合は比較回路32aと32bが一致信号を出力している場合は(一致デコード信号82、一致デコード信号81)=(0、1)の一致デコード信号を出力すればよい。なお優先順位の付け方は任意である。またデコードの割り当ても任意に構成可能であるが、いずれの比較回路も一致信号を出力しない場合に全ての出力が同一(全て0又は全て1)になるようにする事が好ましい。
【0044】
前述のような一致デコード信号を作成することにより、後述するように命令解読器における保持手段及び一致の検出手段が容易に構成できる。
【0045】
図3は本発明の命令解読器の一つの実施例である。
図に於いて80はn本の一致デコード信号であり、図2の実施例の場合は81、82の2本になる。9はPLAで、91はPLAを構成するAND部、92はOR部、A0は命令レジスタ、A1は命令キュー、B0及びB1は命令と同じタイミングで一致デコード信号を保持する一致デコード信号保持手段、Dはマイクロコンピュータの各部を制御し命令を実行させる制御信号である。
【0046】
本実施例は命令先読み技術を用いたマイクロコンピュータにおける命令解読器を示す。通常プリフェッチアドレスにより指示され、読み出された命令コードはデータバスを経由して命令キューA1に格納される。次に命令解読タイミングに命令キューに格納された命令コードが命令レジスタに転送される。命令レジスタに格納された命令コードはPLAのAND部91へ入力し、解読されPLAのOR部92よりマイクロコンピュータの各部を制御する制御信号Dが出力され、各命令の実行を行う。
【0047】
プログラムの変更を行う場合は下記の動作を行う。
(1)図2の実施例に示したようなプログラム変更装置により、所望の修正アドレスとプリフェッチアドレスの比較を行い、一致した場合に出力される一致信号をデコードした一致デコード信号80を、プリフェッチされた命令コードが命令キューに格納されるのと同時に一致デコード信号保持手段B1に格納する。
(2)次に命令コードが命令レジスタに転送されるのと同時に一致デコード信号保持手段B0に転送し、命令解読タイミングに命令コードがPLAのAND部91に入力されるのと同時に一致デコード信号保持手段B0に格納される一致デコード信号をPLAのAND部91に入力する。
(3)PLAでは一致デコード信号が入力されると、(図2の実施例では(0、1)、(1、0)、(1、1))命令コードの種別に無関係に以下の動作を実行するマイクロプログラムを起動する。
【0048】
(a)RAM上の所定のアドレスから修正プログラムの開始アドレス値を取得する。
【0049】
(b)取得した開始アドレス値に無条件分岐し、プログラムカウンタにそのアドレス値を設定する。
(4)以下プログラムカウンタを順次インクリメント(又はデクリメント)する事でRAM上に格納された修正プログラムを読み出し、実行する。
(5)修正プログラムの最後でROM上のアドレスへの分岐命令を実行させることで一連のプログラム修正を完了させる。
【0050】
なお本実施例では一致デコード信号を命令解読タイミングまで保持し、PLAのAND部に入力したが、デコードをしていない一致信号を命令解読タイミングまで保持し直接入力しても良い。
【0051】
また本実施例では一致デコード信号をn本そのままPLAのAND部91に入力するように構成したが、図2の実施例のデコーダでは一致が生じた場合にはいずれかのビットが’1’となるため、n本の一致デコード信号をORゲートに入力し、1本の信号に集約する事で更に構成を簡単にできる。
【0052】
図4は本発明の命令解読器の別の実施例である。
図に於いて80はn本の一致デコード信号であり、図2の実施例の場合は81、82の2本になる。9はPLAで、91はPLAを構成するAND部、92はOR部、A0は命令レジスタ、A1は命令キュー、B0及びB1は命令と同じタイミングで一致デコード信号を保持する一致デコード信号保持手段、Cはマイクロアドレスポインタ、Dはマイクロコンピュータの各部を制御し命令を実行させる制御信号、Eはマイクロアドレス制御信号である。
【0053】
一般的なマイクロコンピュータでは命令解読器にマイクロコード技術を用いられる事が多い。この場合ハードウエアとしてはPLAが用いられ、PLAのAND部入力には命令レジスタ値とマイクロアドレスポインタ値が入力される。またマイクロアドレスポインタは一つ前の状態によりマイクロアドレス制御信号にて決定される。すなわち命令レジスタ値とマイクロポインタ値で各命令の実行状態が決められる。
【0054】
本実施例では図3の実施例と同様に、下記の動作を行う。
(1)所望の修正アドレスとプリフェッチアドレスの比較を行い、一致した場合に出力される一致信号をデコードした一致デコード信号80を、プリフェッチされた命令コードが命令キューに格納されるのと同時に一致デコード信号保持手段B1に格納する。
(2)次に命令コードが命令レジスタに転送されるのと同時に一致デコード信号保持手段B0に転送し、一致を示す場合(図2の実施例では(0、1)、(1、0)、(1、1))は命令レジスタとマイクロアドレスポインタを特定の値に設定し、その値をPLAのAND部91に入力する。
(3)PLAでは前記特定の値が入力されると、以下の動作を実行するマイクロプログラムを起動する。
【0055】
(a)RAM上の所定のアドレスから修正プログラムの開始アドレス値を取得する。
【0056】
(b)取得した開始アドレス値に無条件分岐し、プログラムカウンタにそのアドレス値を設定する。
(4)以下プログラムカウンタを順次インクリメント(又はデクリメント)する事でRAM上に格納された修正プログラムを読み出し、実行する。
(5)修正プログラムの最後でROM上のアドレスへの分岐命令を実行させることで一連のプログラム修正を完了させる。
【0057】
命令レジスタ及びマイクロアドレスポインタを特定のアドレスに設定する方法としては、それぞれをセット又はリセット付きのレジスタで構成し、一致デコード信号で制御しても良いし、またはそれぞれの出力にANDゲートやORゲートを挿入して一致デコード信号でゲートしても良い。
【0058】
図3及び図4に示した実施例では一致デコード信号を命令コードの解読タイミングまで保持する手段を有するため、変更命令の格納されるアドレスは単にプリフェッチアドレスと比較すればよく、プリフェッチアドレスは通常アドレスバスに出力されている為、修正アドレスレジスタとアドレスバスの比較を行うだけでよい為、プログラム変更装置の構成を容易にできる。
【0059】
前述の実施例では命令解読器の構成をPLAを用いて実現してあるが、ランダムロジックを用いても構成が可能なことは言うまでもない。
【0060】
また命令プリフェッチ時の命令キューは1段の場合について説明したが、2段以上の場合についても同様である。
【0061】
本発明のプログラム変更装置では被修正命令の実行サイクルで、マイクロプログラムの実行により
・RAM上の所定のアドレスから修正プログラムの開始アドレス値の取得
・取得した開始アドレス値に無条件分岐し、プログラムカウンタにそのアドレス値を設定
の動作を行うが、図5はこの時に修正プログラムの開始アドレスを格納するRAM上のアドレスを生成する手段の実施例を示す。
【0062】
図において8はデコーダ、B0及びB1は命令と同じタイミングで一致デコード信号を保持する一致デコード信号保持手段であり、図3及び図4に示した実施例の一部分と同一である。
【0063】
また図6は修正プログラムの開始アドレスを格納するRAM空間とアドレス信号のビット構成を示す。
【0064】
図6(a)においてF0からF2は3組のプログラム変更装置に対応する修正プログラムの開始アドレス格納領域である。
【0065】
本実施例では簡単化の為に修正プログラムを格納するRAMのアドレス空間を216バイト(アドレス信号線は16ビット)、プログラム変更装置は図2に示す様に3組であるとするが、アドレス信号線及びプログラム変更装置の組数は任意の場合でも同様に考えることができる。
【0066】
RAM空間のアドレス信号線が16ビットである為、図6(a)に示す様に修正プログラムの開始番地を格納する16ビット(2バイト)の領域を3組確保する。本実施例では領域F0(X’0202’とX’0203’番地)に図2(a)のプログラム変更装置3aの修正プログラム開始アドレスを、同様に領域F1(X’0204’とX’0205’番地)にプログラム変更装置3bの修正プログラム開始アドレスを、領域F2(X’0206’とX’0207’番地)にプログラム変更装置3cの修正プログラム開始アドレスを格納する。
【0067】
一般的な16ビットマイクロコンピュータではRAM空間へのアクセスを16ビット単位で行うことができる。この場合は修正プログラムの開始アドレスを取得する為には一致信号を出力したプログラム変更装置3a〜3cのいずれかに従って単にX’202’番地又はX’204’番地又はX’0206’番地のデータを16ビット単位で読み出せばよい。これらのアドレスは図6(b)に示すように16ビットのアドレス信号線のうち上位の15ビット(ビット3〜ビット15)には固定値b’000000100000’を次の2ビット(ビット1〜ビット2)は図2(b)のデコーダに従う一致デコード信号を、最後の1ビット(ビット0)は固定値b’0’を出力すればよい。一致デコード信号は図5に示す様に修正プログラムの開始番地取得タイミングで一致デコード信号保持手段B0に格納されるデータをアドレスバスに出力するだけでよく、容易に回路を構成できる。
【0068】
また8ビットマイクロコンピュータの様に一度に8ビットのデータしかアクセスできない場合は、8ビットデータを2回取得すればよく、図6(b)の最下位ビット(ビット0)を固定値ではなく、1度目のアドレス取得でb’0’を、2度目のアドレス取得でb’1’を出力する事で解決できる。
【0069】
なお本実施例では一致デコード信号をビット1〜ビット2の2ビットに出力するようにしたが、修正プログラム開始アドレス格納領域の構成や、RAM空間のアドレスビット幅、マイクロコンピュータの扱えるデータのビット幅(4ビット、8ビット、16ビット、32ビット、64ビット等)により任意のビット位置に出力する構成が考えられる。
【0070】
また図2(b)のデコーダの構成により一致デコード信号がb’00’の場合はどのプログラム変更装置も一致信号を出力しない場合に割り当てた為、X’0200’〜X’0201’番地は未使用としたが、デコーダの構成が変われば、割り当てる修正プログラム開始アドレス格納領域のアドレスも変わってくる事は言うまでもない。
【0071】
図7は縮小化命令コードのフォーマットを示す。例えば図は16ビットマイクロコンピュータであるとする。この場合の縮小化命令コードの基本単位は8ビットであり、命令nは命令オペレーションコードが16ビット(M0〜M1の2バイト)、オペランドが24ビット(M2〜M4の3バイト)であるとする。また続く命令n+1は命令オペレーションコードが同じく16ビット(N0〜N1の2バイト)、オペランドが16ビット(N2〜N3の2バイト)であるとする。この場合図7(b)に示す様に命令nがX’0100’番地から格納されているとすると、X’0104’番地には命令nの最終コードM4が、X’0105’番地には命令n+1の最初のコードN0が格納される事になる。一般的な16ビットマイクロコンピュータでは命令を16ビット単位でフェッチする為、X’0104’番地とX’0105’番地はアドレスX’0104’番地のデータとして同時にフェッチされる事になる。
【0072】
例えば被修正命令が命令n+1であった場合、修正アドレスレジスタにはX’0104’を格納する事になる。従って命令の境界が命令フェッチ単位の境界に無い場合は被修正命令の先頭を含むフェッチデータのアドレスを修正アドレスレジスタに指定する。
【0073】
前述の例では16ビットマイクロコンピュータの場合についての場合であるが、松下電子工業製の8ビットマイクロコンピュータMN101シリーズのように8ビットマイクロコンピュータでありながら命令コードのフォーマットの基本単位が4ビットのマイクロコンピュータもある。また32ビットや64ビット以上のマイクロコンピュータでも同様である。
【0074】
図7の例のように被修正命令が命令n+1で、修正アドレスレジスタ値がX’0104’の場合、図3又は図4に示す命令キューA1には命令nの最終コードM4と、命令n+1の先頭コードN0が格納され、一致デコード保持手段B1には一致デコード信号が格納される。縮小化命令コードを用いるマイクロコンピュータでは命令解読器に於いて命令レジスタに命令キューから命令オペレーションコードを格納するときに、該当命令の命令オペレーションコードのみを抽出格納する手段を有している(図示せず)。
【0075】
従って命令キューA1から命令オペレーションコードのみを抽出し、命令レジスタA0に格納するタイミングで一致デコード信号を一致デコード信号保持手段B1からB0に転送すればよく、転送後は前述のとおりに一致を検出し、マイクロプログラムの実行により
(1)RAM上の所定のアドレスから修正プログラムの開始アドレス値の取得
(2)取得した開始アドレス値に無条件分岐し、プログラムカウンタにそのアドレス値を設定
の動作を行い同様にプログラムの変更が可能となる。
【0076】
従って本発明によると、命令コードのフォーマットの如何に関わらず被修正命令の実行サイクルでその命令の修正が可能である。
【0077】
【発明の効果】
以上の様に本発明は、RAMに格納される修正プログラムの開始アドレスを同RAM内の予め定められた所定のアドレスに格納し、所望の修正箇所のアドレスを格納する為の修正アドレス記憶手段を有し、命令をフェッチアドレスと修正アドレス記憶手段に格納されたアドレスとを比較し、一致した場合に一致信号を出力する比較回路と複数の比較回路の一致出力をデコードする回路を具備し、更にCPUの命令解読器には、前記比較回路が一致信号を出力した事を検知する手段を備え、一致信号を検知すると前記命令解読器はマイクロ命令の実行により前記RAMの所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させるような構成を設ける事により、
(1)回路規模の増大を最小限に留め、
(2)修正プログラムの大きさの制限を緩和し、
(3)修正プログラムの実行を開始するまでの時間遅れを最小限に留め、
(4)命令先読み技術を用いたマイクロコンピュータでも修正箇所のアドレスを直接指定可能で、
(5)縮小化命令を用いたマイクロコンピュータでも修正箇所のアドレスを直接指定可能な優れたマイクロコンピュータのプログラム変更装置を実現できるものである。
【図面の簡単な説明】
【図1】実施例全体を示すブロック図
【図2】プログラム変更装置と一致信号出力手段の実施例を示す図
【図3】命令解読器の第1の実施例を示す図
【図4】命令解読器の第2の実施例を示す図
【図5】アドレス生成手段を示す図
【図6】修正プログラム開始アドレス格納領域を示す図
【図7】縮小化命令コードの一例を示す図
【図8】第1の従来例を示す図
【図9】第2の従来例を示す図
【図10】第3の従来例を示す図
【符号の説明】
1 プログラムカウンタ
2 ROM
3、3a〜3n プログラム変更装置
31 修正アドレスレジスタ
32 比較回路
33 修正命令レジスタ
34 割込ベクタレジスタ
35 分岐アドレスレジスタ
36 分岐命令発生回路
4 選択回路
5 命令解読器
6 RAM
7、7a、7b 一致信号
8 デコーダ
81、82 一致デコード信号
9 PLA
91 PLAのAND部
92 PLAのOR部
A0 命令レジスタ
A1 命令キュー
B0、B1 一致デコード信号保持手段
C マイクロアドレスポインタ
D 制御信号
E マイクロアドレス制御信号
F0、F1、F2 修正プログラム開始アドレス格納領域
[0001]
TECHNICAL FIELD OF THE INVENTION
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer program changing apparatus which can correct a program fixedly stored in a ROM incorporated in a microcomputer after a semiconductor integrated circuit is manufactured, and can operate normally.
[0002]
[Prior art]
2. Description of the Related Art In recent years, microcomputers are often used in electronic devices in order to cope with higher functions and higher performance. Generally, programs that determine the operation of these microcomputers are stored in a read-only memory (hereinafter abbreviated as ROM). In particular, when used in mass-produced equipment such as consumer equipment, a mask ROM in which a program is fixedly installed in a semiconductor integrated circuit manufacturing process is often used because of its low unit price. However, since the mask ROM has a fixed program installed during the manufacturing process, it is not possible to modify the program for reasons such as the occurrence of specification changes or the detection of program errors after manufacturing. I had to discard it. Further, there is a problem in that the only way to add a modification to the program is to manufacture the microcomputer again, which wastes cost and time.
[0003]
In order to solve these problems, some program change devices have conventionally been devised, and by incorporating these devices in a microcomputer, it is possible to correct a program in a microcomputer after manufacturing.
[0004]
FIG. 8 shows a first embodiment of a conventional program change device.
In the figure, 1 is a program counter, 2 is a ROM for storing a program, 31 is a correction address register, 32 is a comparison circuit, 33 is a correction instruction register, 4 is a selection circuit, and 5 is an instruction decoder.
[0005]
Usually, the microcomputer sequentially reads out the instructions on the ROM 2 indicated by the program counter 1 and decodes them by the instruction decoder 5, and then performs the basic operation by executing the microinstructions and the like.
[0006]
In the conventional program changing apparatus, the address where the instruction requiring correction is stored in the correction address register 31 and the corrected instruction is stored in the correction instruction register. The correction address register 31 and the value of the program counter 1 are always compared by the comparison circuit 32. When a match is detected, the selection circuit 4 is switched to the correction instruction register side, and the instruction code stored in the correction instruction register instead of the ROM is read. Instructions are corrected by supplying them to the decoder. The program change device 3a composed of the correction address register 31, the comparison circuit 32, and the correction instruction register 33 is necessary for correcting one instruction stored in one address. A plurality of sets of program change devices 3a to 3n are mounted for correction.
[0007]
FIG. 9 shows a second embodiment of the conventional program change device.
In the figure, 1 is a program counter, 2 is a ROM in which a program is stored, 31 is a modified address register, 32 is a comparison circuit, 34 is an interrupt vector register, 5 is an instruction decoder, and 6 is a RAM.
[0008]
In the conventional program changing apparatus, an address at which an instruction requiring correction is stored is stored in the correction address register 31, a series of correction programs are stored in the RAM 6, and a start address of the correction program is stored in the interrupt vector register 34. The value of the modified address register 31 and the value of the program counter 1 are always compared by the comparing circuit 32, and when a match is detected, an interrupt request signal is generated. When the CPU receives the interrupt request signal, the CPU saves the current program counter value and the like on the stack, reads the address of the interrupt branch destination from the interrupt vector register 34, and sets it in the program counter 1. In this case, the start address of the correction program stored in the RAM is stored in the interrupt vector register, and the correction program is executed as the interrupt processing program.
[0009]
FIG. 10 shows a third embodiment of the conventional program changing apparatus.
In the figure, 1 is a program counter, 2 is a ROM storing a program, 31 is a modified address register, 32 is a comparison circuit, 35 is a branch address register, 4 is a selection circuit, 5 is an instruction decoder, and 36 is a branch instruction generation circuit. It is.
[0010]
In the conventional program changing apparatus, an address at which an instruction requiring correction is stored in the correction address register 31, a series of correction programs is stored in the RAM 6, and a start address of the correction program is stored in the branch address register 35. The value of the modified address register 31 and the value of the program counter 1 are always compared by the comparison circuit 32. When a match is detected, the selection circuit 4 is switched to the branch instruction generation circuit side, and the branch instruction generated by the branch instruction generation circuit instead of the ROM. Supply the code to the instruction decoder. The branch instruction generating circuit generates an instruction operation code of the branch instruction and a value stored in the branch address register as an operand following the instruction operation code. That is, the CPU decodes and executes the branch instruction to the start address of the correction program, and as a result, executes the correction program.
[0011]
[Problems to be solved by the invention]
However, the conventional program changing apparatus has the following problems.
[0012]
In the first conventional example, an instruction that can be corrected by a set of program change devices including a comparison circuit 32, a correction address register 31, and a correction instruction register 33 is an instruction code (for example, in an 8-bit microcomputer) corresponding to one address. 1-byte instruction code). Since the program change device and the correction instruction code have a one-to-one correspondence, it is necessary to implement a plurality of sets of program change devices in order to make it possible to correct a plurality of instruction codes. Usually, about 8 to 16 sets are mounted in many cases. A general 8-bit microcomputer has 16-bit to 24-bit address lines, and a 16-bit microcomputer has 24-bit to 32-bit address lines. That is, the comparison circuit and the correction address register of the program change device need to have the same bit width as the address line, and the same number of correction instruction registers (the bit width per set is generally an 8-bit microcomputer). (8 bits, 16 bits in the case of a 16-bit microcomputer), and the problem of increasing the circuit scale occurs when a plurality of sets are provided. On the contrary, there is also a problem that the size of the correction program is limited by the number of sets of the program change device to be mounted.
[0013]
In the second conventional example, since the correction program is executed using a general interrupt, the program counter 1 and a program status word PSW (not shown) are saved on a stack. Therefore, it is necessary to secure a stack area for this, and there is a problem that the RAM is wasted. Also, time is required for the evacuation operation to the stack, which causes a time loss until execution. This can be fatal for speedy processes. Further, in recent microcomputers, a technique of prefetching an instruction is generally used to increase the processing speed, and a prefetch address for reading a ROM and an instruction for executing an instruction actually executed by a CPU are generally used. It is different from the address. Therefore, the prefetch address and the value of the correction address register 31 are compared by the comparison circuit 32, and if they match, an interrupt is generated, and even if the correction program is executed, the instruction is not correctly corrected. Is generated. This is because, for example, if the instruction being executed when a match is detected is a branch instruction, the instruction specified by the correction address register may not be executed. Therefore, in a microcomputer using the instruction prefetching technique, comparison with an execution address is necessary. However, in general, a register holding an instruction execution address is often not mounted, and the execution of the program is not performed because of a program change device. Providing the address register causes a problem of increasing the circuit scale.
[0014]
In the third conventional example, the correction address register 31 and the program counter 1 are compared by a comparison circuit 32, and a branch instruction is generated when they match, and a branch instruction generation circuit 36 for generating a specific branch instruction is used. However, there is a problem that the circuit scale is increased. Further, the following problem occurs.
[0015]
In recent microcomputers, the basic unit of the bit length of the instruction code may be smaller than the bit width read from the ROM in order to reduce the code size of the instruction. FIG. 7 shows an example of the format of the reduced instruction code. For example, assume that the figure is a 16-bit microcomputer. In a general 16-bit microcomputer, the basic unit of the bit length of the instruction code is 16 bits, and the total bit length of the instruction including the instruction operation code and the subsequent operand is a multiple of 16 bits. In a general 16-bit microcomputer, instructions are read from the ROM with a 16-bit width, so that a boundary between consecutive instructions cannot exist in the middle of the read ROM data. However, in a microcomputer with a reduced instruction code, the instruction operation code is 16 bits (2 bytes M0 to M1) and the operand is 24 bits (3 bytes M2 to M4) as shown by the instruction n in FIG. There are certain cases. In this case, the total bit length of the instruction code is 40 bits (5 bytes of M0 to M4) and is not an integral multiple of 16 bits (2 bytes). In such a case, if the reading from the ROM is 16 bits wide, there may be a case where a boundary between consecutive instructions exists in the middle of the read ROM data as shown in FIG. 7B. The same can be said for an 8-bit microcomputer or a 32-bit microcomputer. In the conventional method in which only the instruction fetch address in the ROM is compared and the instruction code is replaced with the code of the branch instruction, it is impossible to generate the branch instruction using the middle of the read data as the instruction boundary. This is because the final code of the instruction immediately before the correction instruction bundled with the branch instruction cannot be uniquely determined.
[0016]
The present invention solves the aforementioned problems,
(1) Minimize the increase in circuit scale,
(2) Relax the size limit of the patch,
(3) Minimize the time delay before starting the execution of the correction program,
(4) Even a microcomputer using the instruction prefetching technique can directly specify an address of a correction portion,
(5) By providing a microcomputer program changing device that can directly specify the address of a correction point even in a microcomputer using a reduced instruction, if the instruction fixedly stored in the ROM can be corrected after the microcomputer is manufactured. The purpose is to tighten.
[0017]
[Means for Solving the Problems]
In order to solve the above-mentioned problem, a program changing apparatus according to the present invention includes a corrected address register, a comparing circuit, and a coincidence detecting means, compares a ROM fetch address with a value of the corrected address register by a comparing circuit, and decodes the result. When the match is detected by the match detector by the match detector, the instruction decoder obtains the start address of the correction program from a predetermined address on the RAM by executing a microinstruction, and executes the program in the RAM. Is branched to the start address of the correction program. This
(1) Minimize the increase in circuit scale,
(2) Relax the size limit of the patch,
(3) Minimize the time delay before starting the execution of the correction program,
(4) Even a microcomputer using the instruction prefetching technique can directly specify an address of a correction portion,
(5) It is possible to obtain a microcomputer program changing device that can directly specify the address of a correction portion even with a microcomputer using a reduction instruction.
[0018]
BEST MODE FOR CARRYING OUT THE INVENTION
The invention according to claim 1 of the present invention comprises a corrected address register, a comparing circuit, and coincidence detecting means, compares the ROM fetch address with the value of the corrected address register by the comparing circuit, and sends the result to the instruction decoder. In the instruction decoder, when a match is detected in the comparison circuit by the match detection means, the start address of the correction program is obtained from a predetermined address on the RAM by executing the microinstruction by executing the microinstruction, and the execution of the program is executed by the correction The branch is made to the start address, and has the effect of minimizing the circuit scale required for realizing the program change device.
[0019]
According to a second aspect of the present invention, the coincidence signal from the comparison circuit is held until the timing at which the instruction is decoded. In the microcomputer using the instruction prefetching technique, the execution address is different from the ROM read address. Even in such a case, there is an effect that correction can be performed at the time of execution of the corresponding instruction simply by comparing with the ROM read address.
[0020]
The invention according to claim 3 of the present invention includes a plurality of sets of corrected address storage means and comparison circuits, and has an effect that a program at a plurality of locations can be corrected.
[0021]
According to a fourth aspect of the present invention, a plurality of sets of corrected address storage means and a comparison circuit are provided, and a signal obtained by decoding a coincidence output signal of the comparison circuit is held until the instruction decoding timing. In addition to the effects of claims 1 to 3, there is an effect that the circuit scale required for holding the coincidence signal can be minimized even when a plurality of correction points are provided.
[0022]
The invention described in claim 5 of the present invention transfers the coincidence signal in synchronization with the transfer of the instruction code, and has an effect that the transfer timing of the coincidence signal and the instruction code transfer timing can be shared.
[0023]
The invention according to claim 6 of the present invention is such that the coincidence signal is directly input to the command decoder, and has an effect that the coincidence can be easily detected.
[0024]
According to a seventh aspect of the present invention, a specific value is set in an instruction register and a micro address pointer input to an instruction decoder as a means for detecting coincidence, and an input signal to the instruction decoder is set. Has the effect that coincidence can be detected without increasing the
[0025]
According to an eighth aspect of the present invention, the decoded value of the coincidence signal is directly used as a part of the RAM address, and the circuit size of the address generation circuit as the start address acquisition means of the correction program is increased. It has the effect that it can be easily realized without causing it.
[0026]
According to the ninth aspect of the present invention, a match is detected at the timing of decoding an instruction requiring correction. Even in a microcomputer using a reduced instruction code, a ROM read address and Has the effect that the corresponding instruction can be modified.
[0027]
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing one embodiment of the present invention, wherein 1 is a program counter, 2 is a ROM storing a program, 31 is a modified address register, 32 is a comparison circuit, 5 is an instruction decoder, and 6 is an instruction decoder. RAM and 7 are coincidence signals. A plurality of sets of the program change device including the correction address register 31 and the comparison circuit 32 are mounted to correct a plurality of instructions (3a to 3n). The program counter 1 and the ROM 2, the comparison circuit 32 and the RAM 6 are connected by an address bus, and the ROM 2 and the command decoder 5 and the RAM 6 are connected by a data bus.
[0028]
The correction address register 31 stores an address of a correction portion (a defect portion) of a series of instruction codes stored in the ROM 2. When the corrected portion extends over a plurality of lines, the address where the first instruction code of the corrected portion is stored is stored.
[0029]
The comparison circuit 32 compares the address value stored in the corrected address register with the address value output from the program counter 1 to the address bus in order to read the instruction code stored in the ROM 2, and detects a match between the two address values. The coincidence signal 7 is output.
[0030]
Normally, the microcomputer sequentially reads data addressed by the program counter 1 from the ROM 2, decodes the instruction operation code in the read data with the instruction decoder 5, and activates the microinstruction to execute various operations. In a general microcomputer, the ROM 2 and the RAM 6 are often arranged in the same memory space, and information necessary for execution of a CPU (not shown) is stored and held in a RAM built in the microcomputer. In many cases, the instruction code on the RAM 6 can be executed by the program counter 1 indicating an address on the RAM 6.
[0031]
Next, a method for correcting an instruction fixedly stored in the ROM by the present program changing apparatus will be described.
(1) When a program fixedly stored in the ROM 2 needs to be corrected due to a defect or a change in specifications, an address where the corrected instruction code or the first instruction code of a series of corrected programs is stored. The value is stored in the correction address register 31.
(2) The correction program is stored in the RAM 6.
(3) The start address of the correction program stored in the RAM 6 is stored at a predetermined address on the RAM 6.
[0032]
The above operation is performed by reading necessary data from an external nonvolatile memory or the like at the time of reset start of the microcomputer via a serial interface or a parallel interface generally provided in the microcomputer.
[0033]
These operations are performed in an initialization program which is started after a reset start of the microcomputer, depending on the state of data previously stored at a specific address of the external nonvolatile memory on the ROM 2 and the state of the terminals of the microcomputer. What is necessary is just to incorporate the program which is started.
[0034]
If the operation of reading the instruction code to be corrected is performed during the operation of the microcomputer having the above setting, the comparison circuit 32 detects the coincidence with the address value stored in the modified address register, and outputs a coincidence signal.
[0035]
The coincidence signal is input to the instruction decoder 5, the coincidence is detected by the coincidence signal detecting means provided in the instruction decoder 5 at the timing of decoding the instruction operation code, and the instruction operation code to be decoded is the corrected instruction code. When it detects something, it activates a micro instruction that performs the following operation.
(1) Obtain the start address value of the correction program from a predetermined address on the RAM 6.
(2) Unconditionally branch to the acquired start address value and set the address value in the program counter 1.
[0036]
Thereafter, the correction program stored in the RAM 6 is read and executed by sequentially incrementing (or decrementing) the program counter 1.
[0037]
A series of program corrections is completed by executing a branch instruction to an address on the ROM 2 at the end of the correction program.
[0038]
A program change device including a correction address register 31 and a comparison circuit 32 can correct one program per set. Therefore, by providing a plurality of sets (3a to 3n) of program change devices, it is possible to correct programs at a plurality of locations. Usually, it is sufficient to mount about 2 to 4 sets.
[0039]
In general, as the number of sets of program change devices increases, the number of coincidence signals also increases, and the circuit size of the coincidence signal holding means and the coincidence detection means in the instruction decoder increases. Therefore, the following measures are taken to minimize the increase in the circuit scale.
[0040]
FIG. 2 is a block diagram showing the program change device and the coincidence signal output means according to the present invention. In this figure, three sets of program change devices (2 2 -1), the number of sets of program change devices is the maximum (2 n -1) The same applies to the case of a set.
[0041]
In FIG. 2A, 3a to 3c are three sets of program change devices, 31a to 31c are modified address registers, 32a to 32c are comparison circuits, 7a to 7c are match signals, 8 is a decoder, 81 and 82 are match decode signals. It is.
[0042]
The addresses of the ROMs where the instruction codes requiring modification are stored are set in the modification address registers 31a and 31b, and the comparison with the instruction fetch addresses output on the address bus is performed using the comparison circuits 32a to 32c. . When the value of the instruction fetch address matches the value of the correction address register, the comparison circuits 32a to 32c output match signals 7a to 7c. It goes without saying that data can be written to and read from the correction address register by executing instructions from the microcomputer.
[0043]
The decoder 8 receives the match signals 7a to 7c and converts them into match decode signals 81 and 82 according to a truth table shown in FIG. Specifically, when no comparison circuit outputs a coincidence signal, (coincidence decoding signal 82, coincidence decoding signal 81) = (0, 0) as a coincidence decoding signal, and the comparison circuit 32a outputs a coincidence signal. (0, 1) when the comparison circuit 32b is outputting a coincidence signal, and (1, 1) when the comparison circuit 32c is outputting a coincidence signal. I do. Although the truth table does not assume that the same correction address is specified in the plurality of correction address registers 31a to 31c due to the nature of the program changing device, a plurality of coincidence signals 7a and 7b are simultaneously output if necessary. In this case, the priority may be set as the coincidence decode signal. For example, it is conceivable to give priority to the coincidence output of the comparison circuit having the smaller number. In this case, when the comparison circuits 32a and 32b output the coincidence signal, the coincidence decode signal of (0, 1) ((coincidence decode signal 82, coincidence decode signal 81)) may be output. The order of priorities is arbitrary. The assignment of decoding can also be arbitrarily configured, but it is preferable that all outputs be the same (all 0s or all 1s) when none of the comparison circuits output a coincidence signal.
[0044]
By generating the coincidence decode signal as described above, the holding means and the coincidence detecting means in the instruction decoder can be easily configured as described later.
[0045]
FIG. 3 shows one embodiment of the instruction decoder of the present invention.
In the drawing, reference numeral 80 denotes n coincidence decode signals. In the case of the embodiment shown in FIG. 9 is a PLA, 91 is an AND part constituting the PLA, 92 is an OR part, A0 is an instruction register, A1 is an instruction queue, B0 and B1 are coincidence decode signal holding means for holding a coincidence decode signal at the same timing as an instruction, D is a control signal for controlling each section of the microcomputer to execute a command.
[0046]
This embodiment shows an instruction decoder in a microcomputer using an instruction prefetching technique. Normally, the instruction code specified and read by the prefetch address is stored in the instruction queue A1 via the data bus. Next, at the instruction decoding timing, the instruction code stored in the instruction queue is transferred to the instruction register. The instruction code stored in the instruction register is input to the AND section 91 of the PLA, decoded, and the control signal D for controlling each section of the microcomputer is output from the OR section 92 of the PLA, thereby executing each instruction.
[0047]
The following operations are performed to change the program.
(1) A desired address is compared with a prefetch address by a program changing device as shown in the embodiment of FIG. 2, and a match decode signal 80 obtained by decoding a match signal output when a match occurs is prefetched. The stored instruction code is stored in the coincidence decode signal holding means B1 at the same time as being stored in the instruction queue.
(2) Next, the instruction code is transferred to the coincidence decode signal holding means B0 at the same time as the instruction code is transferred to the instruction register, and the coincidence decode signal is held at the same time as the instruction code is input to the AND section 91 of the PLA at the instruction decoding timing. The coincidence decode signal stored in the means B0 is input to the AND section 91 of the PLA.
(3) When the coincidence decode signal is input to the PLA ((0, 1), (1, 0), (1, 1) in the embodiment of FIG. 2), the following operation is performed irrespective of the instruction code type. Start the microprogram to be executed.
[0048]
(A) Obtain the start address value of the correction program from a predetermined address on the RAM.
[0049]
(B) Unconditionally branch to the acquired start address value and set the address value in the program counter.
(4) The correction program stored in the RAM is read and executed by sequentially incrementing (or decrementing) the program counter.
(5) A series of program corrections is completed by executing a branch instruction to an address on the ROM at the end of the correction program.
[0050]
In this embodiment, the coincidence decode signal is held until the instruction decoding timing and input to the AND section of the PLA. However, the undecoded match signal may be held until the instruction decoding timing and directly input.
[0051]
Further, in the present embodiment, a configuration is adopted in which n coincidence decode signals are inputted to the AND section 91 of the PLA as they are. However, in the decoder of the embodiment of FIG. Therefore, the configuration can be further simplified by inputting n coincidence decode signals to the OR gate and consolidating them into one signal.
[0052]
FIG. 4 shows another embodiment of the instruction decoder of the present invention.
In the drawing, reference numeral 80 denotes n coincidence decode signals. In the case of the embodiment shown in FIG. 9 is a PLA, 91 is an AND part constituting the PLA, 92 is an OR part, A0 is an instruction register, A1 is an instruction queue, B0 and B1 are coincidence decode signal holding means for holding a coincidence decode signal at the same timing as an instruction, C is a micro address pointer, D is a control signal for controlling each part of the microcomputer to execute a command, and E is a micro address control signal.
[0053]
In a general microcomputer, a microcode technology is often used for an instruction decoder. In this case, a PLA is used as hardware, and an instruction register value and a microaddress pointer value are input to an AND section input of the PLA. The micro address pointer is determined by the micro address control signal according to the previous state. That is, the execution state of each instruction is determined by the instruction register value and the micropointer value.
[0054]
In this embodiment, the following operation is performed as in the embodiment of FIG.
(1) A desired modified address is compared with a prefetch address, and a match decode signal 80 obtained by decoding a match signal output in the case of a match is decoded at the same time when the prefetched instruction code is stored in the instruction queue. It is stored in the signal holding means B1.
(2) Next, at the same time when the instruction code is transferred to the instruction register, the instruction code is transferred to the coincidence decode signal holding means B0 to indicate a match ((0, 1), (1, 0) in the embodiment of FIG. 2). (1, 1)) sets the instruction register and the micro address pointer to specific values, and inputs the values to the AND unit 91 of the PLA.
(3) In the PLA, when the specific value is input, a microprogram for executing the following operation is started.
[0055]
(A) Obtain the start address value of the correction program from a predetermined address on the RAM.
[0056]
(B) Unconditionally branch to the acquired start address value and set the address value in the program counter.
(4) The correction program stored in the RAM is read and executed by sequentially incrementing (or decrementing) the program counter.
(5) A series of program corrections is completed by executing a branch instruction to an address on the ROM at the end of the correction program.
[0057]
As a method of setting the instruction register and the micro address pointer to specific addresses, each may be configured by a register with a set or reset and controlled by a coincidence decode signal, or an AND gate or an OR gate may be added to each output. May be inserted and gated with the coincidence decode signal.
[0058]
Since the embodiment shown in FIGS. 3 and 4 has means for holding the coincidence decode signal until the timing of decoding the instruction code, the address where the change instruction is stored may be simply compared with the prefetch address, and the prefetch address is the normal address. Since the data is output to the bus, it is only necessary to compare the corrected address register with the address bus, so that the configuration of the program changing device can be simplified.
[0059]
In the above embodiment, the configuration of the instruction decoder is realized by using the PLA, but it is needless to say that the configuration can be realized by using a random logic.
[0060]
Also, the case where the instruction queue at the time of instruction prefetch has one stage has been described.
[0061]
In the program change device of the present invention, in the execution cycle of the
・ Acquisition of the start address value of the correction program from a predetermined address on the RAM
・ Branch unconditionally to the acquired start address value and set the address value in the program counter
FIG. 5 shows an embodiment of a means for generating an address on the RAM for storing the start address of the correction program at this time.
[0062]
In the figure, reference numeral 8 denotes a decoder, and B0 and B1 are coincidence decode signal holding means for holding a coincidence decode signal at the same timing as the instruction, which is the same as a part of the embodiment shown in FIGS.
[0063]
FIG. 6 shows the RAM space for storing the start address of the correction program and the bit configuration of the address signal.
[0064]
In FIG. 6A, F0 to F2 are start address storage areas of the correction program corresponding to the three sets of program change devices.
[0065]
In this embodiment, for simplicity, the address space of the RAM for storing the correction program is two. 16 Although it is assumed that the number of bytes (address signal lines is 16 bits) and the number of program change devices are three as shown in FIG. 2, the number of sets of address signal lines and program change devices can be considered in any case.
[0066]
Since the address signal lines in the RAM space are 16 bits, three sets of 16-bit (2 bytes) areas for storing the start address of the correction program are secured as shown in FIG. In the present embodiment, the correction program start address of the program changing device 3a in FIG. 2A is set in the area F0 (X'0202 'and X'0203'), and the area F1 (X'0204 'and X'0205') is similarly set. The correction program start address of the program change device 3b is stored in the address (address), and the correction program start address of the program change device 3c is stored in the area F2 (addresses X'0206 'and X'0207').
[0067]
A general 16-bit microcomputer can access the RAM space in 16-bit units. In this case, in order to obtain the start address of the correction program, the data of the address X'202 ', the address X'204', or the address X'0206 'is simply obtained according to any of the program changers 3a to 3c which output the coincidence signal. What is necessary is just to read in 16-bit units. As shown in FIG. 6B, the upper 15 bits (bit 3 to bit 15) of the 16-bit address signal line are assigned a fixed value b'0000000100000 'to the next two bits (bit 1 to bit 15) as shown in FIG. 2) may output a coincidence decode signal according to the decoder of FIG. 2B, and the last bit (bit 0) may output a fixed value b'0 '. As shown in FIG. 5, the coincidence decode signal only needs to output the data stored in the coincidence decode signal holding means B0 to the address bus at the start address acquisition timing of the correction program, and the circuit can be easily formed.
[0068]
When only 8-bit data can be accessed at a time as in an 8-bit microcomputer, the 8-bit data may be obtained twice, and the least significant bit (bit 0) in FIG. This can be solved by outputting b'0 'in the first address acquisition and outputting b'1' in the second address acquisition.
[0069]
In this embodiment, the match decode signal is output as two bits, bit 1 and bit 2. However, the configuration of the correction program start address storage area, the address bit width of the RAM space, and the bit width of data that can be handled by the microcomputer (4 bits, 8 bits, 16 bits, 32 bits, 64 bits, etc.) may be output to an arbitrary bit position.
[0070]
Also, according to the configuration of the decoder in FIG. 2B, when the coincidence decode signal is b'00 ', the assignment is made when none of the program change devices outputs the coincidence signal. Therefore, addresses X'0200' to X'0201 'are unassigned. However, it goes without saying that if the configuration of the decoder changes, the address of the correction program start address storage area to be allocated also changes.
[0071]
FIG. 7 shows the format of the reduced instruction code. For example, assume that the figure is a 16-bit microcomputer. In this case, the basic unit of the reduced instruction code is 8 bits, and the instruction n has an instruction operation code of 16 bits (2 bytes of M0 to M1) and an operand of 24 bits (3 bytes of M2 to M4). . It is also assumed that the subsequent instruction n + 1 has the same instruction operation code of 16 bits (N0 to N1 2 bytes) and the operand of 16 bits (N2 to N3 2 bytes). In this case, assuming that the instruction n is stored from the address X'0100 'as shown in FIG. 7B, the final code M4 of the instruction n is stored at the address X'0104' and the instruction n is stored at the address X'0105 '. The first code N0 of n + 1 will be stored. Since a general 16-bit microcomputer fetches an instruction in units of 16 bits, addresses X'0104 'and X'0105' are fetched simultaneously as data at address X'0104 '.
[0072]
For example, if the instruction to be modified is instruction n + 1, X'0104 'is stored in the modified address register. Therefore, when the boundary of the instruction is not on the boundary of the instruction fetch unit, the address of the fetch data including the head of the instruction to be corrected is specified in the correction address register.
[0073]
In the above-described example, the case of a 16-bit microcomputer is used. However, even though it is an 8-bit microcomputer such as an 8-bit microcomputer MN101 series manufactured by Matsushita Electronics, a basic unit of the instruction code format is 4 bits. There is also a computer. The same applies to microcomputers of 32 bits or 64 bits or more.
[0074]
When the instruction to be modified is the instruction n + 1 and the modified address register value is X'0104 'as in the example of FIG. 7, the final code M4 of the instruction n and the instruction n + 1 of the instruction n + 1 are stored in the instruction queue A1 shown in FIG. The head code N0 is stored, and the match decode holding means B1 stores a match decode signal. The microcomputer using the reduced instruction code has means for extracting and storing only the instruction operation code of the corresponding instruction when storing the instruction operation code from the instruction queue in the instruction register in the instruction decoder. Zu).
[0075]
Therefore, it is sufficient to extract only the instruction operation code from the instruction queue A1 and transfer the coincidence decode signal from the coincidence decode signal holding means B1 to B0 at the timing of storing the instruction operation code in the instruction register A0. , By executing the microprogram
(1) Obtaining the start address value of the correction program from a predetermined address on the RAM
(2) Branch unconditionally to the acquired start address value and set that address value in the program counter
And the program can be similarly changed.
[0076]
Therefore, according to the present invention, the instruction can be modified in the execution cycle of the instruction to be modified irrespective of the format of the instruction code.
[0077]
【The invention's effect】
As described above, according to the present invention, the correction address storage means for storing the start address of the correction program stored in the RAM at a predetermined address in the RAM and storing the address of a desired correction portion is provided. A comparison circuit that compares an instruction with a fetch address and an address stored in a correction address storage unit, and outputs a match signal when they match, and a circuit that decodes match outputs of the plurality of comparison circuits; The instruction decoder of the CPU includes means for detecting that the comparison circuit has output the coincidence signal. When the coincidence signal is detected, the instruction decoder executes a microinstruction to execute a correction program from a predetermined address of the RAM. By providing a configuration that obtains the start address and branches the execution of the program to the start address of the correction program in the RAM,
(1) Minimize the increase in circuit scale,
(2) Relax the size limit of the patch,
(3) Minimize the time delay before starting the execution of the correction program,
(4) Even a microcomputer using the instruction prefetching technique can directly specify an address of a correction portion,
(5) It is possible to realize an excellent microcomputer program changing device that can directly specify the address of a correction portion even with a microcomputer using a reduction instruction.
[Brief description of the drawings]
FIG. 1 is a block diagram showing an entire embodiment.
FIG. 2 is a diagram showing an embodiment of a program change device and a coincidence signal output means;
FIG. 3 is a diagram showing a first embodiment of an instruction decoder;
FIG. 4 is a diagram showing a second embodiment of the instruction decoder;
FIG. 5 is a diagram showing an address generation unit.
FIG. 6 is a diagram showing a correction program start address storage area.
FIG. 7 shows an example of a reduced instruction code.
FIG. 8 is a diagram showing a first conventional example.
FIG. 9 is a diagram showing a second conventional example.
FIG. 10 is a diagram showing a third conventional example.
[Explanation of symbols]
1 Program counter
2 ROM
3, 3a to 3n program change device
31 Correction address register
32 comparison circuit
33 Modification Instruction Register
34 Interrupt Vector Register
35 Branch address register
36 Branch instruction generation circuit
4 Selection circuit
5 Command decoder
6 RAM
7, 7a, 7b coincidence signal
8 decoder
81, 82 Match decode signal
9 PLA
91 AND section of PLA
92 OR section of PLA
A0 instruction register
A1 instruction queue
B0, B1 coincidence decode signal holding means
C Micro address pointer
D control signal
E Micro address control signal
F0, F1, F2 Correction program start address storage area

Claims (9)

読み出し専用メモリ(ROM)とランダムアクセスメモリ(RAM)と演算及び制御を行う中央演算装置(CPU)を同一チップ内に集積したマイクロコンピュータで、前記ROMに格納された命令に修正箇所が生じた場合に、その修正箇所から前記RAM内に格納された修正プログラムに実行を分岐させるマイクロコンピュータのプログラム変更装置であって、
修正プログラムが前記RAM内に格納され、その開始アドレスを同RAM内の予め定められた所定のアドレスに格納し、
前記ROMの所望の修正箇所のアドレスを格納する為の修正アドレス記憶手段と、
命令をフェッチする為の前記ROMへの読み出しアドレスと、前記修正アドレス記憶手段に格納されたアドレスとを比較し、一致した場合に一致信号を出力する比較回路とを具備し、
CPUの命令解読器は、前記比較回路が一致信号を出力した事を検知する手段を備え、一致信号を検知すると前記命令解読器はマイクロ命令の実行により前記RAMの所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させる事を特徴とするマイクロコンピュータのプログラム変更装置。
A microcomputer in which a read-only memory (ROM), a random access memory (RAM), and a central processing unit (CPU) for performing calculations and controls are integrated in the same chip, and a command stored in the ROM is modified. A program changing device of a microcomputer for branching execution from the corrected portion to a corrected program stored in the RAM,
A correction program is stored in the RAM, and the start address is stored at a predetermined address in the RAM;
Correction address storage means for storing an address of a desired correction portion of the ROM;
A comparison circuit for comparing a read address to the ROM for fetching an instruction with an address stored in the correction address storage means and outputting a match signal when the addresses match;
The instruction decoder of the CPU includes means for detecting that the comparison circuit has output a coincidence signal, and upon detecting the coincidence signal, the instruction decoder starts execution of a microinstruction to start a correction program from a predetermined address of the RAM. A program change device for a microcomputer, which acquires an address and branches execution of the program to a start address of a correction program in the RAM.
修正アドレス記憶手段と命令のフェッチアドレスが一致すると、前記ROMから読み出された命令コードと前記比較回路の一致信号を同時にCPUへ入力し、CPUは前記命令コードと一致信号を同命令コードの解読タイミングまで保持する手段を具備し、同命令コードの解読時にCPUの命令解読器は入力された一致信号により同命令コードが修正すべき命令コードである事を検知する手段を備える事を特徴とする請求項1に記載のマイクロコンピュータのプログラム変更装置。When the fetch address of the instruction matches the corrected address storage means, the instruction code read from the ROM and the coincidence signal of the comparison circuit are simultaneously input to the CPU, and the CPU decodes the instruction code and the coincidence signal to decode the instruction code. It is characterized by comprising means for holding until the timing, and when decoding the instruction code, the instruction decoder of the CPU is provided with means for detecting that the instruction code is an instruction code to be corrected based on the input coincidence signal. A program changing device for a microcomputer according to claim 1. 修正アドレス記憶手段と比較回路を複数組備えることを特徴とする請求項1または請求項2に記載のマイクロコンピュータのプログラム変更装置。3. The microcomputer according to claim 1, wherein a plurality of sets of corrected address storage means and comparison circuits are provided. 読み出し専用メモリ(ROM)とランダムアクセスメモリ(RAM)と演算及び制御を行う中央演算装置(CPU)を同一チップ内に集積したマイクロコンピュータで、
前記ROMに格納された命令に修正箇所が生じた場合に、その修正箇所から前記RAM内に格納された修正プログラムに実行を分岐させるマイクロコンピュータのプログラム変更装置であって、
修正プログラムが前記RAM内に格納され、その開始アドレスを同RAM内の予め定められた所定のアドレスに格納し、
前記ROMの所望の修正箇所のアドレスを格納する為の修正アドレス記憶手段と、命令のフェッチアドレスと、前記修正アドレス記憶手段に格納されたアドレスとを比較し、一致した場合に一致信号を出力する比較回路とを最大で2−1組備え(nは自然数)、
前記最大で2−1本の一致出力から、どの比較回路が一致したかを示すn本の一致デコード信号を生成するデコード回路を具備し、前記一致デコード信号の状態の内、一組の特定の状態(全ての信号が0又は1)を全ての比較回路が不一致の状態とし、
前記一致デコード信号を命令コードと同時にCPUへ入力し、CPUは前記命令コードと一致デコード信号を同命令コードの解読タイミングまで保持する手段を備え、
同命令コードの解読時にCPUの命令解読器は入力された一致信号により同命令コードが修正すべき命令コードである事を検知する手段と、前記一致デコード信号から修正プログラムの開始アドレスが格納された前記RAM内の所定のアドレスを生成する手段を備え、
修正が必要である事を検知すると、前記命令解読器はマイクロ命令の実行により前記アドレス生成手段により生成された前記RAMの所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させる事を特徴とするマイクロコンピュータのプログラム変更装置。
A microcomputer in which a read-only memory (ROM), a random access memory (RAM), and a central processing unit (CPU) for performing calculations and controls are integrated in the same chip.
A program change device of a microcomputer that, when a correction portion occurs in an instruction stored in the ROM, branches execution from the correction portion to a correction program stored in the RAM,
A correction program is stored in the RAM, and the start address is stored at a predetermined address in the RAM;
A correction address storage means for storing an address of a desired correction portion of the ROM, an instruction fetch address, and an address stored in the correction address storage means are compared, and a match signal is output if they match. A maximum of 2 n -1 sets of comparison circuits (n is a natural number);
A decoding circuit for generating, from the 2 n -1 maximum coincidence outputs, n number of coincidence decode signals indicating which of the comparison circuits coincides with each other, and identifying one set of states of the coincidence decode signals; State (all signals are 0 or 1) is set to a state where all the comparison circuits do not match,
The coincidence decode signal is input to the CPU simultaneously with the instruction code, and the CPU includes means for holding the instruction code and the coincidence decode signal until decoding timing of the instruction code,
At the time of decoding the instruction code, the instruction decoder of the CPU detects from the input match signal that the instruction code is an instruction code to be corrected, and stores the start address of the correction program from the match decode signal. Means for generating a predetermined address in the RAM,
Upon detecting that the correction is necessary, the instruction decoder obtains the start address of the correction program from the predetermined address of the RAM generated by the address generation means by executing the microinstruction, and executes the program in the RAM. A program change device for a microcomputer, wherein the program branches to a start address of a correction program in the microcomputer.
請求項4に記載の命令コードと一致デコード信号を同命令コードの解読タイミングまで保持する手段として、
CPUは解読する命令コードを格納する為の命令レジスタと少なくとも1段以上のプリフェッチされた命令コードを格納する命令キューを備え、一致デコード信号は命令コードと同じ段数の一時記憶手段上を、命令コードと同期して転送させる事を特徴とするマイクロコンピュータのプログラム変更装置。
As means for holding the instruction code and the coincidence decode signal according to claim 4 until decoding timing of the instruction code,
The CPU includes an instruction register for storing an instruction code to be decoded and an instruction queue for storing at least one or more stages of prefetched instruction codes. A program changing device for a microcomputer, wherein the program is transferred in synchronization with the program.
請求項4に記載の修正すべき命令コードであることを検知する手段として一致デコード信号を命令コードと同時に命令解読器に入力し、
命令解読器では修正すべき命令コードであることを示す一致デコード信号が入力されると命令コードとは無関係に前記RAMの所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させるマイクロ命令を実行させる事を特徴とするマイクロコンピュータのプログラム変更装置。
Inputting a coincidence decode signal to the instruction decoder simultaneously with the instruction code as means for detecting the instruction code to be corrected according to claim 4;
The instruction decoder obtains the start address of the correction program from a predetermined address in the RAM irrespective of the instruction code when a coincidence decode signal indicating the instruction code to be corrected is input, and executes the program in the RAM. And a micro-instruction for executing a branch to a start address of a correction program in the microcomputer.
CPUの命令解読器に少なくとも命令レジスタの出力とマイクロアドレスポインタの出力を入力するマイクロコンピュータであって、前述請求項4に記載の修正すべき命令コードであることを検知する手段として、命令コードを命令レジスタに格納する時に修正すべき命令コードである事を示す一致デコード信号が入力されていると命令レジスタとマイクロアドレスポインタに特定の値を設定し、命令解読器では前記特定の値をデコードすると、前記RAMの所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させるマイクロ命令を実行させる事を特徴とするマイクロコンピュータのプログラム変更装置。A microcomputer for inputting at least an output of an instruction register and an output of a micro address pointer to an instruction decoder of a CPU, wherein the instruction code is a means for detecting an instruction code to be corrected according to claim 4. When a matching decode signal indicating that the instruction code is to be corrected when stored in the instruction register is input, a specific value is set in the instruction register and the micro address pointer, and the instruction decoder decodes the specific value. A program change device for acquiring a start address of a correction program from a predetermined address of the RAM, and executing a microinstruction for branching execution of the program to a start address of the correction program in the RAM. 請求項4に記載の修正プログラムの開始アドレスが格納された前記RAM内の所定のアドレスを生成する手段として、CPUに入力された一致デコード信号を、RAMアドレスの特定のnビットに出力する事を特徴とするマイクロコンピュータのプログラム変更装置。A means for generating a predetermined address in the RAM in which a start address of the correction program according to claim 4 is stored, wherein a coincidence decode signal input to a CPU is output to a specific n bits of a RAM address. Characteristic program changing device for microcomputer. 命令オペレーションコードとそれに続くオペランドから構成される命令コードの語調が一度にフェッチするデータのビット幅のn分の1(n=2又は4)の整数倍で、連続する命令コードの境界が同時にフェッチするデータの中間位置に存在する場合があるマイクロコンピュータであって、
修正アドレス記憶手段には修正が必要な命令の命令オペレーションコードの先頭が存在するROMのアドレスを格納し、
修正アドレス記憶手段と命令フェッチアドレスが一致したことを示す一致デコード信号を前記命令オペレーションコードの先頭が存在するフェッチデータと同時にCPUへ入力し、
CPUは修正が必要な命令コードの解読タイミングまで一致デコード信号を保持する手段を備え、
修正が必要な命令コードの先頭が含まれるフェッチデータから抽出した命令オペレーションコードの解読時にCPUの命令解読器は入力された一致信号により同命令コードが修正すべき命令コードである事を検知する手段を備え、
修正が必要である事を検知すると、前記命令解読器はマイクロ命令の実行により前述RAMの所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させる事を特徴とするマイクロコンピュータのプログラム変更装置。
The tone of the instruction code composed of the instruction operation code and the operand following it is an integer multiple of 1 / n (n = 2 or 4) of the bit width of the data to be fetched at a time, and the boundaries of successive instruction codes are fetched simultaneously. A microcomputer that may be located in the middle of the data
The corrected address storage means stores the address of the ROM where the head of the instruction operation code of the instruction requiring correction exists,
Inputting a coincidence decode signal indicating that the corrected address storage means and the instruction fetch address coincide with each other to the CPU simultaneously with the fetch data in which the head of the instruction operation code exists;
The CPU includes means for holding the coincidence decode signal until the timing of decoding the instruction code requiring correction,
When decoding the instruction operation code extracted from the fetch data including the beginning of the instruction code requiring correction, the instruction decoder of the CPU detects that the instruction code is the instruction code to be corrected based on the input match signal. With
Upon detecting that the correction is necessary, the instruction decoder obtains the start address of the correction program from the predetermined address of the RAM by executing the microinstruction, and executes the program to the start address of the correction program in the RAM. A microcomputer program changing device characterized by branching.
JP00600697A 1997-01-17 1997-01-17 Microcomputer program change device Expired - Fee Related JP3588951B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP00600697A JP3588951B2 (en) 1997-01-17 1997-01-17 Microcomputer program change device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP00600697A JP3588951B2 (en) 1997-01-17 1997-01-17 Microcomputer program change device

Publications (2)

Publication Number Publication Date
JPH10207704A JPH10207704A (en) 1998-08-07
JP3588951B2 true JP3588951B2 (en) 2004-11-17

Family

ID=11626655

Family Applications (1)

Application Number Title Priority Date Filing Date
JP00600697A Expired - Fee Related JP3588951B2 (en) 1997-01-17 1997-01-17 Microcomputer program change device

Country Status (1)

Country Link
JP (1) JP3588951B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001125781A (en) 1999-10-29 2001-05-11 Matsushita Electric Ind Co Ltd Microprocessor and program changing method in microprocessor

Also Published As

Publication number Publication date
JPH10207704A (en) 1998-08-07

Similar Documents

Publication Publication Date Title
TWI541658B (en) Data processing apparatus and semiconductor integrated circuit device
US6865667B2 (en) Data processing system having redirecting circuitry and method therefor
JPS58151648A (en) Data processor having program patching means
JP3242508B2 (en) Microcomputer
US6832305B2 (en) Method and apparatus for executing coprocessor instructions
US5938774A (en) Apparatus for repairing faulty program segments in embedded microprocessor systems
KR19980069757A (en) Microprocessor and Multiprocessor Systems
JP2845433B2 (en) Integrated circuit device
JP2773471B2 (en) Information processing device
JP4988082B2 (en) Microprocessor and data processing system
JPH0869377A (en) Electronic circuit and method for using a coprocessor
US20070283139A1 (en) Information processing apparatus and control method used thereby
US5203006A (en) System for selecting next instruction address between unit incremented address and address from table specified by operating condition signals
JP3030297B2 (en) Computer system
US5381532A (en) Microprocessor having branch aligner between branch buffer and instruction decoder unit for enhancing initiation of data processing after execution of conditional branch instruction
JP3831396B2 (en) Data processing apparatus and IC card
JP3588951B2 (en) Microcomputer program change device
JP5933685B2 (en) Microcomputer and nonvolatile semiconductor device
US6425047B1 (en) Process containing address decoders suited to improvements in clock speed
US20070113064A1 (en) Method and system for secure code patching
JPH1091430A (en) Command decoding device
WO2000042506A1 (en) Processor and method of executing instructions from several instruction sources
EP0573071A2 (en) A microprocessor
JP2002091785A (en) Program change device
JP2004086596A (en) Microcomputer

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040727

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040809

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

Free format text: PAYMENT UNTIL: 20070827

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20080827

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20080827

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090827

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090827

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100827

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110827

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20110827

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120827

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees