JPH0895946A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH0895946A
JPH0895946A JP6252717A JP25271794A JPH0895946A JP H0895946 A JPH0895946 A JP H0895946A JP 6252717 A JP6252717 A JP 6252717A JP 25271794 A JP25271794 A JP 25271794A JP H0895946 A JPH0895946 A JP H0895946A
Authority
JP
Japan
Prior art keywords
address
program
cpu
instruction
microcomputer
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
JP6252717A
Other languages
Japanese (ja)
Inventor
Tetsuya Sakairi
哲矢 坂入
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.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP6252717A priority Critical patent/JPH0895946A/en
Publication of JPH0895946A publication Critical patent/JPH0895946A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)
  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)
  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Microcomputers (AREA)

Abstract

PURPOSE: To enable a microcomputer to perform a normal operation by executing a correction program when a bug exists in a program on an incorporated ROM by performing control so as to supply a branch instruction to an instruction queue when a prefetch address to be outputted for prefetching an instruction is coincident with the contents of a register. CONSTITUTION: When a bug exists in the program on a ROM 3, a CPU 7 continuously executes the program on the ROM 3 until a fetch pointer 1 reaches the leading address of the bug part. When the fetch pointer 1 arrives at the leading address of the bug part, namely, when the contents of the fetch pointer 1 and a register 6 are coincident with each other, a comparator circuit 5 outputs a high-level select signal 12 and a selecting circuit 8 receives the select signal 12, switches the program on the ROM 3 to the output of a branch instruction output circuit 9 and outputs the branch instruction to an instruction queue 15. The CPU 7 receives the branch instruction from the instruction queue 15 and executes it.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は情報処理装置に関し、特
に単一半導体基板上に、演算および制御を行うCPU、
プログラムを格納するためのプログラムメモリ、前記C
PUに取り込むべき命令のプログラムメモリ上のアドレ
スを示すフェッチポインタ、外部からデータを取り込む
ためのインタフェース手段、前記CPUが次以降に実行
すべき命令を先取り(プリフェッチ)して格納しておく
命令キューを集積したマイクロコンピュータに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information processing device, and more particularly, to a CPU for performing arithmetic and control on a single semiconductor substrate,
A program memory for storing a program, said C
A fetch pointer indicating the address on the program memory of the instruction to be fetched in the PU, an interface means for fetching data from the outside, and an instruction queue for prefetching (prefetching) and storing the instruction to be executed by the CPU thereafter. The present invention relates to an integrated microcomputer.

【0002】[0002]

【従来の技術】マイクロコンピュータは、演算および制
御を行うCPUと、メモリ、タイマーなどの周辺回路を
1チップ上に収めた集積回路であり、家電製品やOA機
器などあらゆる分野で利用されている。
2. Description of the Related Art A microcomputer is an integrated circuit in which a CPU for arithmetic and control and peripheral circuits such as a memory and a timer are contained on one chip and is used in various fields such as home electric appliances and OA equipment.

【0003】マイクロコンピュータを制御するためのプ
ログラムは、通常マスクROMと呼ばれる読み出し専用
の記憶回路に書き込まれている。マスクROMへのプロ
グラムの書き込みはマイクロコンピュータの製造工程で
行われており、製造後その内容を変更することはできな
い。
A program for controlling the microcomputer is usually written in a read-only memory circuit called a mask ROM. The program is written in the mask ROM in the manufacturing process of the microcomputer, and its contents cannot be changed after manufacturing.

【0004】このため、ユーザーが製品を受け取った後
にプログラム中にバグが発見された場合、プログラムの
内容を書き換えることができないため、それらの製品は
すべて無駄となってしまい、再び発注、製造し直さなけ
ればならないことになる。一月当たり膨大な数量の製品
が製造される家電製品等にマイクロコンピュータが搭載
される場合、その損害は莫大なものとなる。
Therefore, if a bug is found in the program after the user receives the product, the contents of the program cannot be rewritten, and all the products are wasted, and the order and the manufacturing process are repeated. It will have to be done. If a microcomputer is installed in a home electric appliance or the like, which produces a huge number of products per month, the damage will be enormous.

【0005】この膨大な損害を回避するために、本発明
と同一出願人により出願された特願平5−215616
号には、マイクロコンピュータ製造後に、プログラムの
バグが存在するアドレスの実行を回避して、修正後のプ
ログラムを実行できるマイクロコンピュータを提供する
ことを目的として、次のような方法が提案されている。
以下これを従来例として説明する。
In order to avoid this enormous damage, Japanese Patent Application No. 5-215616 filed by the same applicant as the present invention.
In order to provide a microcomputer capable of executing a corrected program by avoiding execution of an address having a bug in the program after manufacturing the microcomputer, the following method is proposed. .
This will be described below as a conventional example.

【0006】図5に、前記特願平5−215616号に
提案されるマイクロコンピュータの概略構成をブロック
図にて示す。
FIG. 5 is a block diagram showing a schematic configuration of a microcomputer proposed in Japanese Patent Application No. 5-215616.

【0007】図5を参照して、プログラムカウンタ23
は、CPU24が実行すべき命令が格納されているアド
レスを順次指し示すカウンタである。ROM3は、読み
出し専用のメモリで、ここにプログラムが書き込まれて
おり、アドレスバス2、データバス11と接続されてい
る。アドレスバス2にはアドレスデータが送出され、デ
ータバス11はデータの転送を行う。
Referring to FIG. 5, program counter 23
Is a counter that sequentially indicates the addresses at which the instructions to be executed by the CPU 24 are stored. The ROM 3 is a read-only memory in which a program is written and is connected to the address bus 2 and the data bus 11. Address data is sent to the address bus 2, and the data bus 11 transfers the data.

【0008】RAM4は、読み書き可能なメモリで、ア
ドレスバス2、データバス11と接続されている。シリ
アルインタフェース10は、メモリ14とデータバス
2、アドレスバス11と接続されており、メモリ14か
らデータを取り込み、そのデータをデータバス11に送
出する。
The RAM 4 is a readable / writable memory and is connected to the address bus 2 and the data bus 11. The serial interface 10 is connected to the memory 14, the data bus 2, and the address bus 11, fetches data from the memory 14 and sends the data to the data bus 11.

【0009】マイクロコンピュータ25の外部に配置さ
れたメモリ14には、プログラムのバグ部分の先頭アド
レスと修正プログラムが格納されている。
The memory 14 arranged outside the microcomputer 25 stores the start address of the bug part of the program and the correction program.

【0010】レジスタ6は、バグ部分の先頭アドレスデ
ータを格納しておくための記憶回路である。比較回路5
は、レジスタ6との内容プログラムカウンタ23の内容
とを比較し、これらが一致した場合にハイレベルとさ
れ、一致していない場合にはロウレベルとされる選択信
号12を出力する。
The register 6 is a memory circuit for storing the head address data of the bug part. Comparison circuit 5
Compares the content of the content program counter 23 with the content of the register 6 and outputs a selection signal 12 which is set to a high level when they match and is set to a low level when they do not match.

【0011】分岐命令出力回路9は、RAM4に格納さ
れる修正プログラムの先頭アドレスへの分岐命令を選択
回路8へ出力する。選択回路8は、選択信号12を受
け、選択信号12がハイレベルのときは分岐命令出力回
路からの分岐命令を、ロウレベルのときにはROM3又
はRAM4上のプログラムをCPU24へ出力する。C
PU24では入力された命令を解読・実行し、これによ
りプログラムが実行される。
The branch instruction output circuit 9 outputs a branch instruction to the start address of the correction program stored in the RAM 4 to the selection circuit 8. The selection circuit 8 receives the selection signal 12 and outputs the branch instruction from the branch instruction output circuit when the selection signal 12 is at the high level, and outputs the program on the ROM 3 or RAM 4 to the CPU 24 when the selection signal 12 is at the low level. C
The PU 24 decodes / executes the input instruction, thereby executing the program.

【0012】次に、図5を参照して、特願平5−215
616号に提案されるマイクロコンピュータの動作を説
明する。
Next, referring to FIG. 5, Japanese Patent Application No. 5-215
The operation of the microcomputer proposed in No. 616 will be described.

【0013】まず、システム初期化時において、メモリ
14からシリアルインタフェース10を介して、バグ部
分の先頭アドレスデータがレジスタ6にセットされ、修
正プログラムがRAM4中にロードされる。
First, at the time of system initialization, the head address data of the bug portion is set in the register 6 from the memory 14 via the serial interface 10, and the correction program is loaded into the RAM 4.

【0014】ROM3上のプログラムがCPU24によ
り実行され、それとともにプログラムカウンタ23がカ
ウントアップされる。
The program on the ROM 3 is executed by the CPU 24, and the program counter 23 is counted up at the same time.

【0015】そして、プログラムカウンタ23の内容が
レジスタ6にセットされているバグ部分の先頭アドレス
と一致すると、比較回路5からハイレベルの選択信号1
2が出力され、選択回路8は、ROM3又はRAM4上
のプログラムをCPU24への転送することをを中止し
て、分岐命令出力回路9からの分岐命令をCPU24に
転送する。
When the contents of the program counter 23 match the start address of the bug portion set in the register 6, the comparison circuit 5 outputs the high-level selection signal 1
2 is output, and the selection circuit 8 stops the transfer of the program on the ROM 3 or RAM 4 to the CPU 24, and transfers the branch instruction from the branch instruction output circuit 9 to the CPU 24.

【0016】CPU24は、分岐命令出力回路9からの
分岐命令を実行し、プログラムカウンタ23がRAM4
上の修正プログラムの先頭アドレスにセットされ、CP
U24は修正プログラムを実行することになる。
The CPU 24 executes the branch instruction from the branch instruction output circuit 9, and the program counter 23 makes the RAM 4
Set to the top address of the above fix, CP
U24 will run the fix.

【0017】そして、修正プログラムの最後の部分に、
バグ部分後のアドレスへの分岐命令を挿入しておくこと
により、元のプログラムに戻ることができる。
Then, at the last part of the modification program,
By inserting a branch instruction to the address after the bug part, it is possible to return to the original program.

【0018】このような方法により、ROM3に格納さ
れたプログラムのバグ部分を回避し、RAM4上の修正
プログラムを実行させ、バグの修正を行うことができ
る。
By such a method, the bug portion of the program stored in the ROM 3 can be avoided, the correction program on the RAM 4 can be executed, and the bug can be corrected.

【0019】[0019]

【発明が解決しようとする課題】近年、マイクロコンピ
ュータの処理速度を向上させるためのさまざまな設計方
式が開発され利用されており、その一つに命令キューを
利用する方式がある。
In recent years, various design methods for improving the processing speed of a microcomputer have been developed and used, and one of them is a method using an instruction queue.

【0020】通常のマイクロコンピュータでは、CPU
の命令の取り込み、命令の解読、命令の実行という処理
が順次的に行われていた。このため、命令の取り込むた
めに要する時間が命令実行時間の中で比較的大きな比率
を占めていた。
In a normal microcomputer, the CPU
The processes of fetching instructions, decoding instructions, and executing instructions were sequentially performed. For this reason, the time required to fetch an instruction occupies a relatively large proportion in the instruction execution time.

【0021】そこで、CPU内において、命令取込み段
階と命令解読段階との間に複数の命令を格納可能な記憶
回路から成る命令キュー(「命令バッファ」、あるいは
「プリフェッチ・キュー」ともいう)を具備し、CPU
が一の命令を解読・実行している間にバスの空き時間等
を有効に利用して、次の命令を先取り(プリフェッチ)
して命令キューに格納しておくようにする。
Therefore, the CPU is provided with an instruction queue (also referred to as "instruction buffer" or "prefetch queue") composed of a memory circuit capable of storing a plurality of instructions between the instruction fetching step and the instruction decoding step. And CPU
Preempts the next instruction by effectively utilizing the free time of the bus while decoding and executing one instruction
And store it in the instruction queue.

【0022】これにより、一の命令の実行が終わると直
ちにCPUは命令キューに格納されている次の命令を実
行することが可能とされ、命令をCPUに取り込むため
の時間を短縮することができる。すなわち、一の命令の
実行サイクルと他の命令の命令取り込みサイクルがオー
バラップしてパイプライン化される。
As a result, the CPU can execute the next instruction stored in the instruction queue immediately after the execution of one instruction is completed, and the time for fetching the instruction into the CPU can be shortened. . That is, the execution cycle of one instruction and the instruction fetch cycle of another instruction are overlapped and pipelined.

【0023】従って、この命令キューの採用により、C
PUの命令実行速度が上がり、マイクロコンピュータの
処理速度は格段に向上している。
Therefore, by adopting this instruction queue, C
The instruction execution speed of the PU has increased, and the processing speed of the microcomputer has significantly improved.

【0024】ところが、命令キューを有するマイクロコ
ンピュータにおいては、前記従来例を利用することはで
きないという問題がある。以下にその理由を詳説する。
However, in the microcomputer having the instruction queue, there is a problem that the conventional example cannot be used. The reason will be described in detail below.

【0025】もし、従来例をそのまま利用しようとした
場合、プログラムカウンタがバグ部分の先頭アドレスに
到達した時点では、命令キュー内にはすでに先取り(プ
リフェッチ)されたいくつかの命令が取り込まれてお
り、その中にバグ部分も先取りされて当然含まれてしま
っていることになる。
If the conventional example is used as it is, at the time when the program counter reaches the start address of the bug portion, some prefetched (prefetched) instructions are already fetched in the instruction queue. , Of course, the bug part is also preempted and included in it.

【0026】このため、バグ部分の命令後に分岐命令が
命令キュー内に取り込まれることになり、CPUはバグ
部分を実行してから、分岐命令を実行することになる。
従って、バグ部分の実行の回避はできない。
Therefore, the branch instruction is taken into the instruction queue after the instruction of the bug portion, and the CPU executes the branch instruction after executing the bug portion.
Therefore, execution of the bug part cannot be avoided.

【0027】また、プログラムカウンタがバグ部分の先
頭アドレスに達したときに、命令キューからではなく、
分岐命令出力回路からの信号を直接CPUに入力すれ
ば、バグ部分の実行は確かに回避されるが、命令キュー
はCPUの処理速度を上げるためCPU内に具備された
ものであるため、この方法を実現するにはCPUの大幅
な改造が必要となる。
Further, when the program counter reaches the start address of the bug part, instead of from the instruction queue,
If the signal from the branch instruction output circuit is directly input to the CPU, the execution of the bug part is surely avoided, but this method is provided because the instruction queue is provided in the CPU to increase the processing speed of the CPU. In order to realize the above, a major modification of the CPU is required.

【0028】マイクロコンピュータにおいて、CPUは
最も枢要な回路ユニットであり、基盤となる部分である
ため、回路的な欠陥があるならまだしも、これを改造す
ることは望ましくない。
In a microcomputer, the CPU is the most important circuit unit and is the base portion, so if there is a circuit defect, it is not desirable to modify it.

【0029】そのため、CPU自体を改造するのではな
く、周辺回路を追加又は変更することにより、マイクロ
コンピュータの機能追加を行うことが好ましい。
Therefore, it is preferable to add the function of the microcomputer by adding or changing the peripheral circuit instead of modifying the CPU itself.

【0030】本発明は、このような問題を鑑みてなされ
たものであり、本発明の目的は、命令の先取り(プリフ
ェッチ)を行うための命令キューを有するROM内蔵型
マイクロコンピュータにおいて、内蔵ROM上のプログ
ラムにバグが存在する場合に、バグ部分の実行を回避
し、それに代わるプログラムを実行させることにより、
正常に動作させることを可能とするマイクロコンピュー
タを提供することにある。
The present invention has been made in view of the above problems, and an object of the present invention is to provide a built-in ROM in a ROM built-in microcomputer having an instruction queue for prefetching instructions. If there is a bug in this program, by avoiding the execution of the bug part and executing the alternative program,
It is to provide a microcomputer that can operate normally.

【0031】[0031]

【課題を解決するための手段】前記目的は、本発明によ
れば、プリフェッチされた命令を格納する命令キュー
と、プログラムを格納するROMと、を少なくとも含む
マイクロコンピュータにおいて、所定のアドレス情報を
記憶するレジスタと、所定の分岐命令を出力する分岐命
令出力部と、を備え、命令を先取りするために出力され
るプリフェッチアドレスと前記レジスタの内容とが一致
した際に、前記命令キューに前記分岐命令出力部から出
力される分岐命令を供給するように制御する、ことを特
徴とするマイクロコンピュータによって達成される。
According to the present invention, the object is to store predetermined address information in a microcomputer including at least an instruction queue for storing prefetched instructions and a ROM for storing a program. Register and a branch instruction output unit for outputting a predetermined branch instruction, and when the prefetch address output for prefetching the instruction matches the content of the register, the branch instruction is added to the instruction queue. This is achieved by a microcomputer characterized by controlling to supply a branch instruction output from an output unit.

【0032】本発明においては、前記レジスタには外部
から値が設定されるように構成されたことを特徴とす
る。
The present invention is characterized in that a value is externally set in the register.

【0033】また、本発明においては、別の視点におい
て、前記分岐命令出力部が、分岐命令における分岐先ア
ドレスを記憶する分岐先アドレスレジスタを備え、前記
分岐先アドレスレジスタには外部から値が設定されるよ
うに構成されたことを特徴とすることを特徴とする。
Further, in another aspect of the present invention, the branch instruction output unit includes a branch destination address register for storing a branch destination address in the branch instruction, and a value is externally set in the branch destination address register. It is characterized by being configured as described above.

【0034】そして、本発明は、好ましい態様として、
単一半導体基板上に、演算および制御を行うCPU、プ
ログラムを格納するためのプログラムメモリ、前記CP
Uに取り込むべき命令のプログラムメモリ上のアドレス
を示すフェッチポインタ、外部からデータを取り込むた
めのインタフェース手段、及び前記CPUが次以降に実
行すべき命令を格納しておく命令キュー、を集積したマ
イクロコンピュータにおいて、前記インタフェース手段
を介してマイクロコンピュータ外部から取り込んだ所定
のアドレス情報を記憶する記憶手段と、前記記憶手段に
記憶されたアドレス情報と前記フェッチポインタの内容
とを比較し、その比較結果に基づき選択信号を出力する
比較手段と、前記CPUの実行すべきプログラムのアド
レスを変更するための分岐命令を出力する分岐命令出力
手段と、前記選択信号が真のとき前記分岐命令を、偽の
とき前記プログラムメモリの内容を、前記命令キューに
出力する選択手段と、を備え、前記CPUが前記プログ
ラムメモリ上のプログラムを実行していく上で、前記イ
ンタフェース手段を介して取り込んだ前記記憶手段のア
ドレス情報と前記フェッチポインタの内容とが一致した
場合、前記CPUが前記分岐命令出力手段から出力され
た分岐命令を実行して、前記CPUが次に実行すべきア
ドレスの変更を行う、ように構成されたことを特徴とす
るマイクロコンピュータを提供する。
The present invention, in a preferred embodiment,
CPU for arithmetic and control, program memory for storing programs, and CP on a single semiconductor substrate
A microcomputer in which a fetch pointer indicating an address on the program memory of an instruction to be fetched in U, an interface means for fetching data from the outside, and an instruction queue in which the CPU stores an instruction to be executed thereafter is integrated. In the storage means for storing predetermined address information fetched from the outside of the microcomputer through the interface means, the address information stored in the storage means and the contents of the fetch pointer are compared, and based on the comparison result. Comparing means for outputting a selection signal, branch instruction output means for outputting a branch instruction for changing the address of the program to be executed by the CPU, the branch instruction when the selection signal is true, and the branch instruction when the selection signal is false Selection means for outputting the contents of the program memory to the instruction queue When the CPU executes the program on the program memory and the address information of the storage means fetched via the interface means and the content of the fetch pointer match, the CPU is A microcomputer configured to execute a branch instruction output from the branch instruction output means to change an address to be executed next by the CPU.

【0035】また、本発明は、別の好ましい態様とし
て、単一半導体基板上に、演算および制御を行うCP
U、プログラムを格納するためのプログラムメモリ、前
記CPUに取り込むべき命令のプログラムメモリ上のア
ドレスを示すフェッチポインタ、外部からデータを取り
込むためのインタフェース手段、前記CPUが次以降に
実行すべき命令を格納しておく命令キューを集積したマ
イクロコンピュータにおいて、前記インタフェース手段
を介してマイクロコンピュータ外部から取り込んだ複数
の所定のアドレス情報を記憶する複数の記憶手段と、前
記複数の記憶手段の内容と前記フェッチポインタの内容
とを比較し、その結果に基づき一又は複数の選択信号を
出力する、一又は複数の比較手段と、前記CPUの実行
すべきプログラムのアドレスを変更するための一又は複
数の分岐命令を出力する一又は複数の分岐命令出力手段
と、前記選択信号が全て偽のとき前記プログラムメモリ
の内容を前記命令キューに出力し、それ以外の時は前記
選択信号により選択された一の分岐命令出力手段からの
分岐命令を出力する選択手段と、を備え、前記CPUが
前記プログラムメモリ上のプログラムを実行していく上
で、前記インタフェース手段を介して取り込んだ前記複
数の記憶手段のいずれか一のアドレス情報と前記フェッ
チポインタの内容とが一致した場合、前記CPUが選択
された分岐命令出力手段からの前記分岐命令を実行し、
前記CPUが次に実行すべきアドレスの変更を行う、よ
うに構成されたことを特徴とするマイクロコンピュータ
を提供する。
As another preferred embodiment of the present invention, a CP for performing calculation and control on a single semiconductor substrate.
U, a program memory for storing a program, a fetch pointer indicating an address on the program memory of an instruction to be fetched in the CPU, an interface means for fetching data from the outside, and an instruction to be executed by the CPU from the next time onward. In a microcomputer in which instruction queues are accumulated, a plurality of storage means for storing a plurality of predetermined address information fetched from the outside of the microcomputer through the interface means, contents of the plurality of storage means and the fetch pointer And one or a plurality of comparison means for outputting one or a plurality of selection signals based on the result, and one or a plurality of branch instructions for changing the address of the program to be executed by the CPU. One or more branch instruction output means for outputting, and the selection signal Selection means for outputting the content of the program memory to the instruction queue when all are false, and for outputting a branch instruction from one branch instruction output means selected by the selection signal otherwise. When the CPU executes the program on the program memory and the address information of any one of the plurality of storage means fetched via the interface means and the content of the fetch pointer match, the CPU Executes the branch instruction from the selected branch instruction output means,
There is provided a microcomputer configured such that the CPU changes an address to be executed next.

【0036】本発明は、別の視点において、好ましい態
様として、単一半導体基板上に、演算および制御を行う
CPU、プログラムを格納するためのプログラムメモ
リ、前記CPUに取り込むべき命令のプログラムメモリ
上のアドレスを示すフェッチポインタ、外部からデータ
を取り込むためのインタフェース手段、前記CPUが次
以降に実行すべき命令を格納しておく命令キューを集積
したマイクロコンピュータにおいて、前記インタフェー
ス手段を介してマイクロコンピュータ外部に配設された
記憶手段から取り込んだ修正アドレス情報と分岐先アド
レス情報とをそれぞれ記憶するための修正アドレス記憶
手段、及び分岐先アドレス記憶手段を備え、さらに、前
記修正アドレス記憶手段と前記フェッチポインタとの内
容を比較し、その比較結果に基づき選択信号を出力する
比較手段と、前記CPUの実行すべきプログラムのアド
レスを前記分岐先アドレス記憶手段の内容に変更するた
めの分岐命令を出力する分岐命令出力手段と、前記選択
信号が真のとき前記分岐命令を、偽のとき前記プログラ
ムメモリの内容を前記命令キューに出力する選択手段
と、を備え、前記CPUが前記プログラムメモリ上のプ
ログラムを実行していく上で、前記インタフェース手段
を介して取り込んだ前記修正アドレス記憶手段の修正ア
ドレス情報と前記フェッチポインタの内容とが一致した
場合、前記CPUが前記分岐先アドレス記憶手段中のア
ドレスへの分岐命令を実行し、前記CPUが次に実行す
べきアドレスの変更を行う、ように構成されたことを特
徴とするマイクロコンピュータを提供する。
According to another aspect of the present invention, in a preferred mode, a CPU for performing calculation and control, a program memory for storing programs, and a program memory for instructions to be stored in the CPU are provided on a single semiconductor substrate. In a microcomputer in which a fetch pointer indicating an address, an interface means for fetching data from the outside, and an instruction queue for storing an instruction to be executed by the CPU afterward are integrated, the microcomputer is externally provided via the interface means. A correction address storage unit for storing the correction address information and the branch destination address information fetched from the storage unit provided, and a branch destination address storage unit are provided, and further, the correction address storage unit and the fetch pointer. Compare the contents of and the ratio Comparing means for outputting a selection signal based on the result; branch instruction outputting means for outputting a branch instruction for changing the address of the program to be executed by the CPU to the contents of the branch destination address storing means; Selection means for outputting the branch instruction when true and outputting the contents of the program memory to the instruction queue when false, and the interface means for the CPU to execute the program on the program memory. When the corrected address information of the corrected address storage means fetched via the register and the contents of the fetch pointer match, the CPU executes a branch instruction to the address in the branch destination address storage means, and the CPU executes the next instruction. A microcomputer configured to change an address to be executed in .

【0037】さらに、本発明は、別の好ましい態様とし
て、単一半導体基板上に、演算および制御を行うCP
U、プログラムを格納するためのプログラムメモリ、前
記CPUに取り込むべき命令のプログラムメモリ上のア
ドレスを示すフェッチポインタ、外部からデータを取り
込むためのインタフェース手段、前記CPUが次以降に
実行すべき命令を格納しておく命令キューを集積したマ
イクロコンピュータにおいて、前記インタフェース手段
を介しマイクロコンピュータ外部の記憶手段から取り込
んだ複数の修正アドレス情報と複数の分岐先アドレス情
報とをそれぞれ記憶するための複数の修正アドレス記憶
手段及び複数の修正アドレス記憶手段を備え、さらに、
前記複数の修正アドレス記憶手段とフェッチポインタの
内容を比較し、その結果に基づき一又は複数の選択信号
を出力する一又は複数の比較手段と、前記CPUの実行
すべきプログラムのアドレスを前記分岐先アドレス記憶
手段の内容に変更するための分岐命令を出力する一又は
複数の分岐命令出力手段と、前記複数の選択信号が全て
偽のとき前記プログラムメモリの内容を、それ以外の時
は前記選択信号にて選択された分岐命令出力手段からの
分岐命令を前記命令キューに出力する選択手段と、を備
え、前記CPUが前記プログラムメモリ上のプログラム
を実行していく上で、前記インタフェース手段を介し取
り込んだ前記複数の修正アドレス記憶手段のいずれか一
の修正アドレス情報と前記フェッチポインタの内容とが
一致した場合、前記CPUが前記複数の分岐先アドレス
記憶手段のうち選択された分岐先アドレス記憶手段のア
ドレスへの分岐命令を実行し、前記CPUが次に実行す
べきアドレスの変更を行う、ことを特徴とするマイクロ
コンピュータマイクロコンピュータを提供する。
Further, in another preferred embodiment of the present invention, a CP that performs calculation and control on a single semiconductor substrate.
U, a program memory for storing a program, a fetch pointer indicating an address on the program memory of an instruction to be fetched in the CPU, an interface means for fetching data from the outside, and an instruction to be executed by the CPU from the next time onward. A plurality of modified address storages for storing a plurality of modified address information and a plurality of branch destination address information fetched from storage means outside the microcomputer via the interface means Means and a plurality of modified address storage means, and further,
One or a plurality of comparing means for comparing the contents of the plurality of modified address storage means and the contents of the fetch pointer and outputting one or a plurality of selection signals based on the result, and the address of the program to be executed by the CPU as the branch destination. One or a plurality of branch instruction output means for outputting a branch instruction for changing to the contents of the address storage means, the contents of the program memory when the plurality of selection signals are all false, and the selection signal otherwise. Selection means for outputting the branch instruction from the branch instruction output means selected in step 1 to the instruction queue, and the CPU fetches it via the interface means when executing the program on the program memory. If the correction address information of any one of the plurality of correction address storage means and the content of the fetch pointer match, A micro-processor, wherein a CPU executes a branch instruction to an address of a branch-destination address storage means selected from the plurality of branch-destination address storage means, and the CPU changes an address to be executed next. Provide a computer microcomputer.

【0038】[0038]

【作用】本発明によれば、外部からレジスタにバグ部分
のアドレス情報を与え、プログラムを実行していく過程
でフェッチポインタの内容がレジスタの内容と一致した
時点で、選択回路から予め定められた所定の分岐命令を
命令キューへ転送し、CPUが該分岐命令を実行するこ
とにより、バグ部分の実行を回避し、別のアドレスに予
め格納されている修正プログラムが実行され、バグ部分
の実行が回避される。
According to the present invention, the address information of the bug portion is given to the register from the outside, and when the content of the fetch pointer matches the content of the register in the process of executing the program, it is predetermined by the selection circuit. By transferring a predetermined branch instruction to the instruction queue and executing the branch instruction by the CPU, the execution of the bug portion is avoided, the correction program stored in advance at another address is executed, and the execution of the bug portion is executed. Avoided.

【0039】本発明は別の視点において、外部からその
値が任意に設定可能な分岐先アドレスを備え、外部RO
Mから修正プログラムをマイクロコンピュータ内に取り
込まなくて済むため、プログラムのイニシャライズルー
チンはバグ先頭アドレスと、分岐先アドレスを各レジス
タに設定するだけでよく、プログラムが簡単化しサイズ
が縮減されると共に、フェッチポインタがバグ部分に達
した際の分岐先アドレスを自由に設定できるため、プロ
グラムや修正プログラムのメモリ上の位置やサイズにつ
いての制約を大幅に緩和し、設計自由度を増大させてい
る。
According to another aspect of the present invention, a branch destination address whose value can be arbitrarily set externally is provided, and the external RO
Since it is not necessary to load the modification program from M into the microcomputer, the program initialization routine only needs to set the bug start address and branch destination address in each register, which simplifies the program and reduces the size and fetches it. Since the branch destination address can be set freely when the pointer reaches the bug part, the restrictions on the memory position and size of the program and the modification program are greatly relaxed, and the degree of freedom in design is increased.

【0040】さらに、本発明においては、マイクロコン
ピュータ内にレジスタと分岐命令発生回路を好ましくは
複数具備することにより、複数のバグに対応して、それ
ぞれ異なる修正を行うことができるようになる。
Further, in the present invention, preferably, the microcomputer is provided with a plurality of registers and a plurality of branch instruction generation circuits, so that different corrections can be made in response to a plurality of bugs.

【0041】[0041]

【実施例】図面を参照して、本発明の実施例を以下に説
明する。
Embodiments of the present invention will be described below with reference to the drawings.

【0042】[0042]

【実施例1】図1は、本発明の第1の実施例の構成を示
すブロック図である。
First Embodiment FIG. 1 is a block diagram showing the structure of the first embodiment of the present invention.

【0043】図1を参照して、フェッチポインタ1は、
ROM3又はRAM4から命令キュー15に取り込むべ
きプログラムのアドレスを示す16ビットのカウンタで
ある。アドレスバス2はアドレスデータを、データバス
11はデータを転送するための16ビットのバスであ
る。
Referring to FIG. 1, the fetch pointer 1 is
It is a 16-bit counter indicating the address of the program to be fetched from the ROM 3 or RAM 4 into the instruction queue 15. The address bus 2 is a 16-bit bus for transferring address data and the data bus 11 is a 16-bit bus for transferring data.

【0044】ROM3は、読み出し専用のメモリで、ア
ドレス0000H〜EFFFH(Hは16進数を表す)
のメモリ空間に対応し、ここにプログラムが格納され
る。RAM3は、読み書き可能なメモリで、アドレスF
000H〜EFFFHのメモリ空間に対応する。
The ROM 3 is a read-only memory and has addresses 0000H to EFFFH (H represents a hexadecimal number).
Corresponding to the memory space of, where the program is stored. The RAM 3 is a readable / writable memory and has an address F.
It corresponds to a memory space of 000H to EFFFH.

【0045】外部に配置されたメモリ14には、バグ部
分の先頭アドレスと修正プログラムが格納されている。
The head address of the bug portion and the correction program are stored in the memory 14 arranged outside.

【0046】シリアルインタフェース10は、メモリ1
4内のバグ部分の先頭アドレスと修正プログラムをマイ
クロコンピュータ13内に取り込む。
The serial interface 10 is the memory 1
The start address of the bug part in 4 and the correction program are loaded into the microcomputer 13.

【0047】レジスタ6は、シリアルインタフェース1
0とデータバス11を介して取り込んだバグ部分の先頭
アドレスを格納記憶する。
The register 6 is a serial interface 1
0 and the head address of the bug portion fetched via the data bus 11 is stored and stored.

【0048】比較回路5は、レジスタ6の内容と、アド
レスバス2を介して入力されたフェッチポインタ1の内
容と、を比較し、これらが互いに一致した場合にはハイ
レベルとされ、一致しなかった場合にはロウレベルとさ
れる選択信号12を出力する。
The comparison circuit 5 compares the contents of the register 6 and the contents of the fetch pointer 1 input via the address bus 2, and if they match each other, it is set to a high level and does not match. If so, the selection signal 12 that is at a low level is output.

【0049】分岐命令出力回路9は、RAM4上のアド
レスF000Hへの分岐命令を出力する。
The branch instruction output circuit 9 outputs a branch instruction to the address F000H on the RAM 4.

【0050】選択回路8は、比較回路5からの選択信号
12がハイレベル(=アクティブ)のときに分岐命令出
力回路9からの分岐命令を命令キュー15に出力し、選
択信号12がロウレベル(=インアクティブ)のときに
はROM3又はRAM4上のプログラムを命令キュー1
5に出力する。
The selection circuit 8 outputs the branch instruction from the branch instruction output circuit 9 to the instruction queue 15 when the selection signal 12 from the comparison circuit 5 is high level (= active), and the selection signal 12 is low level (= active). When inactive), the program on the ROM 3 or RAM 4 is loaded into the instruction queue 1
5 is output.

【0051】命令キュー15は、CPU7が命令を実行
している間に先読み(プリフェッチ)された命令が格納
される5バイトのバッファである。
The instruction queue 15 is a 5-byte buffer that stores instructions prefetched while the CPU 7 is executing the instructions.

【0052】CPU7は、命令キュー15から命令を取
り出し命令デコーダ部(不図示)にて命令を解読し、実
行ユニット(不図示)にて解読された命令を実行する。
The CPU 7 takes out an instruction from the instruction queue 15 and decodes the instruction by an instruction decoder unit (not shown) and executes the decoded instruction by an execution unit (not shown).

【0053】次に、本実施例において、ROM3上のプ
ログラム中にバグが存在する場合に、これを回避する動
作原理を説明する。
Next, in the present embodiment, when a program on the ROM 3 has a bug, the operation principle for avoiding the bug will be described.

【0054】ここで、図2のメモリマップに示すよう
に、プログラムはROM3上のアドレス1000H〜7
FFFHに存在し、そのうちアドレス4000H〜40
0FHにバグが存在するものと仮定する。
Here, as shown in the memory map of FIG. 2, the program has addresses 1000H to 7 on the ROM 3.
Exists in FFFH, of which addresses 4000H-40
Assume there is a bug at 0FH.

【0055】また、図2を参照して、プログラム開始ア
ドレス設定のためのベクター・テーブル0000Hに
は、プログラム開始アドレス1000Hがセットされて
おり、これにより、マイクロコンピュータ13のリセッ
ト解除後、アドレス1000Hがフェッチポインタ1に
セットされ、アドレス1000Hからプログラムの実行
が開始される。
Further, referring to FIG. 2, the program start address 1000H is set in the vector table 0000H for setting the program start address, and as a result, the address 1000H is set after the reset release of the microcomputer 13. The fetch pointer 1 is set, and execution of the program is started from the address 1000H.

【0056】予め、バグの存在を想定して、プログラム
のイニシャライズ部分には、シリアルインタフェース1
0を介して、メモリ14からバグ部分の先頭アドレスと
修正プログラムをマイクロコンピュータ13内に取り込
むためのルーチンを挿入しておく。
In advance, assuming that a bug exists, the serial interface 1 is provided in the initialization part of the program.
A routine for loading the start address of the bug portion and the correction program from the memory 14 into the microcomputer 13 via 0 is inserted.

【0057】このイニシャライズ部分の実行により、バ
グ部分の先頭アドレス4000Hと修正プログラムがメ
モリ14からマイクロコンピュータ13内に取り込ま
れ、マイクロコンピュータ13内に取り込まれたバグ部
分の先頭アドレスはレジスタ6にセットされ、また修正
プログラムはRAM4のアドレスF000H以降に格納
される。
By executing this initialization part, the start address 4000H of the bug part and the correction program are loaded from the memory 14 into the microcomputer 13, and the start address of the bug part loaded into the microcomputer 13 is set in the register 6. Further, the correction program is stored in the RAM 4 at and after the address F000H.

【0058】この後、フェッチポインタ1がバグ部分の
先頭アドレスに達するまで、CPU7はROM3上のプ
ログラムを実行し続ける。
After that, the CPU 7 continues to execute the program on the ROM 3 until the fetch pointer 1 reaches the start address of the bug part.

【0059】そして、フェッチポインタ1がバグ部分の
先頭アドレスに達すると、すなわちフェッチポインタ1
とレジスタ6の内容とが互いに一致すると、比較回路5
はハイレベルの選択信号12を出力し、選択回路8は選
択信号12を受けてROM3上のプログラムから分岐命
令出力回路9の出力に切り換えて、分岐命令を命令キュ
ー15へ出力する。
When the fetch pointer 1 reaches the start address of the bug part, that is, the fetch pointer 1
And the contents of the register 6 match each other, the comparison circuit 5
Outputs a high-level selection signal 12, and the selection circuit 8 receives the selection signal 12 and switches from the program on the ROM 3 to the output of the branch instruction output circuit 9, and outputs the branch instruction to the instruction queue 15.

【0060】ここで分岐命令出力回路9は、アドレスF
000Hへの分岐命令「BR !F000H」を出力す
るため、CPU7は、命令キュー15からの分岐命令を
受け取り実行する。
Here, the branch instruction output circuit 9 determines the address F
In order to output the branch instruction “BR! F000H” to 000H, the CPU 7 receives the branch instruction from the instruction queue 15 and executes it.

【0061】一般に、分岐命令の実行により命令キュー
の内容はクリアされるよう構成され手折り、分岐命令に
より命令キュー15の内容はクリアされる。また、フェ
ッチポインタ1はF000Hにセットされ、図2に示す
ように、RAM4上の修正プログラムがCPU7により
実行されることになる。
Generally, the contents of the instruction queue are configured to be cleared by executing a branch instruction, and the contents of the instruction queue 15 are cleared by a manual folding or branch instruction. Further, the fetch pointer 1 is set to F000H, and the correction program on the RAM 4 is executed by the CPU 7, as shown in FIG.

【0062】修正プログラムの最後の部分に、アドレス
4010Hへの分岐命令「BR !4010H」を入れ
ておくことにより、修正プログラム実行後、元のROM
3上のプログラムに戻り、本来のプログラムが実行され
るようになる。
By inserting the branch instruction "BR! 4010H" to the address 4010H in the last portion of the modification program, the original ROM is executed after the modification program is executed.
Returning to the program above 3, the original program will be executed.

【0063】以上のような手順により、ROM3上のプ
ログラムのアドレス4000H〜400FHのバグ部分
を実行せずに、RAM4上のアドレスF000H〜F0
1FHの修正プログラムを実行し、その後再びROM3
上のプログラムを実行させることができる。
According to the above procedure, the addresses F000H to F0 on the RAM 4 are executed without executing the bug part of the addresses 4000H to 400FH of the program on the ROM 3.
Execute the correction program of 1FH, then ROM3 again
You can run the above program.

【0064】本実施例によれば、マイクロコンピュータ
のROM3上のプログラムにバグが発生しても、バグの
修正が可能とされるため、それらのマイクロコンピュー
タを廃棄せずに有効に利用することを可能とし、損失を
回避するものである。
According to this embodiment, even if a bug occurs in the program on the ROM 3 of the microcomputer, it is possible to correct the bug. Therefore, it is possible to effectively use these microcomputers without discarding them. It is possible and avoids loss.

【0065】そして、本実施例においては、修正プログ
ラムのプログラムサイズは固定されていないため、単に
バグの修正に対処するためだけでなく、新たなプログラ
ムの追加等に利用することができる。
In this embodiment, since the program size of the correction program is not fixed, it can be used not only for correcting the bug but also for adding a new program.

【0066】[0066]

【実施例2】次に本発明の第2の実施例を説明する。図
3は本発明の第2の実施例の構成を示すブロック図であ
る。図3において、図1と同一の機能を有する要素には
同一の参照番号が附されている。
Second Embodiment Next, a second embodiment of the present invention will be described. FIG. 3 is a block diagram showing the configuration of the second embodiment of the present invention. In FIG. 3, elements having the same functions as those in FIG. 1 are designated by the same reference numerals.

【0067】本実施例は、外部メモリ領域をもつマイク
ロコンピュータに本発明を適用したものである。すなわ
ち、本実施例に係るマイクロコンピュータはポートを通
じて外部のメモリとのアクセスが可能とされ、また、分
岐命令の分岐先を全てのメモリ空間へ設定することが可
能とされる構成となっている。
In this embodiment, the present invention is applied to a microcomputer having an external memory area. That is, the microcomputer according to the present embodiment is configured to be able to access the external memory through the port and set the branch destination of the branch instruction in all memory spaces.

【0068】以下では、本実施例と前記第1の実施例と
の相違点のみを説明する。図3を参照して、外部ROM
21は、専用の装置を使うことによりユーザーが書き込
み可能なメモリであり、外部バス20を通じてポート1
9と接続されている。外部ROM21のメモリ空間は、
アドレス8000H〜FFFFH(図4参照)とされ
る。
Only the differences between this embodiment and the first embodiment will be described below. Referring to FIG. 3, external ROM
Reference numeral 21 is a memory writable by the user by using a dedicated device, and is a port 1 through the external bus 20.
9 is connected. The memory space of the external ROM 21 is
The addresses are 8000H to FFFFH (see FIG. 4).

【0069】外部バス20は、16ビット幅のバスであ
る。ポート19は、アドレスバス2から受け取ったアド
レス信号を外部ROM21に送り、外部ROM21から
受け取ったデータをデータバス11に出力する。
The external bus 20 is a 16-bit wide bus. The port 19 sends the address signal received from the address bus 2 to the external ROM 21 and outputs the data received from the external ROM 21 to the data bus 11.

【0070】分岐先アドレスレジスタ18は、分岐命令
出力回路17から出力される分岐命令の分岐先アドレス
を設定するための記憶回路で、この回路を具備すること
により任意のアドレスに分岐することが可能になる。
The branch destination address register 18 is a memory circuit for setting the branch destination address of the branch instruction output from the branch instruction output circuit 17, and by providing this circuit, it is possible to branch to an arbitrary address. become.

【0071】次に、本実施例の動作について説明する。
図4に本実施例に係るマイクロコンピュータのメモリマ
ップを示す。
Next, the operation of this embodiment will be described.
FIG. 4 shows a memory map of the microcomputer according to this embodiment.

【0072】図4を参照して、マイクロコンピュータ2
2のメモリ空間において、プログラムは、ROM16の
アドレス1000H〜7FFFH、及び外部ROM21
のアドレス8000H〜AFFFHに格納されているも
のとする。
Referring to FIG. 4, the microcomputer 2
In the memory space of No. 2, the program is the address 1000H to 7FFFH of the ROM 16 and the external ROM 21.
Are stored at addresses 8000H to AFFFH.

【0073】また、バグ部分は、ROM16のアドレス
4000H〜400FHに存在するものとし、このバグ
部分を修正する修正プログラムは外部ROM21上のア
ドレスC000H〜C02FHに格納されており、バグ
部分の先頭アドレスデータ「4000H」は外部ROM
21上のアドレスF000H〜F001H(2バイト)
に、修正プログラムの先頭アドレスである分岐先アドレ
スデータ「C000H」は、外部ROM21上のアドレ
スF002H〜F003Hに格納されているものとす
る。
The bug portion is assumed to exist at the addresses 4000H to 400FH of the ROM 16, and the correction program for correcting the bug portion is stored at the addresses C000H to C02FH on the external ROM 21, and the head address data of the bug portion is stored. "4000H" is an external ROM
Addresses on F21 from F000H to F001H (2 bytes)
Further, it is assumed that the branch destination address data “C000H”, which is the start address of the correction program, is stored in the addresses F002H to F003H on the external ROM 21.

【0074】まず、プログラムのイニシャライズルーチ
ンで外部ROM21上のバグ部分先頭アドレスおよび分
岐先アドレスのデータが、ポート19を介して、それぞ
れレジスタ6、分岐先アドレスレジスタ18に転送され
る。
First, in the program initialization routine, the data of the bug part start address and the branch destination address on the external ROM 21 are transferred to the register 6 and the branch destination address register 18 via the port 19, respectively.

【0075】この結果、レジスタ6には、バグ先頭アド
レス「4000H」、分岐先アドレスレジスタ18には
分岐先アドレスデータ「C000H」がセットされる。
As a result, the bug start address "4000H" is set in the register 6, and the branch destination address data "C000H" is set in the branch destination address register 18.

【0076】引き続き、通常のプログラムが実行され、
フェッチポインタ1が4000Hに達した時点で、命令
キュー15には分岐命令出力回路17からの分岐命令が
取り込まれる。
Then, the normal program is executed,
When the fetch pointer 1 reaches 4000H, the branch instruction from the branch instruction output circuit 17 is fetched into the instruction queue 15.

【0077】この際の分岐命令は、先に設定した分岐先
アドレスレジスタ18の内容に従い、「BR !C00
0H」(アドレスC000Hへの分岐命令)となる。
The branch instruction at this time is "BR! C00" according to the contents of the branch destination address register 18 set previously.
0H ”(branch instruction to address C000H).

【0078】CPU7では、この分岐命令を実行するこ
とにより、図4に示すように、アドレスC000H以降
の修正プログラムが実行される。そして、修正プログラ
ムの最後の部分に「BR !4010H」(アドレス4
010Hへの分岐命令)を入れておき、修正プログラム
実行後、元のROM16上のプログラムが実行されるよ
うにする。
By executing this branch instruction, the CPU 7 executes the correction program after the address C000H as shown in FIG. Then, at the end of the fix, "BR! 4010H" (address 4
A branch instruction to 010H) is inserted so that the program on the original ROM 16 is executed after the correction program is executed.

【0079】以上の方法により、外部ROMを有するマ
イクロコンピュータにおいて、プログラムのバグ部分を
回避し、修正プログラムを実行させることができる。
By the above method, the bug part of the program can be avoided and the correction program can be executed in the microcomputer having the external ROM.

【0080】本発明の第2の実施例によれば、外部RO
Mから修正プログラムをマイクロコンピュータ内に取り
込まなくて済むため、プログラムのイニシャライズルー
チンが簡単化されると共に、フェッチポインタがバグ部
分に達した際の分岐先アドレスを自由に設定できるた
め、プログラムや修正プログラムのメモリ上の位置やサ
イズについての設計自由度を増大させている。
According to the second embodiment of the present invention, the external RO
Since the modification program does not have to be loaded into the microcomputer from M, the program initialization routine is simplified, and the branch destination address can be set freely when the fetch pointer reaches the bug part. It increases the degree of freedom in designing the memory location and size.

【0081】また、本発明の第2の実施例においても、
修正プログラムのプログラムサイズは固定されていない
ため、単にバグの修正に対処するためだけでなく、新た
なプログラムの追加等に利用することができる。
Also, in the second embodiment of the present invention,
Since the program size of the correction program is not fixed, it can be used not only to deal with the bug correction but also to add a new program.

【0081】なお、上記各実施例では、マイクロコンピ
ュータ内に一のレジスタ6と一の分岐命令発生回路9を
備えた構成に基づき説明したが、バグ先頭アドレスを記
憶するレジスタを複数備えると共に、これに対応した分
岐命令先アドレスを出力する分岐命令出力回路9を複数
具備するように構成してもよいことは勿論である。この
場合、比較回路5はフェッチポインタ1の内容と複数の
レジスタの内容とを比較し、内容が一致したレジスタに
対応する分岐命令出力回路の出力が選択回路8を介して
出力される。このように構成することにより、複数のバ
グに対応して、それぞれ異なる修正を行うことができる
ようになる。
In each of the above-described embodiments, the description has been made based on the configuration in which the one register 6 and the one branch instruction generating circuit 9 are provided in the microcomputer, but a plurality of registers for storing the bug start address are provided and It goes without saying that a plurality of branch instruction output circuits 9 for outputting the branch instruction destination address corresponding to the above may be provided. In this case, the comparison circuit 5 compares the contents of the fetch pointer 1 with the contents of a plurality of registers, and the output of the branch instruction output circuit corresponding to the register having the matched contents is output via the selection circuit 8. With this configuration, it is possible to make different corrections for a plurality of bugs.

【0082】以上本発明を上記実施例に即して説明した
が、本発明は、上記態様にのみに限定されるものでな
く、本発明の原理に準ずる各種態様を含む。例えば、上
記実施例で説明したアドレス、データが16ビット構成
のマイクロコンピュータ及びメモリマップ等はあくまで
本発明の理解を容易にするためだけのものと解釈される
べきであり、また、本発明は例えば32ビットマイクロ
コンピュータ等にも同様にして適用できることは勿論で
ある。
Although the present invention has been described with reference to the above embodiments, the present invention is not limited to the above embodiments, but includes various embodiments according to the principle of the present invention. For example, the microcomputer and the memory map in which the address and the data are 16 bits described in the above embodiments should be construed as merely for facilitating the understanding of the present invention. Of course, it can be similarly applied to a 32-bit microcomputer or the like.

【0083】[0083]

【発明の効果】以上説明したように、各請求項に記載さ
れる本発明は下記のような効果を有する。
As described above, the present invention described in each claim has the following effects.

【0084】マイクロコンピュータのROM上のプログ
ラムにバグは発生しても、バグの修正が可能とされるた
め、それらのマイクロコンピュータを廃棄せずに有効に
利用することを可能とし、損失を回避する。
Even if a bug occurs in the program on the ROM of the microcomputer, it is possible to correct the bug. Therefore, it is possible to effectively use those microcomputers without discarding them, and avoid loss. .

【0085】また、デバッグが完全でなくプログラム中
にバグの存在する可能性があっても、後で修正が可能と
されているため、大きな損害の心配なしにマイクロコン
ピュータの発注ができる。
Further, even if the debugging is not complete and there is a possibility that a bug exists in the program, it is possible to fix it later, so that the ordering of the microcomputer can be made without fear of serious damage.

【0086】さらに、修正プログラムのサイズが固定さ
れていないため、単にバグの修正だけでなく、プログラ
ムの追加に本発明を利用することができる。
Further, since the size of the correction program is not fixed, the present invention can be utilized not only for correcting the bug but also for adding the program.

【0087】そして、本発明(請求項2、6、9)によ
れば、バグ先頭アドレスが指定するレジスタには、イン
タフェース又はポート等を介して外部からその値が設定
され、バグの発生箇所に対応して適宜対処することがで
きる。
According to the present invention (claims 2, 6, and 9), the value specified in the register designated by the bug start address is externally set via the interface or port, and the bug occurrence location is set. Corresponding and appropriate measures can be taken.

【0088】また、本発明の別の視点(請求項3、7)
によれば、外部ROMから修正プログラムをマイクロコ
ンピュータ内に取り込まなくて済むため、プログラムの
イニシャライズルーチンが簡易化される。さらに、フェ
ッチポインタがバグ部分に達した際の分岐先アドレスを
自由に設定できるため、プログラムや修正プログラムの
メモリ上の位置やサイズの制約が緩和され、設計自由度
が増大するため、プログラム設計が容易になる。
Another aspect of the present invention (claims 3 and 7).
According to this, since it is not necessary to load the correction program from the external ROM into the microcomputer, the initialization routine of the program is simplified. In addition, the branch destination address when the fetch pointer reaches the bug part can be set freely, so the restrictions on the memory position and size of the program and the modification program are relaxed, and the degree of freedom in design is increased, so that the program design is improved. It will be easier.

【0089】さらにまた、本発明(請求項5、8)によ
ればマイクロコンピュータ内にレジスタと分岐命令発生
回路を複数具備することにより、複数のバグに対して、
それぞれ異なる修正を行うことができるようになる。
Furthermore, according to the present invention (claims 5 and 8), a plurality of registers and branch instruction generation circuits are provided in the microcomputer, so that a plurality of bugs can be prevented.
You will be able to make different modifications.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の第1の実施例に係るマイクロコンピュ
ータの構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a microcomputer according to a first embodiment of the present invention.

【図2】本発明の第1の実施例に係るマイクロコンピュ
ータのメモリマップを示す図である。
FIG. 2 is a diagram showing a memory map of the microcomputer according to the first embodiment of the present invention.

【図3】本発明の第2の実施例に係るマイクロコンピュ
ータの構成を示すブロック図である。
FIG. 3 is a block diagram showing a configuration of a microcomputer according to a second embodiment of the present invention.

【図4】本発明の第2の実施例に係るマイクロコンピュ
ータのメモリマップである。
FIG. 4 is a memory map of the microcomputer according to the second embodiment of the present invention.

【図5】先行技術に係るマイクロコンピュータの構成の
一例を示すブロック図である。
FIG. 5 is a block diagram showing an example of a configuration of a microcomputer according to a prior art.

【符号の説明】[Explanation of symbols]

1 フェッチポインタ 2 アドレスバス 3、16 ROM 4 RAM 5 比較回路 6 レジスタ 7、24 CPU 8 選択回路 9、17 分岐命令出力命令 10 シリアルインタフェース 11 データバス 12 選択信号 13、22、25 マイクロコンピュータ 14 メモリ 15 命令キュー 18 分岐先アドレスレジスタ 19 ポート 20 外部バス 21 外部ROM 23 プログラムカウンタ 1 Fetch Pointer 2 Address Bus 3, 16 ROM 4 RAM 5 Comparison Circuit 6 Register 7, 24 CPU 8 Selection Circuit 9, 17 Branch Instruction Output Instruction 10 Serial Interface 11 Data Bus 12 Selection Signal 13, 22, 25 Microcomputer 14 Memory 15 Instruction queue 18 Branch destination address register 19 Port 20 External bus 21 External ROM 23 Program counter

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】プリフェッチされた命令を格納する命令キ
ューと、プログラムを格納するROMと、を少なくとも
含むマイクロコンピュータにおいて、 所定のアドレス情報を記憶するレジスタと、 所定の分岐命令を出力する分岐命令出力部と、を備え、 命令を先取りするために出力されるプリフェッチアドレ
スと前記レジスタの内容とが一致した際に、前記命令キ
ューに前記分岐命令出力部から出力される分岐命令を供
給するように制御する、ことを特徴とするマイクロコン
ピュータ。
1. A microcomputer including at least an instruction queue for storing prefetched instructions and a ROM for storing programs, a register for storing predetermined address information, and a branch instruction output for outputting a predetermined branch instruction. And a control unit for supplying a branch instruction output from the branch instruction output unit to the instruction queue when the prefetch address output for prefetching the instruction matches the content of the register. A microcomputer characterized by:
【請求項2】前記レジスタには外部から値が設定される
ように構成されたことを特徴とする請求項1記載のマイ
クロコンピュータ。
2. The microcomputer according to claim 1, wherein a value is externally set in the register.
【請求項3】前記分岐命令出力部が、分岐命令における
分岐先アドレスを記憶する分岐先アドレスレジスタを備
え、前記分岐先アドレスレジスタには外部から値が設定
されるように構成されたことを特徴とする請求項1又は
2記載のマイクロコンピュータ。
3. The branch instruction output unit includes a branch destination address register for storing a branch destination address in a branch instruction, and a value is set to the branch destination address register from the outside. The microcomputer according to claim 1 or 2.
【請求項4】単一半導体基板上に、演算および制御を行
うCPU、プログラムを格納するためのプログラムメモ
リ、前記CPUに取り込むべき命令のプログラムメモリ
上のアドレスを示すフェッチポインタ、外部からデータ
を取り込むためのインタフェース手段、及び前記CPU
が次以降に実行すべき命令を格納しておく命令キュー、
を集積したマイクロコンピュータにおいて、 前記インタフェース手段を介してマイクロコンピュータ
外部から取り込んだ所定のアドレス情報を記憶する記憶
手段と、 前記記憶手段に記憶されたアドレス情報と前記フェッチ
ポインタの内容とを比較し、その比較結果に基づき選択
信号を出力する比較手段と、 前記CPUの実行すべきプログラムのアドレスを変更す
るための分岐命令を出力する分岐命令出力手段と、 前記選択信号が真のとき前記分岐命令を、偽のとき前記
プログラムメモリの内容を、前記命令キューに出力する
選択手段と、を備え、 前記CPUが前記プログラムメモリ上のプログラムを実
行していく上で、前記インタフェース手段を介して取り
込んだ前記記憶手段のアドレス情報と前記フェッチポイ
ンタの内容とが一致した場合、前記CPUが前記分岐命
令出力手段から出力された分岐命令を実行して、前記C
PUが次に実行すべきアドレスの変更を行う、 ように構成されたことを特徴とするマイクロコンピュー
タ。
4. A CPU for computing and controlling, a program memory for storing a program, a fetch pointer indicating an address on the program memory of an instruction to be fetched into the CPU, and a data externally fetched on a single semiconductor substrate. Interface means and CPU
Is an instruction queue that stores the instructions to be executed afterwards,
In a microcomputer integrated with, storage means for storing predetermined address information fetched from the outside of the microcomputer through the interface means, comparing the address information stored in the storage means and the content of the fetch pointer, A comparison unit that outputs a selection signal based on the comparison result, a branch instruction output unit that outputs a branch instruction for changing the address of the program to be executed by the CPU, and a branch instruction when the selection signal is true. Selecting means for outputting the contents of the program memory to the instruction queue when false, the CPU fetching via the interface means when the CPU executes the program on the program memory. The address information of the storage means and the content of the fetch pointer match. If the CPU is running a branch instruction output from the branch instruction output unit, the C
A microcomputer configured such that the PU changes the address to be executed next.
【請求項5】単一半導体基板上に、演算および制御を行
うCPU、プログラムを格納するためのプログラムメモ
リ、前記CPUに取り込むべき命令のプログラムメモリ
上のアドレスを示すフェッチポインタ、外部からデータ
を取り込むためのインタフェース手段、前記CPUが次
以降に実行すべき命令を格納しておく命令キューを集積
したマイクロコンピュータにおいて、 前記インタフェース手段を介してマイクロコンピュータ
外部から取り込んだ複数の所定のアドレス情報を記憶す
る複数の記憶手段と、 前記複数の記憶手段の内容と前記フェッチポインタの内
容とを比較し、その結果に基づき一又は複数の選択信号
を出力する、一又は複数の比較手段と、 前記CPUの実行すべきプログラムのアドレスを変更す
るための一又は複数の分岐命令を出力する一又は複数の
分岐命令出力手段と、 前記選択信号が全て偽のとき前記プログラムメモリの内
容を前記命令キューに出力し、それ以外の時は前記選択
信号により選択された一の分岐命令出力手段からの分岐
命令を出力する選択手段と、を備え、 前記CPUが前記プログラムメモリ上のプログラムを実
行していく上で、前記インタフェース手段を介して取り
込んだ前記複数の記憶手段のいずれか一のアドレス情報
と前記フェッチポインタの内容とが一致した場合、前記
CPUが選択された分岐命令出力手段からの前記分岐命
令を実行し、前記CPUが次に実行すべきアドレスの変
更を行う、 ように構成されたことを特徴とするマイクロコンピュー
タ。
5. A single semiconductor substrate on which a CPU for arithmetic and control, a program memory for storing a program, a fetch pointer indicating an address on the program memory of an instruction to be fetched in the CPU, and a data fetched from the outside. Interface means for storing a plurality of predetermined address information fetched from the outside of the microcomputer through the interface means in a microcomputer in which an instruction queue for storing instructions to be executed by the CPU thereafter is integrated. Execution of the plurality of storage means, one or a plurality of comparison means for comparing the contents of the plurality of storage means with the contents of the fetch pointer and outputting one or a plurality of selection signals based on the result, and the CPU One or more branches to change the address of the program to be executed One or more branch instruction output means for outputting a command, and outputs the contents of the program memory to the instruction queue when the selection signals are all false, and one branch selected by the selection signal otherwise. Selecting means for outputting a branch instruction from the instruction output means, and any one of the plurality of storage means fetched via the interface means when the CPU executes the program on the program memory. When the address information of one and the contents of the fetch pointer match, the CPU executes the branch instruction from the selected branch instruction output means, and the CPU changes the address to be executed next. A microcomputer characterized by being configured in.
【請求項6】前記インタフェース手段の代わりに、マイ
クロコンピュータ外部の記憶装置に対して、データのや
り取りを行うためのポートを有する請求項4又は5記載
のマイクロコンピュータ。
6. The microcomputer according to claim 4, further comprising a port for exchanging data with a storage device external to the microcomputer instead of the interface means.
【請求項7】単一半導体基板上に、演算および制御を行
うCPU、プログラムを格納するためのプログラムメモ
リ、前記CPUに取り込むべき命令のプログラムメモリ
上のアドレスを示すフェッチポインタ、外部からデータ
を取り込むためのインタフェース手段、前記CPUが次
以降に実行すべき命令を格納しておく命令キューを集積
したマイクロコンピュータにおいて、 前記インタフェース手段を介してマイクロコンピュータ
外部に配設された記憶手段から取り込んだ修正アドレス
情報と分岐先アドレス情報とをそれぞれ記憶するための
修正アドレス記憶手段、及び分岐先アドレス記憶手段を
備え、さらに、前記修正アドレス記憶手段と前記フェッ
チポインタとの内容を比較し、その比較結果に基づき選
択信号を出力する比較手段と、 前記CPUの実行すべきプログラムのアドレスを前記分
岐先アドレス記憶手段の内容に変更するための分岐命令
を出力する分岐命令出力手段と、 前記選択信号が真のとき前記分岐命令を、偽のとき前記
プログラムメモリの内容を前記命令キューに出力する選
択手段と、を備え、 前記CPUが前記プログラムメモリ上のプログラムを実
行していく上で、前記インタフェース手段を介して取り
込んだ前記修正アドレス記憶手段の修正アドレス情報と
前記フェッチポインタの内容とが一致した場合、前記C
PUが前記分岐先アドレス記憶手段中のアドレスへの分
岐命令を実行し、前記CPUが次に実行すべきアドレス
の変更を行う、 ように構成されたことを特徴とするマイクロコンピュー
タ。
7. A single semiconductor substrate is provided with a CPU for computing and controlling, a program memory for storing a program, a fetch pointer indicating an address on the program memory of an instruction to be loaded into the CPU, and data from outside. Interface means for storing a command queue for storing instructions to be executed by the CPU thereafter, and a modified address fetched from a storage means provided outside the microcomputer via the interface means. And a branch destination address storage unit for respectively storing the information and the branch destination address information, further comparing the contents of the correction address storage unit and the fetch pointer, and based on the comparison result. A comparison means for outputting a selection signal, Branch instruction output means for outputting a branch instruction for changing the address of the program to be executed by the CPU to the contents of the branch destination address storage means; the branch instruction when the selection signal is true, and the program when the selection signal is false Selecting means for outputting the contents of the memory to the instruction queue, and the correction address of the correction address storage means fetched via the interface means when the CPU executes the program on the program memory. If the information and the contents of the fetch pointer match, the C
A microcomputer configured such that a PU executes a branch instruction to an address in the branch destination address storage means, and the CPU changes an address to be executed next.
【請求項8】単一半導体基板上に、演算および制御を行
うCPU、プログラムを格納するためのプログラムメモ
リ、前記CPUに取り込むべき命令のプログラムメモリ
上のアドレスを示すフェッチポインタ、外部からデータ
を取り込むためのインタフェース手段、前記CPUが次
以降に実行すべき命令を格納しておく命令キューを集積
したマイクロコンピュータにおいて、 前記インタフェース手段を介しマイクロコンピュータ外
部の記憶手段から取り込んだ複数の修正アドレス情報と
複数の分岐先アドレス情報とをそれぞれ記憶するための
複数の修正アドレス記憶手段及び複数の修正アドレス記
憶手段を備え、さらに、 前記複数の修正アドレス記憶手段とフェッチポインタの
内容を比較し、その結果に基づき一又は複数の選択信号
を出力する一又は複数の比較手段と、 前記CPUの実行すべきプログラムのアドレスを前記分
岐先アドレス記憶手段の内容に変更するための分岐命令
を出力する一又は複数の分岐命令出力手段と、 前記複数の選択信号が全て偽のとき前記プログラムメモ
リの内容を、それ以外の時は前記選択信号にて選択され
た分岐命令出力手段からの分岐命令を前記命令キューに
出力する選択手段と、を備え、 前記CPUが前記プログラムメモリ上のプログラムを実
行していく上で、前記インタフェース手段を介し取り込
んだ前記複数の修正アドレス記憶手段のいずれか一の修
正アドレス情報と前記フェッチポインタの内容とが一致
した場合、前記CPUが前記複数の分岐先アドレス記憶
手段のうち選択された分岐先アドレス記憶手段のアドレ
スへの分岐命令を実行し、前記CPUが次に実行すべき
アドレスの変更を行う、 ことを特徴とするマイクロコンピュータ。
8. A single semiconductor substrate, a CPU for performing calculation and control, a program memory for storing a program, a fetch pointer indicating an address on the program memory of an instruction to be loaded into the CPU, and a data externally loaded. A plurality of modified address information and a plurality of correction address information fetched from a storage means external to the microcomputer via the interface means, A plurality of modified address storage means and a plurality of modified address storage means for respectively storing the branch destination address information, and further comparing the plurality of modified address storage means with the contents of the fetch pointer, and based on the result. Outputs one or more selection signals One or a plurality of comparing means; one or a plurality of branch instruction outputting means for outputting a branch instruction for changing the address of the program to be executed by the CPU to the content of the branch destination address storing means; Selecting means for outputting the content of the program memory when all the signals are false, and for outputting the branch instruction from the branch instruction output means selected by the selection signal to the instruction queue otherwise. When executing the program on the program memory, if the correction address information of any one of the plurality of correction address storage means fetched via the interface means and the contents of the fetch pointer match, The CPU executes a branch instruction to the address of the branch destination address storage means selected from the plurality of branch destination address storage means. Then, the CPU changes an address to be executed next time, the microcomputer.
【請求項9】前記インタフェース手段の代わりに、マイ
クロコンピュータ外部の記憶装置に対して、データのや
り取りを行うためのポートを有する請求項7又は8記載
のマイクロコンピュータ。
9. The microcomputer according to claim 7, further comprising a port for exchanging data with a storage device external to the microcomputer, instead of the interface means.
JP6252717A 1994-09-22 1994-09-22 Microcomputer Pending JPH0895946A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6252717A JPH0895946A (en) 1994-09-22 1994-09-22 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6252717A JPH0895946A (en) 1994-09-22 1994-09-22 Microcomputer

Publications (1)

Publication Number Publication Date
JPH0895946A true JPH0895946A (en) 1996-04-12

Family

ID=17241281

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6252717A Pending JPH0895946A (en) 1994-09-22 1994-09-22 Microcomputer

Country Status (1)

Country Link
JP (1) JPH0895946A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6829735B1 (en) 1999-06-08 2004-12-07 Nec Electronics Corporation Computer system having a ROM correction unit
US7203867B2 (en) 2002-09-30 2007-04-10 Kabushiki Kaisha Toshiba Processor system, processor and arithmetic processing method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01189728A (en) * 1988-01-25 1989-07-28 Fujitsu Ltd Circuit for updating instruction pre-fetch address
JPH023197A (en) * 1988-06-15 1990-01-08 Nec Corp Dual port memory
JPH0490032A (en) * 1990-08-02 1992-03-24 Olympus Optical Co Ltd Microcomputer
JPH06149559A (en) * 1992-11-02 1994-05-27 Kawasaki Steel Corp One-chip microcomputer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01189728A (en) * 1988-01-25 1989-07-28 Fujitsu Ltd Circuit for updating instruction pre-fetch address
JPH023197A (en) * 1988-06-15 1990-01-08 Nec Corp Dual port memory
JPH0490032A (en) * 1990-08-02 1992-03-24 Olympus Optical Co Ltd Microcomputer
JPH06149559A (en) * 1992-11-02 1994-05-27 Kawasaki Steel Corp One-chip microcomputer

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6829735B1 (en) 1999-06-08 2004-12-07 Nec Electronics Corporation Computer system having a ROM correction unit
DE10028064B4 (en) * 1999-06-08 2006-03-02 Nec Electronics Corp., Kawasaki Computer system with ROM correction units
US7203867B2 (en) 2002-09-30 2007-04-10 Kabushiki Kaisha Toshiba Processor system, processor and arithmetic processing method

Similar Documents

Publication Publication Date Title
US5235686A (en) Computer system having mixed macrocode and microcode
TWI541658B (en) Data processing apparatus and semiconductor integrated circuit device
US20030051122A1 (en) Trace information generation apparatus for generating branch trace information omitting at least part of branch source information and branch destination information on target processing
US10740105B2 (en) Processor subroutine cache
JP4226085B2 (en) Microprocessor and multiprocessor system
US7243372B2 (en) Modified Harvard architecture processor having data memory space mapped to program memory space with erroneous execution protection
US4223381A (en) Lookahead memory address control system
JPH03158928A (en) Data processor
JP3563768B2 (en) ROM program change device
US20230022869A1 (en) Programmable event testing
JP4988082B2 (en) Microprocessor and data processing system
US6986028B2 (en) Repeat block with zero cycle overhead nesting
JPH07120338B2 (en) Method for a data processor to coordinate the execution of instructions by a coprocessor and the data processor
US20050172109A1 (en) Register pointer trap
JPH0764784A (en) Microcomputer
KR19980079596A (en) Method and apparatus for implementing processor quiescent state in multiprocessor system
JPH0895946A (en) Microcomputer
EP1177499B1 (en) Processor and method of executing instructions from several instruction sources
KR20000061574A (en) Micro computer system with compressed instruction
US6425047B1 (en) Process containing address decoders suited to improvements in clock speed
JP2002157115A (en) Data processor
JPS62197831A (en) Data processor
JPH06103109A (en) Data processor and debugging device using the same
JP3097602B2 (en) Data processing device
JP3588951B2 (en) Microcomputer program change device

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 19971209