JPH05150980A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH05150980A
JPH05150980A JP3314407A JP31440791A JPH05150980A JP H05150980 A JPH05150980 A JP H05150980A JP 3314407 A JP3314407 A JP 3314407A JP 31440791 A JP31440791 A JP 31440791A JP H05150980 A JPH05150980 A JP H05150980A
Authority
JP
Japan
Prior art keywords
flag
register
instruction
program
decision
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
JP3314407A
Other languages
Japanese (ja)
Inventor
Kazuhiro Kawasugi
和弘 川杉
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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer 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 Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP3314407A priority Critical patent/JPH05150980A/en
Publication of JPH05150980A publication Critical patent/JPH05150980A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To efficiently execute a program by simplifying an instruction to vary a flag in an assembler program in which branch with a flag condition appears frequently by always performing the decision of a zero flag by a signal from a decoder, and setting a decision result on a flag register. CONSTITUTION:This microcomputer is comprised of a processor unit 10, and main memory 20 connected to the processor unit 10, and it is equipped with an ALU 11, a program counter 12, an A register 13, an instruction decoder 14, the flag registers 15, 16, and a decision circuit 17. When an instruction to always instruct decision on a status flag, for example, the zero flag is executed in the program, such execution is detected by the decoder 14, and hereinafter, the decision on the zero flag is always performed at the decision circuit 17 by the signal from the decoder 14 until the instruction of such decision is cancelled. The decision result is set on the zero flag register 16a of the flag register 16.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、アセンブラ言語のプロ
グラムステップ数を短縮するマイクロコンピュータに関
する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer for reducing the number of program steps in assembler language.

【0002】[0002]

【従来の技術】従来のアセンブラプログラムの簡単な例
を図3に示す。図3(1)はそのプログラムリストの一
部を示すもので、内容を説明すると、まずプログラムの
文番号「10」の「LOAD A,1000」にしたが
ってメモリの「1000」番地の内容をAレジスタ(ア
キュムレータ)にロードさせ、次いで文番号「20」の
「COMP A,0」にしたがってAレジスタの内容と
データ「0」とを比較判断する。このとき、Aレジスタ
の内容が「0」であって両者が等しいと判断すれば、フ
ラグレジスタ(ゼロフラグレジスタ)の内容が「0」と
なるものとする。そして、文番号「30」の「JMPZ
2000」にしたがって該フラグレジスタが「0」で
あればメモリの「2000」番地へジャンプする。
2. Description of the Related Art A simple example of a conventional assembler program is shown in FIG. FIG. 3 (1) shows a part of the program list. To explain the contents, first, the contents of the address "1000" of the memory are registered in the A register according to the "LOAD A, 1000" of the statement number "10" of the program. Then, the contents of the A register and the data “0” are compared and judged according to the statement number “20”, “COMP A, 0”. At this time, if it is determined that the contents of the A register are "0" and the two are equal, the contents of the flag register (zero flag register) will be "0". And the sentence number “30”, “JMPZ
If the flag register is "0" according to "2000", the memory jumps to the address "2000" of the memory.

【0003】上記プログラムにおける各種レジスタとメ
モリの変化を図3(2)に示す。PCはプログラムカウ
ンタ、FRはフラグレジスタ(ゼロフラグレジスタ)、
ACCはAレジスタ(アキュムレータ)を示し、「10
00」〜「2000」はメモリの番地を示す。「LOA
D」命令はフラグの変化を伴わないものとするので、図
中に示すように「LOAD」命令の実行後もフラグレジ
スタの内容は変わらない。そこで、文番号「30」の
「JMPZ」のように「フラグレジスタが「0」であれ
ば」等の条件付きの分岐が必要なときには、必ず、その
前に文番号「20」の「COMP」のようにフラグを変
化させるための比較命令が必要となっていた。
Changes in various registers and memories in the above program are shown in FIG. PC is a program counter, FR is a flag register (zero flag register),
ACC indicates the A register (accumulator), and is "10.
"00" to "2000" indicate memory addresses. "LOA
Since the "D" instruction does not change the flag, the contents of the flag register do not change even after the "LOAD" instruction is executed, as shown in the figure. Therefore, when a conditional branch such as "if the flag register is" 0 "" is required like "JMPZ" of the sentence number "30", the "COMP" of the sentence number "20" must be preceded by it. The comparison instruction for changing the flag is required.

【0004】[0004]

【発明が解決しようとする課題】上述した如くアセンブ
ラプログラムでは、ある種の命令でレジスタの演算にお
いてステータスフラグに変化を生じないものがあり、そ
れがために条件付きの分岐が必要なときにはフラグ判定
用の命令を追加することが必要となっていた。したがっ
て、特にこのような条件付きの分岐が頻出するようなプ
ログラムでは、プログラム全体が不必要に長く、処理効
率の悪いものとなってしまうという不具合があった。
As described above, some assembler programs do not cause a change in the status flag in register operations with certain types of instructions, and when this requires a conditional branch, flag determination is performed. It was necessary to add an instruction for. Therefore, particularly in a program in which such conditional branching frequently occurs, there is a problem that the entire program becomes unnecessarily long and the processing efficiency becomes poor.

【0005】本発明は上記のような実情に鑑みてなされ
たもので、その目的とするところは、フラグの条件が付
いた分岐が頻出するようなプログラムで、該フラグを変
化させるための命令を省略して効率よくプログラムを実
行することが可能なマイクロコンピュータを提供するこ
とにある。
The present invention has been made in view of the above situation, and an object thereof is to provide an instruction for changing a flag in a program in which branches with a condition of the flag frequently appear. It is to provide a microcomputer capable of efficiently executing a program by omitting it.

【0006】[0006]

【課題を解決するための手段及び作用】すなわち本発明
は、特定のステータスフラグ、例えばゼロフラグに対す
る常時判定を指示する命令がプログラム中でなされた場
合にこれをデコーダにて検出し、以後この常時判定の指
示が解除されるまでの間、デコーダからの信号によりゼ
ロフラグの判定を常時行ない、判定結果をフラグレジス
タにセットするようにしたもので、フラグ条件の付いた
分岐が頻出するようなプログラムではフラグを変化させ
るための命令を簡略化してプログラムを効率よく実行す
ることができる。
That is, according to the present invention, when an instruction for instructing constant determination for a specific status flag, for example, a zero flag is made in a program, this is detected by a decoder, and thereafter this constant determination is made. The zero flag is always judged by the signal from the decoder until the instruction of is cancelled, and the judgment result is set in the flag register. It is possible to execute the program efficiently by simplifying the instruction for changing the.

【0007】[0007]

【実施例】以下図面を参照して本発明の一実施例を説明
する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to the drawings.

【0008】図1はその回路構成を示すもので、10がプ
ロセッサユニット、20がこのプロセッサユニット10に接
続されたメインメモリであり、プロセッサユニット10内
にALU11、プログラムカウンタ(PC)12、Aレジス
タ(ACC)13、命令デコーダ14、フラグレジスタ15,
16及び判定回路17を備える。
FIG. 1 shows its circuit configuration. 10 is a processor unit, 20 is a main memory connected to the processor unit 10, and in the processor unit 10, an ALU 11, a program counter (PC) 12, and an A register are provided. (ACC) 13, instruction decoder 14, flag register 15,
16 and a determination circuit 17.

【0009】命令デコーダ14は、特に常時フラグ判定を
行なう「FLAGON」命令をデコードした時にオンと
なる信号を判定回路17のアンド回路17aに、常時フラグ
判定を解除する「FLAGOFF」命令をデコードした
時にオンとなる信号を判定回路17のアンド回路17bのそ
れぞれ出力する。上記Aレジスタ13は各ビット出力を判
定回路17のオア回路17cに送出するもので、このオア回
路17cの出力が上記アンド回路17aに入力される。ま
た、上記フラグレジスタ15は、各種ステータスフラグを
保持するもので、その最下位ビットがゼロフラグレジス
タ15aとなっており、ゼロフラグレジスタ15aを除く他
のフラグ内容がそのままフラグレジスタ16に読出される
一方、ゼロフラグレジスタ15aの内容は上記判定回路17
のアンド回路17bに読出される。そして、アンド回路17
aの出力あるいはアンド回路17bの出力がオア回路17d
を介してフラグレジスタ16の最下位ビットにあるゼロフ
ラグレジスタ(Z)16aに送出される。
When the instruction decoder 14 decodes a "FLAGON" instruction for performing a constant flag determination, it outputs a signal that turns on to the AND circuit 17a of the determination circuit 17 when it decodes a "FLAGOFF" instruction for canceling the constant flag determination. The AND circuit 17b of the determination circuit 17 outputs the signal to be turned on. The A register 13 sends the output of each bit to the OR circuit 17c of the determination circuit 17, and the output of the OR circuit 17c is input to the AND circuit 17a. Further, the flag register 15 holds various status flags, the least significant bit of which is the zero flag register 15a, and other flag contents except the zero flag register 15a are read to the flag register 16 as they are, The contents of the zero flag register 15a are the same as those of the judgment circuit 17 described above.
Is read by the AND circuit 17b. And circuit 17
The output of a or the output of the AND circuit 17b is the OR circuit 17d.
Via the flag register 16 to the zero flag register (Z) 16a in the least significant bit.

【0010】このような構成にあって、図2(1)に示
すようなプログラムリストを実行するものとする。すな
わち、まずプログラムの文番号「1」の「FLAGO
N」の命令にしたがって、以後の全ての命令で上記フラ
グレジスタ16のゼロフラグレジスタ16aの内容を変化さ
せるべく常時フラグ判定の状態を設定する。
With such a configuration, it is assumed that the program list as shown in FIG. 2 (1) is executed. That is, first, the program statement number "1""FLAGO
In accordance with the "N" instruction, the flag determination state is always set to change the contents of the zero flag register 16a of the flag register 16 in all the subsequent instructions.

【0011】次いで、「10」の「LOAD A,10
00」にしたがってメインメモリ20の「1000」番地
の内容をAレジスタ13に転送させ、続いて文番号「2
0」の「JMPZ 2000」にしたがってメインメモ
リ20の「2000」番地へジャンプする。
Next, the "LOAD A, 10
The contents of the address "1000" of the main memory 20 are transferred to the A register 13 according to "00", and then the sentence number "2"
According to "JMPZ 2000" of "0", jump to the address "2000" of the main memory 20.

【0012】その後、上記常時フラグ判定の状態を解除
するべく、文番号「3000」の「FLAGOFF」の
命令にしたがって通常のフラグ判定の状態を設定するも
のである。
Thereafter, in order to cancel the above-mentioned constant flag determination state, the normal flag determination state is set in accordance with the "FLAGOFF" command of the sentence number "3000".

【0013】上記図2(1)のプログラムにおける各種
レジスタとメモリの変化を図2(2)に示し、その説明
を行なう。但し、各種レジスタの構成は上記図3(2)
に示したものと同様であるので、その説明は省略する。
Changes in various registers and memories in the program shown in FIG. 2 (1) are shown in FIG. 2 (2), which will be described. However, the configuration of each register is shown in Fig. 3 (2) above.
The description is omitted because it is the same as that shown in FIG.

【0014】始めの「FLAGON」命令を命令デコー
ダ14がデコードすると、命令デコーダ14は判定回路17の
アンド回路17aへの信号を“H”レベルとする。この信
号によりオア回路17cの出力が有効となり、以後Aレジ
スタ13の全ビット出力の論理和がアンド回路17a、オア
回路17dを介してフラグレジスタ16のゼロフラグレジス
タ16aにセットされることとなる。
When the instruction decoder 14 decodes the first "FLAGON" instruction, the instruction decoder 14 sets the signal to the AND circuit 17a of the decision circuit 17 to "H" level. This signal enables the output of the OR circuit 17c, and thereafter the logical sum of all bit outputs of the A register 13 is set in the zero flag register 16a of the flag register 16 via the AND circuit 17a and the OR circuit 17d.

【0015】したがって、次の「LOAD A,100
0」にしたがってメインメモリ20の「1000」番地の
内容がAレジスタ13に転送され、その内容が「000」
となると、特にフラグを変化させるための命令なしに自
動的にゼロフラグレジスタ16aに「0」がセットされる
こととなる。
Therefore, the following "LOAD A, 100
According to "0", the contents of the address "1000" of the main memory 20 are transferred to the A register 13, and the contents are "000".
In that case, "0" is automatically set in the zero flag register 16a without any instruction for changing the flag.

【0016】その後、次の「JMPZ 2000」にし
たがってゼロフラグレジスタ16aの内容が「0」である
のでメインメモリ20の「2000」番地へジャンプす
る。このときもAレジスタ13の内容は「000」である
ので、図2(2)に示す如くあらためてゼロフラグレジ
スタ16aに「0」がセットされる。
After that, according to the next "JMPZ 2000", since the content of the zero flag register 16a is "0", the program jumps to the address "2000" of the main memory 20. At this time as well, the content of the A register 13 is "000", so that "0" is set again in the zero flag register 16a as shown in FIG.

【0017】以後、順次プログラムが進行し、「FLA
GON」命令を命令デコーダ14がデコードすると、命令
デコーダ14は判定回路17のアンド回路17aへの信号を
“L”レベルにすると同時にアンド回路17bへの信号を
“H”レベルとする。この信号によりフラグレジスタ15
のゼロフラグレジスタ15aの出力が有効となり、フラグ
を変化させるための命令にしたがった通常のフラグ判定
の状態が設定されるものである。
Thereafter, the program progresses in sequence, and "FLA
When the instruction decoder 14 decodes the "GON" instruction, the instruction decoder 14 sets the signal to the AND circuit 17a of the determination circuit 17 to "L" level and simultaneously sets the signal to the AND circuit 17b to "H" level. This signal causes the flag register 15
The output of the zero flag register 15a becomes valid, and the normal flag determination state according to the instruction for changing the flag is set.

【0018】上記のようにすれば、「FLAGON」を
設定している期間中にはゼロフラグレジスタ16aを変化
させるための命令を省略することができるため、処理が
簡略化され、プログラムを短くすることができる。
With the above arrangement, the instruction for changing the zero flag register 16a can be omitted during the period of setting "FLAGON", so that the processing is simplified and the program is shortened. You can

【0019】なお、上記実施例ではフラグレジスタ中の
特にゼロフラグレジスタについてのみ、その判定を常時
行なうか否か設定するようにしたが、これに限ることな
く、他のステータスフラグについても同様の設定が可能
であることは勿論である。
In the above embodiment, whether or not the judgment is always made is set only for the zero flag register among the flag registers. However, the present invention is not limited to this, and the same setting may be made for other status flags. Of course, it is possible.

【0020】[0020]

【発明の効果】以上詳記した如く本発明によれば、特定
のステータスフラグ、例えばゼロフラグに対する常時判
定を指示する命令がプログラム中でなされた場合にこれ
をデコーダにて検出し、以後この常時判定の指示が解除
されるまでの間、デコーダからの信号によりゼロフラグ
の判定を常時行ない、判定結果をフラグレジスタにセッ
トするようにしたので、フラグ条件の付いた分岐が頻出
するようなプログラムではフラグを変化させるための命
令を簡略化してプログラムを効率よく実行することが可
能なマイクロコンピュータを提供することができる。
As described above in detail, according to the present invention, when an instruction for instructing a constant status flag, for example, a zero flag, is made in the program, the decoder detects the instruction, and thereafter the constant judgment is made. Until the instruction of is canceled, the zero flag is always judged by the signal from the decoder and the judgment result is set in the flag register.Therefore, the flag is set in the program in which the branch with the flag condition occurs frequently. It is possible to provide a microcomputer capable of simplifying an instruction for changing and efficiently executing a program.

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

【図1】本発明の一実施例に係る回路構成を示すブロッ
ク図。
FIG. 1 is a block diagram showing a circuit configuration according to an embodiment of the present invention.

【図2】図1の動作を説明する図。FIG. 2 is a diagram for explaining the operation of FIG.

【図3】従来のマイクロコンピュータの動作を説明する
図。
FIG. 3 is a diagram illustrating the operation of a conventional microcomputer.

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

10…プロセッサユニット、11…ALU、12…プログラム
カウンタ、13…Aレジスタ、14…命令デコーダ、15…フ
ラグレジスタ、16…フラグレジスタ、17…判定回路、20
…メインメモリ。
10 ... Processor unit, 11 ... ALU, 12 ... Program counter, 13 ... A register, 14 ... Instruction decoder, 15 ... Flag register, 16 ... Flag register, 17 ... Judgment circuit, 20
… Main memory.

───────────────────────────────────────────────────── フロントページの続き (51)Int.Cl.5 識別記号 庁内整理番号 FI 技術表示箇所 9292−5B G06F 9/44 320 D ─────────────────────────────────────────────────── ─── Continuation of front page (51) Int.Cl. 5 Identification code Office reference number FI technical display location 9292-5B G06F 9/44 320 D

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 特定のステータスフラグに対する常時判
定を指示する指示手段と、 この指示手段による指示状態を検出する検出手段と、 この検出手段の検出信号に基づいて上記ステータスフラ
グを常時判定する判定回路と、 この判定回路によって判定された結果を保持するフラグ
レジスタとを具備したことを特徴とするマイクロコンピ
ュータ。
1. An instructing means for instructing constant determination of a specific status flag, a detecting means for detecting an instructed state by the instructing means, and a determining circuit for constantly determining the status flag based on a detection signal of the detecting means. And a flag register that holds a result determined by the determination circuit.
JP3314407A 1991-11-28 1991-11-28 Microcomputer Pending JPH05150980A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3314407A JPH05150980A (en) 1991-11-28 1991-11-28 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3314407A JPH05150980A (en) 1991-11-28 1991-11-28 Microcomputer

Publications (1)

Publication Number Publication Date
JPH05150980A true JPH05150980A (en) 1993-06-18

Family

ID=18052979

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3314407A Pending JPH05150980A (en) 1991-11-28 1991-11-28 Microcomputer

Country Status (1)

Country Link
JP (1) JPH05150980A (en)

Similar Documents

Publication Publication Date Title
US5471620A (en) Data processor with means for separately receiving and processing different types of interrupts
JP3176093B2 (en) Microprocessor interrupt controller
US6289445B2 (en) Circuit and method for initiating exception routines using implicit exception checking
JP3226055B2 (en) Information processing device
US5418917A (en) Method and apparatus for controlling conditional branch instructions for a pipeline type data processing apparatus
US6189093B1 (en) System for initiating exception routine in response to memory access exception by storing exception information and exception bit within architectured register
EP0270081B1 (en) Microprogram controller receiving interrupt request during instruction execution
US5440704A (en) Data processor having branch predicting function
JPS6250934A (en) Interrupting control system of processor
JPH05150980A (en) Microcomputer
JPH05241827A (en) Command buffer controller
JPH04169937A (en) Microprocessor
JPH05257815A (en) Central processing unit
JP2525492B2 (en) Programmable controller
JP3507193B2 (en) Load / store instruction processor
JP2871429B2 (en) Processor with runaway monitoring function
JPS6116334A (en) Data processor
JP2503210B2 (en) Micro program controller
JP2903601B2 (en) Microcomputer with built-in ROM
JPH0424836A (en) Microprocessor
JP2689894B2 (en) Micro program control type information processing device
JPH0764822A (en) Microcomputer
WO1993025967A1 (en) System for aiding debugging of integrated circuit microprocessor
JPH0527967A (en) Computer system
JPH0795288B2 (en) Microcomputer