JP2006195910A - Microcomputer - Google Patents

Microcomputer Download PDF

Info

Publication number
JP2006195910A
JP2006195910A JP2005009413A JP2005009413A JP2006195910A JP 2006195910 A JP2006195910 A JP 2006195910A JP 2005009413 A JP2005009413 A JP 2005009413A JP 2005009413 A JP2005009413 A JP 2005009413A JP 2006195910 A JP2006195910 A JP 2006195910A
Authority
JP
Japan
Prior art keywords
instruction
compare
general
purpose register
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2005009413A
Other languages
Japanese (ja)
Other versions
JP4507888B2 (en
Inventor
Naoki Ito
直紀 伊藤
Masahiro Kamiya
政裕 神谷
Hideaki Ishihara
秀昭 石原
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.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2005009413A priority Critical patent/JP4507888B2/en
Priority to US11/330,237 priority patent/US7664933B2/en
Publication of JP2006195910A publication Critical patent/JP2006195910A/en
Priority to US12/585,781 priority patent/US7991982B2/en
Application granted granted Critical
Publication of JP4507888B2 publication Critical patent/JP4507888B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3851Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution from multiple instruction streams, e.g. multistreaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30181Instruction operation extension or modification

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Executing Machine-Instructions (AREA)
  • Microcomputers (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a microcomputer capable of realizing various peripheral functions by software while suppressing increase of program size to the utmost. <P>SOLUTION: In this microcomputer 10, a CPU 11 can execute and process a peripheral function instruction described in an L task as one instruction. The CPU 11 acquires information required for the execution of the peripheral function instruction from a general-purpose register 30 designated by an operand, and stores information related to an execution result of the instruction in the general-purpose register 30. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、複数のタスクを時分割並行処理可能であると共に、それらの内少なくとも1つのタスクは、命令アドレスの増分が一定となるようにしてループするプログラムが記述された特定タスクとなっているマイクロコンピュータに関する。   In the present invention, a plurality of tasks can be processed in a time-sharing parallel manner, and at least one of these tasks is a specific task in which a program that loops so that the increment of the instruction address is constant is described. It relates to a microcomputer.

CPUにROM,RAMやその他の周辺機能などを加えて構成されるマイクロコンピュータを様々なユーザアプリケーションに適用する場合は、一般に、夫々のアプリケーションで要求される機能に応じてハードウエアを変更する必要があり、製品のバリエーションが多くなってしまうという問題がある。
そこで、周辺機能としての動作をソフトウエアによって実現する構成が考えられている。例えば、特許文献1には、1つのCPUにおいて2つのタスク(A,L)を時分割並行的に処理し、Lタスクでは分岐命令の実行を禁止して固定ループ化することで、プログラムカウンタの値をタイマとして使用したり、Aタスクの暴走監視処理を行なわせるようにしたマイクロコンピュータが開示されている。
When a microcomputer configured by adding ROM, RAM, and other peripheral functions to a CPU is applied to various user applications, it is generally necessary to change the hardware according to the functions required for each application. There is a problem that the variation of the product increases.
Therefore, a configuration has been considered in which operations as peripheral functions are realized by software. For example, in Patent Document 1, two tasks (A, L) are processed in a time-sharing manner in a single CPU, and execution of a branch instruction is prohibited in the L task to form a fixed loop. There is disclosed a microcomputer in which a value is used as a timer or a runaway monitoring process of an A task is performed.

しかしながら、特許文献1のマイコンにおいて、例えば、特定の入力端子のレベル変化に応じてタイマ値を取得する、所謂「インプットキャプチャ」機能や、シリアル通信といったようなより複雑な周辺機能を実現しようとすると、プログラムサイズが非常に大きくなってしまうという問題がある。
また、特許文献2には、マイクロコンピュータが実行する命令機能を拡張するため、プログラムに記述されているターゲット命令の直前にプリフィックス命令を配置するようにして、そのプリフィックス命令にセットするフラグの状態に応じて前記ターゲット命令の機能を拡張するようにした構成が開示されている。
特開平6−250857号公報 特開2004−38521号公報
However, in the microcomputer of Patent Document 1, for example, a more complicated peripheral function such as a so-called “input capture” function that acquires a timer value according to a level change of a specific input terminal or serial communication is realized. There is a problem that the program size becomes very large.
Further, in Patent Document 2, in order to extend the instruction function executed by the microcomputer, a prefix instruction is arranged immediately before the target instruction described in the program, and the flag state set in the prefix instruction is set. Accordingly, a configuration is disclosed in which the function of the target instruction is expanded.
JP-A-6-250857 JP 2004-38521 A

しかしながら、特許文献2の技術では、命令機能を拡張するためには必ずプリフィックス命令を挿入する必要があるため、やはりプログラムサイズが増加してしまう。
本発明は上記事情に鑑みてなされたものであり、その目的は、プログラムサイズの増加を極力抑制した上で、多様な周辺機能をソフトウエアによって実現することができるマイクロコンピュータを提供することにある。
However, in the technique of Patent Document 2, since it is necessary to always insert a prefix instruction in order to expand the instruction function, the program size also increases.
The present invention has been made in view of the above circumstances, and an object thereof is to provide a microcomputer capable of realizing various peripheral functions by software while suppressing an increase in program size as much as possible. .

請求項1記載のマイクロコンピュータによれば、CPUは、特定タスクに記述されている周辺機能命令を1命令として実行処理可能に構成されている。そして、オペランドで指定されている汎用レジスタより周辺機能命令の実行に要する情報を取得する共に、当該命令の実行結果に関する情報を汎用レジスタに格納する。従って、周辺機能をソフトウエアによって実現するためのプログラムの記述が極めて簡単になり、プログラムサイズを小さくすることができる。また、汎用レジスタのビットは、CPUに通常用意されている命令によって操作可能であるから、周辺機能命令を実行させるために、プリフィックス命令のような特殊な命令を別途用意する必要がない。尚、ここで言う「周辺機能をソフトウエアによって実現する」とは、本発明のマイクロコンピュータにおけるCPUの内部構成であるハードウエアと、当該CPUが実行するプログラムとの協働によって周辺機能を実現することを示す。   According to the microcomputer of the first aspect, the CPU is configured to be capable of executing the peripheral function instruction described in the specific task as one instruction. Then, information necessary for executing the peripheral function instruction is acquired from the general-purpose register specified by the operand, and information related to the execution result of the instruction is stored in the general-purpose register. Therefore, the description of the program for realizing the peripheral function by software becomes extremely simple, and the program size can be reduced. Further, since the bits of the general-purpose register can be manipulated by instructions normally prepared in the CPU, it is not necessary to separately prepare special instructions such as prefix instructions in order to execute peripheral function instructions. Here, “peripheral function is realized by software” means that the peripheral function is realized by the cooperation of the hardware of the CPU in the microcomputer of the present invention and the program executed by the CPU. It shows that.

請求項2記載のマイクロコンピュータによれば、CPUは、インプットキャプチャ命令を実行する場合、タイマ値を取得する条件となる入力端子のエッジ指定情報を汎用レジスタより取得する。そして、汎用レジスタに格納される、前回サンプリングした入力端子のレベルと、当該入力端子の現在のレベルとを比較すれば取得条件(エッジの立上がり,立下りなど)の成立を判定することができ、条件成立時に取得したタイマカウンタの値をキャプチャ値として格納すると共に、インプットキャプチャが成立したことを示すフラグを格納する。従って、予め通常命令によって汎用レジスタにエッジ指定情報をセットした後、インプットキャプチャ命令を実行することで、ソフトウエアによってインプットキャプチャ機能を実現することができる。   According to the microcomputer of the second aspect, when executing the input capture instruction, the CPU acquires edge designation information of the input terminal which is a condition for acquiring the timer value from the general-purpose register. Then, by comparing the level of the input terminal sampled last time stored in the general-purpose register with the current level of the input terminal, it is possible to determine whether the acquisition condition (rising edge, falling edge, etc.) is satisfied, The value of the timer counter acquired when the condition is satisfied is stored as a capture value, and a flag indicating that input capture is satisfied is stored. Therefore, the input capture function can be realized by software by executing the input capture instruction after setting the edge designation information in the general-purpose register in advance by the normal instruction.

請求項3記載のマイクロコンピュータによれば、CPUは、サンプリングコンペア命令を実行する場合、汎用レジスタにセットされるコンペア周期値を取得する。また、汎用レジスタには、サンプリングタイミング毎にコンペア周期値を累積加算したデータをコンペア値として格納し、そのコンペア値とタイマカウンタ値とが一致した場合に、サンプリング結果及び成立フラグを汎用レジスタに格納する。従って、予め通常命令によって汎用レジスタにコンペア周期値をセットした後サンプリングコンペア命令を実行することで、ソフトウエアによってサンプリングコンペア機能を実現できる。   According to the microcomputer of the third aspect, when executing the sampling compare instruction, the CPU acquires a compare cycle value set in the general-purpose register. The general-purpose register stores the data obtained by cumulatively adding the compare cycle values at each sampling timing as a compare value. If the compare value matches the timer counter value, the sampling result and the establishment flag are stored in the general-purpose register. To do. Therefore, a sampling compare function can be realized by software by executing a sampling compare instruction after setting a compare cycle value in a general-purpose register in advance by a normal instruction.

請求項4記載のマイクロコンピュータによれば、CPUは、インプットコンペアセット命令を実行する場合、汎用レジスタにセットされるコンペア周期値及びコンペアセット条件となる入力端子のエッジ指定情報を取得する。そして、コンペアセット条件が成立すると、その時点のタイマカウンタの値にコンペア周期値を加算した値をコンペア値として汎用レジスタに格納すると共に成立フラグを格納する。従って、予め通常命令によって汎用レジスタにコンペア周期値及びエッジ指定情報をセットした後インプットコンペアセット命令を実行することで、ソフトウエアによってインプットコンペアセット機能を実現できる。   According to the microcomputer of the fourth aspect, when executing the input compare set instruction, the CPU acquires the compare period value set in the general-purpose register and the edge designation information of the input terminal which becomes the compare set condition. When the compare set condition is satisfied, a value obtained by adding the compare cycle value to the value of the timer counter at that time is stored as a compare value in the general-purpose register and the satisfied flag is stored. Therefore, the input compare set function can be realized by software by executing the input compare set instruction after setting the compare cycle value and edge designation information in the general-purpose register in advance by a normal instruction.

請求項5記載のマイクロコンピュータによれば、CPUは、条件付サンプリング命令を実行する場合、汎用レジスタに条件フラグがセットされたか否か判断する。そして、条件フラグのセットを認識すると、汎用レジスタにサンプリング結果及び成立フラグを格納する。従って、特定タスクを実行している間に所定の条件が成立した場合に、通常命令によって汎用レジスタに条件フラグをセットすることで、ソフトウエアによって条件付サンプリング機能を実現できる。   According to the microcomputer of the fifth aspect, when executing the conditional sampling instruction, the CPU determines whether or not the condition flag is set in the general-purpose register. When the condition flag set is recognized, the sampling result and the establishment flag are stored in the general-purpose register. Therefore, when a predetermined condition is satisfied while executing a specific task, a conditional sampling function can be realized by software by setting a condition flag in a general-purpose register by a normal instruction.

請求項6記載のマイクロコンピュータによれば、CPUは、入力処理系の命令を実行する場合、汎用レジスタに前回の入力端子の状態と今回の入力端子の状態とを格納して、両者の値が一致した場合に、前記入力処理系命令の実行を許可する2度一致フィルタ機能を備える。ここで言う「入力処理系の命令」とは、請求項2乃至5における「インプットキャプチャ命令」,「サンプリングコンペア命令」,「インプットコンペアセット命令」,「条件付サンプリング命令」を示す。従って、入力信号又はデータの状態が安定したことを確認した段階で、入力処理系命令を実行することができる。
請求項7記載のマイクロコンピュータによれば、CPUは、汎用レジスタにおけるビットの設定に応じて2度一致フィルタ機能の実行可否を選択可能に構成されるので、当該フィル多機能の要否を、ユーザのアプリケーションに応じて選択することができる。
According to the microcomputer of the sixth aspect, when the CPU executes the instruction of the input processing system, the CPU stores the state of the previous input terminal and the state of the current input terminal in the general-purpose register, and the values of both are stored. In case of a match, it has a double match filter function that permits execution of the input processing system instruction. The “input processing instructions” referred to here are “input capture instructions”, “sampling compare instructions”, “input compare set instructions”, and “conditional sampling instructions” in claims 2 to 5. Therefore, the input processing system command can be executed when it is confirmed that the state of the input signal or data is stable.
According to the microcomputer of the seventh aspect, the CPU is configured to be able to select whether or not to execute the coincidence filter function according to the bit setting in the general-purpose register. Can be selected according to the application.

請求項8記載のマイクロコンピュータによれば、CPUは、アウトプットコンペア命令を実行する場合、汎用レジスタにセットされるコンペア周期値及び出力レベル指定条件を取得する。また、汎用レジスタには、サンプリングコンペア命令の場合と同様に、コンペア周期値が累積加算されたデータをコンペア値として格納し、そのコンペア値とタイマカウンタ値とが一致すれば、指定されたレベルを出力端子より出力すると共に成立フラグを汎用レジスタに格納する。従って、予め通常命令によって汎用レジスタにコンペア周期値をセットした後アウトプットコンペア命令を実行することで、ソフトウエアによってアウトプットコンペア機能を実現できる。   According to the microcomputer of the eighth aspect, when executing the output compare instruction, the CPU acquires the compare cycle value and the output level designation condition set in the general-purpose register. Similarly to the sampling compare instruction, the general-purpose register stores the data obtained by cumulatively adding the compare cycle values as a compare value. If the compare value matches the timer counter value, the specified level is stored. Output from the output terminal and store the establishment flag in the general-purpose register. Therefore, the output compare function can be realized by software by executing the output compare instruction after setting the compare cycle value in the general-purpose register in advance by the normal instruction.

請求項9記載のマイクロコンピュータによれば、CPUは、条件付アウトプット命令を実行する場合、汎用レジスタにセットされる出力レベル指定条件を取得する。また、汎用レジスタに条件フラグがセットされたか否かを判断する。そして、条件フラグのセットを認識すると、前記指定条件に応じたレベルを出力端子に出力させると共に汎用レジスタに成立フラグを格納する。従って、予め通常命令によって汎用レジスタに出力レベル指定条件をセットした後、特定タスクを実行している間に所定の条件が成立した場合、通常命令によって汎用レジスタに条件フラグをセットすれば、ソフトウエアによって条件付アウトプット機能を実現できる。   According to the microcomputer of the ninth aspect, when the conditional output instruction is executed, the CPU acquires the output level designation condition set in the general-purpose register. Also, it is determined whether a condition flag is set in the general-purpose register. When the condition flag set is recognized, a level corresponding to the specified condition is output to the output terminal and the establishment flag is stored in the general-purpose register. Therefore, after setting the output level specification condition in the general-purpose register in advance by a normal instruction, if a predetermined condition is satisfied while executing a specific task, the software can be set by setting a condition flag in the general-purpose register by a normal instruction. A conditional output function can be realized.

以下、本発明の一実施例について図面を参照して説明する。図1は、マイクロコンピュータ10の構成を示す機能ブロック図である。マイクロコンピュータ10は、CPU11と、ROMにより構成されたプログラムメモリ12と、RAMにより構成されたデータメモリ13と、I/Oブロック14(入出力ピン)と、後述するCPU切替信号(クロック信号)を発生するタイミングジェネレータ(図示せず)と、データを送受信するデータバス15と、アドレス信号を送受信するアドレスバス16と、リード信号とライト信号をそれぞれ送受信するコントロールバス17,18とを備えている。
上記CPU11は、例えば、2種類のタスク(Lタスク,Aタスク)を時分割で並行にパイプライン処理するため2つのアドレスレジスタ19,20と2つの演算レジスタ21,22を備え、これらアドレスレジスタ19,20と演算レジスタ21,22をCPU切替信号により交互に切り替えることで、見掛上、2つのCPUを交互に切り替えて動作させるように機能する。
An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a functional block diagram showing the configuration of the microcomputer 10. The microcomputer 10 receives a CPU 11, a program memory 12 constituted by a ROM, a data memory 13 constituted by a RAM, an I / O block 14 (input / output pins), and a CPU switching signal (clock signal) described later. A timing generator (not shown) for generating data, a data bus 15 for transmitting and receiving data, an address bus 16 for transmitting and receiving address signals, and control buses 17 and 18 for transmitting and receiving read signals and write signals, respectively, are provided.
The CPU 11 includes, for example, two address registers 19 and 20 and two operation registers 21 and 22 for pipelining two types of tasks (L task and A task) in a time-sharing manner. , 20 and the arithmetic registers 21 and 22 are alternately switched by a CPU switching signal, and apparently function to switch the two CPUs alternately.

この場合、一方のアドレスレジスタ19と演算レジスタ21がCPU0用(Lタスク用)のレジスタとなり、他方のアドレスレジスタ20と演算レジスタ22がCPU1用(Aタスク用)のレジスタとなる。これらアドレスレジスタ19,20の切替えに応じてプログラムカウンタ23の値(次にフェッチする命令のアドレス)が更新され、このプログラムカウンタ23からCPU0用(Lタスク用)とCPU1用(Aタスク用)のアドレス信号が交互にプログラムメモリ12に出力される。   In this case, one address register 19 and operation register 21 are registers for CPU0 (for L task), and the other address register 20 and operation register 22 are registers for CPU1 (for A task). The value of the program counter 23 (address of the next instruction to be fetched) is updated according to the switching of the address registers 19 and 20, and the CPU 0 (for L task) and CPU 1 (for A task) are updated from the program counter 23. Address signals are alternately output to the program memory 12.

また、CPU11内には、プログラムメモリ12から読み込まれた命令の属するタスクの種類を判別してそのエラーを検出するエラー検出手段たるエラー検出回路24と、このエラー検出回路24を通過した命令をデコード(解読)する命令デコーダ・命令シーケンサ25が設けられ、この命令デコーダ・命令シーケンサ(以下、単に命令デコーダと称す)25によりデコードした命令の内容に応じて、演算器26(ALU)で演算レジスタ21,22を用いて演算したり、リード信号又はライト信号をコントロールバス17,18に出力するようになっている。   Further, in the CPU 11, an error detection circuit 24 serving as an error detection means for determining the type of task to which the instruction read from the program memory 12 belongs and detecting the error, and the instruction that has passed through the error detection circuit 24 are decoded. An instruction decoder / instruction sequencer 25 for decoding (decoding) is provided, and in accordance with the contents of the instruction decoded by the instruction decoder / instruction sequencer (hereinafter simply referred to as instruction decoder) 25, an arithmetic unit 26 (ALU) operates the operation register 21. , 22 and outputs a read signal or a write signal to the control buses 17, 18.

一方、プログラムメモリ12内には、CPU0用(Lタスク用)のプログラム領域27と、CPU1用(Aタスク用)のプログラム領域28と、テーブル即値データ領域29とが設けられている。この場合、CPU0用のプログラム領域27に格納されたLタスクは、プログラム暴走に至る危険性のある分岐命令が禁止された固定ループ化されたプログラムで構成されている。これにより、Lタスクのプログラムの実行時には0番地から2バイト命令アクセスで実行を開始し、2番地,4番地,6番地,…と順々に命令を実行していき、その後、所定番地まで行くと、プログラムカウンタ23がオーバーフローして0番地に戻り、以後、上述した番地順の命令実行を繰り返すようになる。また、このLタスクは、命令が全て1ワード(2バイト)命令に固定されている。   On the other hand, in the program memory 12, a program area 27 for CPU0 (for L task), a program area 28 for CPU1 (for A task), and a table immediate data area 29 are provided. In this case, the L task stored in the program area 27 for the CPU 0 is composed of a fixed loop program in which a branch instruction that may lead to program runaway is prohibited. As a result, when the L task program is executed, the execution is started with the 2-byte instruction access from address 0, the instructions are executed in order of address 2, address 4, address 6, and so on, and then reach a predetermined address. Then, the program counter 23 overflows and returns to the address 0, and thereafter the instruction execution in the order of the addresses is repeated. In this L task, all instructions are fixed to 1 word (2 bytes) instructions.

Lタスク(特定タスク)は、シーケンス制御の処理を行うのに適し、そのプログラム中に、Aタスクの暴走監視用のルーチンと、システムのフェイルセーフを成立させるためのバックアップシーケンス用のルーチンが含まれている。更に、このLタスクは、固定ループ動作によるタイマとしての機能も備え、例えばインクリメント命令又はデクリメント命令を実行させてそのカウント値が所定の設定値に達したときに、Aタスクの処理に割込みを発生させることでタイマ割込みと等価な定時間処理が可能となっている。
一方、Aタスクは、Lタスクで禁止されている分岐命令も許容されており、例えば複雑な解析処理・数値処理に適している。このAタスクについても、Lタスクと同じく、命令が全て1ワード命令に固定されている。このAタスクとLタスクは、1ワード内にオペコードとオペランド(アドレス)の両方が割り付けられている。
The L task (specific task) is suitable for performing sequence control processing, and the program includes a routine for monitoring runaway of the A task and a routine for backup sequence for establishing system fail-safety. ing. Furthermore, this L task also has a function as a timer by a fixed loop operation. For example, when an increment instruction or a decrement instruction is executed and the count value reaches a predetermined set value, an interrupt is generated in the processing of the A task. This makes it possible to perform fixed-time processing equivalent to timer interrupts.
On the other hand, for the A task, branch instructions prohibited by the L task are also permitted, and are suitable for, for example, complex analysis processing and numerical processing. As for the A task, as in the L task, all instructions are fixed to a one-word instruction. In the A task and the L task, both an operation code and an operand (address) are allocated in one word.

次に、上記構成のマイクロコンピュータ採用しているパイプライン制御方式について図2に基づいて説明する。このパイプラインは、例えば、命令フェッチ,命令デコード,命令実行の各ステージからなる3段のパイプラインとして構成され、全命令がこの3段のパイプラインで遅滞なく処理できるように設計されている。各ステージはそれぞれ1サイクルで実行され、3サイクルで1命令を実行するようになっているが、3段のパイプラインにより3つの命令を並行処理することで、見掛上、1命令を1サイクルで実行するのと等価となっている。   Next, a pipeline control system adopting the microcomputer having the above configuration will be described with reference to FIG. This pipeline is configured as, for example, a three-stage pipeline including instruction fetch, instruction decode, and instruction execution stages, and is designed so that all instructions can be processed without delay in the three-stage pipeline. Each stage is executed in one cycle, and one instruction is executed in three cycles, but apparently one instruction is processed in one cycle by processing three instructions in parallel by a three-stage pipeline. Is equivalent to running

1サイクル(各ステージ)の時間は、CPU切替信号(クロック信号)により規定されている。このCPU切替信号は、ローレベルの時間TLoとハイレベルの時間THiとが同一であり、ローレベル期間でCPU0(Lタスク)の命令フェッチを行い、ハイレベル期間でCPU1(Aタスク)の命令フェッチを行うことにより、CPU0(Lタスク)とCPU1(Aタスク)の両プログラムを1:1の時分割比で並行にパイプライン処理するようになっている。
更に、CPU1がAタスクのプログラムに含まれる分岐命令をフェッチしたときには、当該分岐命令が含まれるAタスクの次の命令フェッチステージで分岐先アドレスの命令をフェッチするために、命令デコードステージで分岐先アドレスをセットするように構成されている。また、図2では、パイプライン処理中に、CPU1のY+1番地の命令が分岐命令(JMP)である場合の処理タイミングが示されている。
The time for one cycle (each stage) is defined by a CPU switching signal (clock signal). This CPU switching signal has the same low-level time TLo and high-level time THi, and CPU0 (L task) instruction fetch is performed during the low level period, and CPU1 (A task) instruction fetch is performed during the high level period. By doing this, both the CPU0 (L task) and CPU1 (A task) programs are pipelined in parallel at a time division ratio of 1: 1.
Further, when the CPU 1 fetches the branch instruction included in the program of the A task, the branch destination is fetched at the instruction decode stage in order to fetch the instruction at the branch destination address at the instruction fetch stage next to the A task including the branch instruction. It is configured to set the address. FIG. 2 shows the processing timing when the instruction at address Y + 1 of the CPU 1 is a branch instruction (JMP) during pipeline processing.

CPU11は、プログラムカウンタ23に異なる命令アドレスを順次セットするための複数のアドレスレジスタと19,20と、命令デコーダ25によってデコードされた命令を、演算器26に順次セットするための複数の演算レジスタ(命令レジスタ)21,22とを備え、前記複数のアドレスレジスタ19,20及び複数の演算レジスタ21,22を順次切替えることで、プログラムメモリ12に記憶されている複数のプログラム27,28をパイプライン処理可能に構成されている。   The CPU 11 has a plurality of address registers 19 and 20 for sequentially setting different instruction addresses in the program counter 23, and a plurality of operation registers (19 and 20 for sequentially setting instructions decoded by the instruction decoder 25 in the arithmetic unit 26. Instruction registers) 21 and 22, and by sequentially switching the plurality of address registers 19 and 20 and the plurality of operation registers 21 and 22, a plurality of programs 27 and 28 stored in the program memory 12 are pipeline processed. It is configured to be possible.

また、CPU11の命令セットとして、後述する「周辺機能命令」が用意されている。この「周辺機能命令」とは、従来はCPU11の外部に構成されたハードウエアを利用して実現していた処理を、CPU11がLタスクにおいてソフトウエア的に処理するために用意された命令である。そして、命令デコーダ25及び演算器26は、周辺機能命令を、パイプライン処理の実行ステージにおいて1サイクルで実行するように構成されている。   Further, as a command set of the CPU 11, “peripheral function commands” to be described later are prepared. This “peripheral function instruction” is an instruction prepared for the CPU 11 to process the processing that has been realized by using hardware configured outside the CPU 11 in the L task as software. . The instruction decoder 25 and the arithmetic unit 26 are configured to execute peripheral function instructions in one cycle in the execution stage of pipeline processing.

汎用レジスタ30は、通常は例えばCPU11の周辺回路に対してロード命令が実行された場合に、データバス15を介して読み出されたデータが格納されるものである。本実施例の汎用レジスタ30は、命令デコーダ25が命令のデコード動作を行なった結果、当該命令が「周辺機能命令」であった場合、一部のビットに入力端子31の入力信号レベルが格納されたり、或いは、一部のビットに設定されたデータに応じた信号を、出力端子32を介して出力することが可能となるように構成されている。また、汎用レジスタ30とプログラムカウンタ23との間で、データの転送も可能となっている。尚、実際には、汎用レジスタ30,入力端子31,出力端子32は夫々複数存在するが、図示の都合上図1では夫々1つだけ示している。   The general-purpose register 30 normally stores data read via the data bus 15 when, for example, a load instruction is executed on a peripheral circuit of the CPU 11. In the general-purpose register 30 of the present embodiment, when the instruction decoder 25 decodes the instruction and the instruction is a “peripheral function instruction”, the input signal level of the input terminal 31 is stored in some bits. Alternatively, a signal corresponding to data set in some bits can be output via the output terminal 32. In addition, data can be transferred between the general-purpose register 30 and the program counter 23. In practice, there are a plurality of general-purpose registers 30, input terminals 31, and output terminals 32, but only one is shown in FIG. 1 for convenience of illustration.

次に、本実施例の作用について図3乃至図15も参照して説明する。以降に示す図3乃至図8は、何れもCPU11が周辺機能命令を実行した場合における(a)汎用レジスタ30における各ビットの設定状態、(b)命令デコーダ25又は演算器26において、パイプライン処理の実行ステージにおいて1サイクルで(ハードウエアにより)実行される処理の内容をC言語で表現したもの、(c)実行形態の一例を示すタイミングチャート、である。   Next, the operation of the present embodiment will be described with reference to FIGS. FIGS. 3 to 8 shown below are the case where (a) the setting state of each bit in the general-purpose register 30 when the CPU 11 executes the peripheral function instruction, and (b) the pipeline processing in the instruction decoder 25 or the arithmetic unit 26. 5 is a representation of the contents of processing executed in one cycle (by hardware) in the execution stage in C language, and FIG.

<インプットキャプチャ命令>
図3はインプットキャプチャ命令に関する内容を示す。インプットキャプチャ機能は、特定のトリガ信号が与えられたタイミングでフリーランカウンタのカウント値を読み込むものである。例えば、入力端子の信号エッジ間の時間を計測する際や、単なるエッジ検出にも使用される。本実施例では、CPU11がLタスクにおいて記述されたインプットキャプチャ命令を実行する場合は、プログラムカウンタ23のカウント値をタイマカウンタとして使用することで、CPU11の内部でソフトウエア的に処理する。
尚、ここで「ソフトウエア的に処理する」とは、CPU11の外部に設けられたハードウエアを利用して行う処理に対して、CPU11の内部において完結する処理を意味する。即ち、CPU11の内部ロジックなどが動作する部分も含めて「ソフトウエア的」と称している。
<Input capture instruction>
FIG. 3 shows the contents related to the input capture instruction. The input capture function reads the count value of the free-run counter at a timing when a specific trigger signal is given. For example, it is used when measuring the time between signal edges of the input terminal or for simple edge detection. In the present embodiment, when the CPU 11 executes an input capture instruction described in the L task, the count value of the program counter 23 is used as a timer counter, so that the CPU 11 performs processing in software.
Here, “processing in software” means processing completed inside the CPU 11 with respect to processing performed using hardware provided outside the CPU 11. That is, it is referred to as “software-like” including the part where the internal logic of the CPU 11 operates.

図3(a)に示すように、インプットキャプチャ命令が実行される場合、汎用レジスタ30の1つであるレジスタRmの各ビットは、以下のように割り当てが行なわれる。
ビット
15 :現在の入力端子の状態(レベル)
14 :前回の入力端子の状態(レベル)
13 :入力端子のサンプリング値(レベル)
11 :2度一致フィルタ許可/禁止
10,9:入力端子の信号エッジ指定
8 :インプットキャプチャ成立フラグ
7〜0:キャプチャ値
尚、これらのうち、ビット11における2度一致フィルタの許可/禁止や、ビット10,9における入力端子の信号エッジ指定は、Aタスク側に記述されているロード命令によって予めレジスタRmにセットされ、インプットキャプチャ命令では、オペランドでレジスタRmを指定する。
As shown in FIG. 3A, when the input capture instruction is executed, each bit of the register Rm, which is one of the general purpose registers 30, is assigned as follows.
Bit 15: Current input terminal state (level)
14: Previous input terminal state (level)
13: Sampling value (level) of input terminal
11: Double match filter enable / disable 10, 9: Signal edge specification of input terminal 8: Input capture establishment flag 7-0: Capture value Of these, the double match filter in bit 11 is enabled / disabled, The signal edge designation of the input terminal in bits 10 and 9 is preset in the register Rm by the load instruction described on the A task side, and the register Rm is designated by the operand in the input capture instruction.

そして、インプットキャプチャ命令は、実行ステージにおいて図3(b)に示すような処理内容が実行される。尚、図3(b)に示す手順がプログラム的に1ステップずつ実行されるわけではなく、インプットキャプチャ命令が実行される場合に、これらの処理が命令デコーダ25または演算器26のロジックにより1サイクルで実行される。
即ち、ビット13で2度一致フィルタ許可が設定されている場合、ビット15,14の排他的論理和が成立し両者が不一致であれば、ビット15の内容がビット14に転送される。両者が一致した場合も、同様にその時点のビット15の内容がビット14に転送される。また、フィルタ禁止が設定されている場合は、最初の不一致判定を行うことなくビット15の内容がビット14に転送される。それから、入力端子31のエッジ判定を行う。
The input capture instruction is executed in the execution stage as shown in FIG. 3B. Note that the procedure shown in FIG. 3B is not executed programmatically step by step, but when an input capture instruction is executed, these processes are performed in one cycle by the logic of the instruction decoder 25 or the arithmetic unit 26. Is executed.
That is, when the coincidence filter permission is set in bit 13, if the exclusive OR of bits 15 and 14 is established and the two do not coincide, the contents of bit 15 are transferred to bit 14. Similarly, if the two match, the content of bit 15 at that time is transferred to bit 14 in the same manner. When the filter prohibition is set, the content of bit 15 is transferred to bit 14 without performing the first mismatch determination. Then, the edge determination of the input terminal 31 is performed.

エッジ判定は、現時点の入力端子31のレベルであるビット15と、前回同じ命令が実行された場合の入力端子31のレベルがサンプリング値として格納されているビット13とが比較され、両者が一致していれば入力レベルの変化がなくエッジは検出されず、ビット15の内容をビット13に転送して終了する。
一方、ビット15,13が不一致であれば入力端子31のレベルが変化してエッジが検出されたことになる。この場合、ビット10,9で指定されたエッジの条件(立上がり,立下り,何れかのエッジ)が成立しているかどうかを判断し、当該条件が成立していればプログラムカウンタ23の値をレジスタRmのビット7:0に格納すると共に、ビット8に成立フラグを立てて処理を終了する。尚、各入力端子31の指定は、デフォルトで固定であっても、例えば、他の汎用命令を使用して指定可能としても良い。
In the edge determination, the bit 15 which is the level of the current input terminal 31 is compared with the bit 13 in which the level of the input terminal 31 when the same instruction is executed last time is stored as a sampling value, and the two match. If there is no change in the input level, no edge is detected, and the contents of bit 15 are transferred to bit 13 and the process ends.
On the other hand, if the bits 15 and 13 do not match, the level of the input terminal 31 changes and an edge is detected. In this case, it is determined whether the edge condition (rising edge, falling edge, or any edge) specified by bits 10 and 9 is satisfied. If the condition is satisfied, the value of the program counter 23 is registered. The data is stored in bits 7: 0 of Rm, and the establishment flag is set in bit 8 to end the process. The designation of each input terminal 31 may be fixed by default or may be designated using other general-purpose instructions, for example.

ここで、上記のインプットキャプチャ機能を、CPU11の外部に回路を設けて実現することを想定すると、一般に、以下のような回路が必要となる。
(1)フリーランタイマ
(2)フリーランタイマのカウント値を格納するキャプチャレジスタ
(3)トリガとするエッジの指定や、2度一致フィルタの有無を選択するため
のコントロールレジスタ
これに対して、本実施例では、(1)はプログラムカウンタ23が対応し、(2)及び(3)はレジスタRmが対応することで、ハードウエアとしてはCPU11単体でインプットキャプチャ機能を実現している。
Here, assuming that the above-described input capture function is realized by providing a circuit outside the CPU 11, the following circuit is generally required.
(1) Free-run timer (2) Capture register that stores the count value of the free-run timer (3) Control register for specifying the trigger edge and the presence / absence of the double match filter In the embodiment, (1) corresponds to the program counter 23, and (2) and (3) correspond to the register Rm, so that the input capture function is realized by the CPU 11 alone as hardware.

<サンプリングコンペア命令>
図4はサンプリングコンペア命令に関する内容を示す。サンプリングコンペア機能は、指定されたサンプリング周期が経過する毎に入力端子31のレベルをサンプリングするものである。この場合も、プログラムカウンタ23のカウント値をタイマカウンタとして使用する。
<Sampling compare instruction>
FIG. 4 shows the contents relating to the sampling compare instruction. The sampling compare function samples the level of the input terminal 31 every time a designated sampling period elapses. Also in this case, the count value of the program counter 23 is used as a timer counter.

図4(a)に示すように、サンプリングコンペア命令が実行される場合、汎用レジスタ30におけるレジスタRm,Rnの各ビットは、以下のように割り当てが行なわれる。
レジスタRm ビット
15 :現在の入力端子の状態(レベル)
14 :前回の入力端子の状態(レベル)
13 :入力端子のサンプリング値(レベル)
12 :サンプリング結果(1ビットの場合)
11 :2度一致フィルタ許可/禁止
10,9:サンプリングの指定
8 :サンプリングコンペア成立フラグ
7〜0:コンペア値
レジスタRn ビット
15〜8 :サンプリング結果(1バイトの場合)
7〜0 :コンペア周期
As shown in FIG. 4A, when the sampling compare instruction is executed, the bits of the registers Rm and Rn in the general-purpose register 30 are assigned as follows.
Register Rm bit
15: Current input terminal state (level)
14: Previous input terminal state (level)
13: Sampling value (level) of input terminal
12: Sampling result (1 bit)
11: Double match filter enable / disable
10, 9: Specifying sampling
8: Sampling compare establishment flag
7 to 0: Compare value register Rn bit
15 to 8: Sampling result (in the case of 1 byte)
7 to 0: Compare cycle

そして、サンプリングコンペア命令は、図4(b)に示すような処理内容が実行される。2度一致フィルタに関する処理は、ビット15,14が不一致であれば、ビット15の内容をビット14に転送する。両者が一致した場合、若しくはフィルタ禁止が設定されている場合は、ビット15の内容がビット14,13に夫々転送される。それから、プログラムカウンタ23のカウント値がレジスタRmのビット7:0以上となった場合、即ちコンペア周期Δtが経過すると、レジスタRnのビット7:0がレジスタRmのビット7:0に加算されて次回のコンペア値がセットされる。そして、ビット8に成立フラグを立てると、レジスタRmのビット10,9で指定された態様に応じてサンプリングを行う。サンプリング指定は、例えば以下のように設定される。
ビット10,9 サンプリング態様
00 1ビット
01 不履行
10 1バイト(左シフト)
11 1バイト(右シフト)
尚、左シフトはMSBファーストに対応し、レジスタRnを1ビットずつ左シフトさせながら、レジスタRmのビット13をレジスタRnのビット8側から格納する。また、右シフトはLSBファーストに対応しており、レジスタRnを1ビットずつ右シフトさせながら、レジスタRmのビット13をレジスタRnのビット15側から格納する。
The sampling compare instruction executes the processing contents as shown in FIG. In the process related to the twice match filter, if the bits 15 and 14 do not match, the contents of the bit 15 are transferred to the bit 14. If the two match, or if filter prohibition is set, the contents of bit 15 are transferred to bits 14 and 13, respectively. Then, when the count value of the program counter 23 becomes greater than or equal to the bit 7: 0 of the register Rm, that is, when the compare period Δt has elapsed, the bit 7: 0 of the register Rn is added to the bit 7: 0 of the register Rm and the next time The compare value is set. When the establishment flag is raised in bit 8, sampling is performed according to the mode specified by bits 10 and 9 of register Rm. The sampling designation is set as follows, for example.
Bit 10, 9 Sampling mode
00 1 bit
01 default
10 1 byte (left shift)
11 1 byte (right shift)
Note that the left shift corresponds to MSB first, and the bit 13 of the register Rm is stored from the bit 8 side of the register Rn while shifting the register Rn to the left bit by bit. The right shift corresponds to LSB first, and the bit 13 of the register Rm is stored from the bit 15 side of the register Rn while the register Rn is shifted right by one bit.

<アウトプットコンペア命令>
図5はアウトプットコンペア命令に関する内容を示す。アウトプットコンペア機能は、指定されたコンペア周期が経過する毎に出力端子より出力を行うものである。例えば、PWM信号の出力や、マイクロコンピュータ10がスリープモードに移行した場合に、その移行している時間を計測するためのスリープタイマに連動して信号の出力を行う場合などに使用される。この場合も、プログラムカウンタ23のカウント値をタイマカウンタとして使用する。
<Output compare instruction>
FIG. 5 shows the contents relating to the output compare instruction. The output compare function performs output from the output terminal every time a designated compare cycle elapses. For example, it is used when outputting a PWM signal or outputting a signal in conjunction with a sleep timer for measuring the time when the microcomputer 10 has shifted to the sleep mode. Also in this case, the count value of the program counter 23 is used as a timer counter.

図5(a)に示すように、アウトプットコンペア命令が実行される場合、汎用レジスタ30におけるレジスタRm,Rnの各ビットは、以下のように割り当てが行なわれる。
レジスタRm ビット
15 :出力端子のレベル設定
11〜9:出力レベルの指定
8 :アウトプットコンペア成立フラグ
7〜0:コンペア値
レジスタRn ビット
15〜8 :出力データ(1バイトの場合)
7〜0 :コンペア周期
As shown in FIG. 5A, when the output compare instruction is executed, each bit of the registers Rm and Rn in the general-purpose register 30 is assigned as follows.
Register Rm bit
15: Output terminal level setting
11-9: Designation of output level
8: Output compare establishment flag
7 to 0: Compare value register Rn bit
15 to 8: Output data (1 byte)
7 to 0: Compare cycle

尚、出力指定及びコンペア周期は、アウトプットコンペア命令の実行前に他の命令によりセットされる。そして、アウトプットコンペア命令は、以下のように実行される。まず、プログラムカウンタ23のカウント値がレジスタRmのビット7:0以上となった場合、即ちコンペア周期Δtが経過すると、レジスタRnのビット7:0がレジスタRmのビット7:0に加算されて次回のコンペア値がセットされる。それから、ビット8に成立フラグを立てると、レジスタRmのビット11〜9で指定された態様に応じて出力を行う。出力レベル指定は、例えば以下のように設定される。
ビット11〜9 サンプリング態様
000 出力なし
001 「L」出力
010 「H」出力
011 現在のレベルの反転
100 出力なし
101 出力なし
110 1バイト出力(右シフト)
111 1バイト出力(左シフト)
尚、1バイト出力の右シフトはLSBファーストに対応し、レジスタRnのビット8をレジスタRmのビット15に格納すると、レジスタRnのビット15〜8を1ビット右シフトさせる。また、1バイト出力の左シフトはMSBファーストに対応しており、レジスタRnのビット15をレジスタRmのビット15に格納すると、レジスタRnのビット15〜8を1ビット左シフトさせる。
Note that the output designation and the compare cycle are set by another instruction before the output compare instruction is executed. The output compare instruction is executed as follows. First, when the count value of the program counter 23 becomes greater than or equal to bit 7: 0 of the register Rm, that is, when the compare period Δt has elapsed, the bit 7: 0 of the register Rn is added to the bit 7: 0 of the register Rm and the next time The compare value is set. Then, when the establishment flag is set in bit 8, output is performed according to the mode specified by bits 11 to 9 of register Rm. The output level designation is set as follows, for example.
Bits 11-9 Sampling mode
000 No output
001 “L” output
010 “H” output
011 Invert current level
100 No output
101 No output
110 1 byte output (right shift)
111 1 byte output (left shift)
The right shift of 1-byte output corresponds to LSB first. When bit 8 of register Rn is stored in bit 15 of register Rm, bits 15 to 8 of register Rn are shifted right by 1 bit. The left shift of 1-byte output corresponds to MSB first. When bit 15 of register Rn is stored in bit 15 of register Rm, bits 15 to 8 of register Rn are shifted left by 1 bit.

<インプットコンペアセット命令>
図6はインプットコンペアセット命令に関する内容を示す。インプットコンペアセット機能は、入力端子31の指定されたエッジを検出した場合に、コンペア値をセットするものである。この場合も、プログラムカウンタ23のカウント値をタイマカウンタとして使用する。尚、2度一致フィルタに関する処理は、インプットキャプチャ命令の場合と同様である。
<Input compare set instruction>
FIG. 6 shows the contents relating to the input compare set instruction. The input compare set function sets a compare value when a specified edge of the input terminal 31 is detected. Also in this case, the count value of the program counter 23 is used as a timer counter. The process related to the twice match filter is the same as that in the case of the input capture instruction.

図6(a)に示すように、インプットコンペアセット命令が実行される場合、汎用レジスタ30におけるレジスタRm,Rnの各ビットは以下のように割り当てが行なわれる。
レジスタRm ビット
15 :現在の入力端子の状態(レベル)
14 :前回の入力端子の状態(レベル)
13 :入力端子のサンプリング値(レベル)
11 :2度一致フィルタ許可/禁止
10,9:エッジの指定
8 :インプットコンペアセット成立フラグ
7〜0:コンペアセット値
レジスタRn ビット
7〜0:コンペア値
尚、エッジの指定及びコンペアセット値は、インプットコンペアセット命令の実行前に他の通常命令によりセットされる。そして、インプットコンペアセット命令は、以下のように実行される。尚、2度一致フィルタに関する処理はインプットキャプチャ命令等と同様であるから省略する。まず、ビット15の内容がビット14に夫々転送される。それから、インプットキャプチャ命令の場合と同様に入力端子31についてエッジ判定が行われ、エッジが検出され且つエッジ条件が成立すると、プログラムカウンタ23のカウント値にレジスタRmのビット7:0を加算した値をレジスタRnのビット7:0にセットする。そして、ビット8に成立フラグを立てる。このインプットコンペアセット命令は、図6(c)に示すように、例えば信号の立下りエッジを検出した時点にコンペアセット値Δtをセットする場合などに使用する。
As shown in FIG. 6A, when the input compare set instruction is executed, each bit of the registers Rm and Rn in the general-purpose register 30 is assigned as follows.
Register Rm bit
15: Current input terminal state (level)
14: Previous input terminal state (level)
13: Sampling value (level) of input terminal
11: Double match filter enable / disable
10, 9: Edge specification
8: Input compare set establishment flag
7 to 0: Compare set value register Rn bit
7 to 0: Compare value The edge designation and compare set value are set by another normal instruction before the execution of the input compare set instruction. The input compare set instruction is executed as follows. Note that the process related to the twice match filter is the same as that for the input capture command and the like, and is therefore omitted. First, the contents of bit 15 are transferred to bit 14 respectively. Then, as in the case of the input capture instruction, edge determination is performed on the input terminal 31, and when an edge is detected and the edge condition is satisfied, a value obtained by adding bits 7: 0 of the register Rm to the count value of the program counter 23 is obtained. Set bit 7: 0 of register Rn. Then, an establishment flag is set in bit 8. As shown in FIG. 6C, this input compare set command is used, for example, when the compare set value Δt is set at the time when the falling edge of the signal is detected.

<条件付サンプリング命令>
図7は条件付サンプリング命令に関する内容を示す。条件付サンプリング機能は、何らかの処理の結果により条件フラグがセットされた場合に入力端子31のレベルをサンプリングするものである。図7(a)に示すように、条件付サンプリング命令が実行される場合、レジスタRmの各ビットには、以下のように割り当てが行なわれる。
ビット
15 :現在の入力端子の状態(レベル)
14 :前回の入力端子の状態
13 :入力端子のサンプリング値(レベル)
12 :サンプリング結果(1ビット)
11 :2度一致フィルタ許可/禁止
10,9:サンプリング指定
8 :条件付サンプリング成立フラグ
7〜0:サンプリング結果(1ビット)
また、レジスタRnのビット8には条件フラグが格納される。そして、図7(b)に示すように、条件フラグがセットされると2度一致フィルタ処理と共にサンプリング処理を行ない、条件フラグがセットされていなければ2度一致フィルタ処理だけを実行する。尚、何れの場合も、フィルタ処理はフィルタ許可フラグがセットされている場合に行われることは上述と同様である。
<Conditional sampling instruction>
FIG. 7 shows the contents related to the conditional sampling instruction. The conditional sampling function samples the level of the input terminal 31 when a condition flag is set as a result of some processing. As shown in FIG. 7A, when a conditional sampling instruction is executed, each bit of the register Rm is assigned as follows.
Bit 15: Current input terminal state (level)
14: Previous input terminal state 13: Input terminal sampling value (level)
12: Sampling result (1 bit)
11: Double-match filter enable / disable 10, 9: Sampling designation 8: Conditional sampling establishment flag 7-0: Sampling result (1 bit)
A condition flag is stored in bit 8 of the register Rn. Then, as shown in FIG. 7B, when the condition flag is set, the sampling process is performed together with the twice matching filter process, and when the condition flag is not set, only the twice matching filter process is executed. In any case, the filtering process is performed when the filter permission flag is set, as described above.

サンプリング処理については、レジスタRmのビット8に成立フラグを立てると、サンプリングコンペア命令と同様のサンプリング指定に応じてサンプリングを行う。但し、1バイトサンプリングの場合、サンプリング結果はレジスタRmのビット7〜0に格納される。図7(c)は、例えばある入力端子31の立下がりエッジが検出されたことを条件としてサンプリングを行なう場合を示している。   As for the sampling process, when the establishment flag is set in bit 8 of the register Rm, the sampling is performed according to the sampling designation similar to the sampling compare instruction. However, in the case of 1-byte sampling, the sampling result is stored in bits 7 to 0 of the register Rm. FIG. 7C shows a case where sampling is performed on condition that a falling edge of an input terminal 31 is detected, for example.

<条件付アウトプット命令>
図8は条件付アウトプット命令に関する内容を示す。条件付アウトプット機能は、何らかの処理の結果により条件フラグがセットされた場合に、指定されたレベルを出力端子より出力するものである。図8(a)に示すように、条件付アウトプット命令が実行される場合、レジスタRmの各ビットには、以下のように割り当てが行なわれる。
レジスタRm ビット
15 :出力端子のレベル設定
11〜9:出力レベルの指定
8 :アウトプットコンペア成立フラグ
7〜0:出力値(1バイト)
また、レジスタRnのビット8には条件フラグが格納される。そして、条件付アウトプット命令は、レジスタRnのビット8に条件フラグがセットされると、図8(b)に示すような処理内容として実行される。まず、レジスタRmのビット8に成立フラグを立てると、アウトプットコンペア命令と同様のアウトプット指定に応じて出力端子32より出力を行う。但し、1バイト出力の場合、レジスタRmのビット15にはビット7〜0にセットされたデータが1ビットずつシフトされながら与えられる。図8(c)は、例えばある入力端子31の立上がりエッジが検出されたことを条件として反転出力,出力無し,反転出力を行なう場合を示している。
<Conditional output instruction>
FIG. 8 shows the contents related to the conditional output instruction. The conditional output function outputs a specified level from an output terminal when a condition flag is set as a result of some processing. As shown in FIG. 8A, when a conditional output instruction is executed, each bit of the register Rm is assigned as follows.
Register Rm bit
15: Output terminal level setting
11-9: Designation of output level
8: Output compare establishment flag
7 to 0: Output value (1 byte)
A condition flag is stored in bit 8 of the register Rn. The conditional output instruction is executed as the processing contents shown in FIG. 8B when the condition flag is set in bit 8 of the register Rn. First, when the establishment flag is set in bit 8 of the register Rm, output is performed from the output terminal 32 in accordance with the output designation similar to the output compare instruction. However, in the case of 1-byte output, data set in bits 7 to 0 is given to bit 15 of register Rm while being shifted bit by bit. FIG. 8C shows a case where inverted output, no output, and inverted output are performed on condition that a rising edge of an input terminal 31 is detected, for example.

[ケーススタディ:CSMA/CD,受信]
次に、図9乃至図15は、以上に説明した周辺機能命令(ペリフェラル命令)を使用してより具体的な機能の実現を図る例を示す。図9はLANにおいて利用される通信方式の1つであるCSMA/CD方式について、受信側の機能を実現する場合を示す。実現する機能は、以下のようになる。
(1)受信データRxの立下りを検出すると、
その時点からΔt2後に受信データRxをサンプリング
(2)(1)のサンプリング結果においてエッジが検出されなければ、更にΔt1(1ビット周期)後に受信データRxをサンプリングし、エッジが検出されれば(衝突検出)更にΔt2後に受信データRxをサンプリング(ビット同期)
ビット同期は、以下のように行なう。
前回の受信データ :0 → 立下りエッジで同期
前回の受信データ :1 → 立上りエッジで同期
ドミナント「0」送信中 → 立下りエッジで同期
ドミナント「1」送信中 → 立上りエッジで同期
上記機能は、
<インプットコンペアセット命令>
(1)受信データRxのエッジが検出されるとサンプリングタイミングをΔt2に変更
<サンプリングコンペア命令>
(2)Δt1毎に受信データRxをサンプリング
によって実現することができる。
[Case study: CSMA / CD, reception]
Next, FIG. 9 to FIG. 15 show an example in which a more specific function is realized by using the peripheral function instruction (peripheral instruction) described above. FIG. 9 shows a case where the function on the receiving side is realized for the CSMA / CD system which is one of the communication systems used in the LAN. The functions to be realized are as follows.
(1) When the falling edge of the received data Rx is detected,
Sampling of received data Rx after Δt2 from that point (2) If no edge is detected in the sampling result of (1), the received data Rx is further sampled after Δt1 (one bit period) and if an edge is detected (collision) Detection) Further sampling of received data Rx after Δt2 (bit synchronization)
Bit synchronization is performed as follows.
Previous received data: 0 → Synchronized on falling edge Previous received data: 1 → Synchronized on rising edge Dominant “0” transmitting → Synchronized on falling edge Dominant “1” transmitting → Synchronized on rising edge
<Input compare set instruction>
(1) When the edge of the received data Rx is detected, the sampling timing is changed to Δt2. <Sampling compare instruction>
(2) The reception data Rx can be realized by sampling every Δt1.

[ケーススタディ:CSMA/CD,送信]
図10はCSMA/CD方式における送信側の機能を実現するものである。機能の内容は、以下のようになる。
(1)一定周期(Δt1)毎に送信データを出力
(2)受信データレベルが変化してエッジを検出すると送信データを出力
これらの機能は、
<アウトプットコンペア命令>
(1)一定周期(Δt1)毎に送信データを出力端子より出力。
<インプットコンペアセット命令>
(2a)受信データRxのエッジを検出
この場合、当該命令の実行結果によりレジスタRmのビット8に成立フラグがセットされると、そのビット8の内容をレジスタRnのビット8に転送する。
<条件付アウトプット命令>
(2b)上記エッジの検出により、送信データを出力端子より出力
これらの周辺機能命令によって実現することができる。
[Case study: CSMA / CD, transmission]
FIG. 10 realizes the function on the transmission side in the CSMA / CD system. The contents of the function are as follows.
(1) Transmission data is output at regular intervals (Δt1) (2) Transmission data is output when the received data level changes and an edge is detected.
<Output compare instruction>
(1) Transmission data is output from the output terminal at regular intervals (Δt1).
<Input compare set instruction>
(2a) Detecting edge of received data Rx In this case, when the establishment flag is set in bit 8 of register Rm according to the execution result of the instruction, the content of bit 8 is transferred to bit 8 of register Rn.
<Conditional output instruction>
(2b) By detecting the edge, transmission data can be output from the output terminal and realized by these peripheral function instructions.

[ケーススタディ:イベントタイマ]
図11は、イベントタイマ機能を実現するものである。この機能は、
(1)入力端子31において信号エッジを検出
(2)エッジ検出からΔt後に入力端子31のレベルをサンプリング
であり、周辺機能命令によっては、
<インプットコンペアセット命令>
(1)入力端子31の信号エッジを検出してコンペア周期Δtを設定
<サンプリングコンペア命令>
(2)コンペア周期Δt経過時に入力端子31のレベルをサンプリング
で実現できる。
[Case study: Event timer]
FIG. 11 implements the event timer function. This feature
(1) A signal edge is detected at the input terminal 31. (2) The level of the input terminal 31 is sampled after Δt from the edge detection.
<Input compare set instruction>
(1) Detect signal edge of input terminal 31 and set compare cycle Δt <Sampling compare command>
(2) The level of the input terminal 31 can be realized by sampling when the compare period Δt has elapsed.

[ケーススタディ:ポートサンプリング]
図12は、ポートサンプリング機能である。この機能は、
(1)任意のタイミングで、出力端子より信号を出力
(2)上記出力端子の信号エッジを検出すると、Δt後に入力端子31をサンプリング
である。また、サンプリングポートは、例えば「32」の内から選択可能である。これらの機能は、
<アウトプットコンペア命令>
(1)所定のカウント値にプログラムカウンタ23が一致すると、出力端子32(PSMOUT)より信号出力
<インプットコンペアセット命令>
(2a)上記出力端子32のエッジ検出により、コンペア周期を設定
(2b)上記コンペア周期にプログラムカウンタ23が一致すると、入力端子31をサンプリング
で実現することができる。
[Case study: Port sampling]
FIG. 12 shows the port sampling function. This feature
(1) A signal is output from the output terminal at an arbitrary timing. (2) When the signal edge of the output terminal is detected, the input terminal 31 is sampled after Δt. The sampling port can be selected from, for example, “32”. These features are
<Output compare instruction>
(1) When the program counter 23 matches a predetermined count value, a signal is output from the output terminal 32 (PSMOUT) <input compare set instruction>
(2a) The compare cycle is set by detecting the edge of the output terminal 32. (2b) When the program counter 23 matches the compare cycle, the input terminal 31 can be realized by sampling.

[ケーススタディ:クロック同期シリアル]
図13は、クロック同期シリアル通信機能を実現する場合を示す。この通信機能は、以下のようになる。
(1)シリアルクロックSCLKの立下りエッジ検出で出力端子32(SOUT)より信号出力(送信)
(2)SCLKの立上りエッジ検出で入力端子31(SIN)をサンプリング(受信)
また、その他の機能として、外部クロック/内部クロック,LSB/MSBファースト,クロック極性の選択や、オーバーランエラーの検出などがある。
[Case study: Clock synchronous serial]
FIG. 13 shows a case where the clock synchronous serial communication function is realized. This communication function is as follows.
(1) Signal output (transmission) from output terminal 32 (SOUT) upon detection of falling edge of serial clock SCLK
(2) Sampling (receiving) the input terminal 31 (SIN) by detecting the rising edge of SCLK
Other functions include external clock / internal clock, LSB / MSB first, clock polarity selection, and overrun error detection.

上記(1),(2)の機能は、周辺機能命令によって以下のように実現される。
<インプットキャプチャ命令>
(1a)SCLKのエッジ(立下り,立上がり)を検出
<条件付アウトプット命令>
(1b)上記エッジ(立下り)の検出により、送信データを出力端子32より出力
<条件付サンプリング命令>
(2)上記エッジ(立上がり)の検出により、入力端子31をサンプリング
The functions (1) and (2) are realized as follows by peripheral function instructions.
<Input capture instruction>
(1a) SCLK edge (falling, rising) is detected <Conditional output instruction>
(1b) Transmission data is output from the output terminal 32 upon detection of the edge (falling) <Conditional Sampling Instruction>
(2) The input terminal 31 is sampled by detecting the above edge (rising edge).

[ケーススタディ:UART]
図14は、UART通信機能を実現する場合である。この通信機能は
(1)エッジ検出(立下り,スタートビット検出)からΔt後に入力端子31をサンプリング
(2)その後、(Δt×2)毎に入力端子31をサンプリング(受信)
(3)または(Δt×2)毎に出力端子32よりデータ出力(送信)
その他、オーバーランエラー、フレーミングエラー、パリティエラーの検出などを行なう。
[Case study: UART]
FIG. 14 shows a case where the UART communication function is realized. This communication function is: (1) Sampling input terminal 31 after Δt from edge detection (falling edge, start bit detection) (2) Thereafter, sampling (receiving) input terminal 31 every (Δt × 2)
Data output (transmission) from the output terminal 32 every (3) or (Δt × 2)
In addition, overrun errors, framing errors, and parity errors are detected.

上記(1)〜(3)の機能は、周辺機能命令によって以下のように実現される。
<インプットコンペアセット命令>
(1)端子の信号エッジ(立上がり)を検出し、コンペア周期Δtを設定
<サンプリングコンペア命令>
(2)プログラムカウンタが一致した場合に、入力端子31をサンプリング
<アウトプットコンペア命令>
(3)プログラムカウンタが一致した場合に(周期:Δt×2)、出力端子32よりデータ出力
The functions (1) to (3) are realized as follows by peripheral function instructions.
<Input compare set instruction>
(1) Detect signal edge (rising edge) of terminal and set compare cycle Δt <Sampling compare command>
(2) Sampling the input terminal 31 when the program counters match <Output compare instruction>
(3) When the program counters match (period: Δt × 2), data is output from the output terminal 32

[ケーススタディ:LIN]
図15は、車内LANの一種であるLINにおいて、通信開始時に行うビット同期機能を実現する場合を示す。この機能は、以下のようになる。
(1)SYNCH BREAKのロウレベル期間がΔt1に達したことを計測すると、通信開始を認識
(2)SYNCH FIELDにおいて、送信されるクロック周期(立下りエッジ間)Δt2を計測し、ビットレートを調整(4周期分計測し、「8」で除す)
上記(1),(2)の機能は、周辺機能命令によって以下のように実現される。
<インプットキャプチャ命令>
入力端子31のエッジを検出してプログラムカウンタ23のカウント値を取得する。その他の処理は、通常命令で実現可能である。
[Case study: LIN]
FIG. 15 shows a case where a bit synchronization function performed at the start of communication is realized in LIN which is a kind of in-vehicle LAN. This function is as follows.
(1) When the fact that the SYNCH BRAKE low level period has reached Δt1 is measured, the start of communication is recognized. (Measure for 4 cycles and divide by “8”)
The functions (1) and (2) are realized as follows by peripheral function instructions.
<Input capture instruction>
The edge of the input terminal 31 is detected and the count value of the program counter 23 is acquired. Other processing can be realized by a normal instruction.

即ち、以上のように、複数の方式が異なる通信機能をソフトウエアによって実現することができるので、マイクロコンピュータ10は、夫々の通信機能を実現する場合に対応して通信インターフェイス用のLSIを搭載する必要がなくなる。従って、マイクロコンピュータ10の汎用性を高めることが可能となる。   That is, as described above, communication functions different in a plurality of methods can be realized by software. Therefore, the microcomputer 10 is equipped with a communication interface LSI corresponding to the case where each communication function is realized. There is no need. Therefore, the versatility of the microcomputer 10 can be improved.

以上のように本実施例によれば、マイクロコンピュータ10のCPU11を、Lタスクに記述されている周辺機能命令を1命令として実行処理可能に構成する。そして、CPU11は、オペランドで指定されている汎用レジスタ30より周辺機能命令の実行に要する情報を取得する共に、当該命令の実行結果に関する情報を汎用レジスタ30に格納するようにした。従って、周辺機能をソフトウエアによって実現するためのプログラムの記述が極めて簡単になり、プログラムサイズを小さくすることができる。また、汎用レジスタ30のビットはCPU11に通常用意されている命令によって操作可能であるから、周辺機能命令を実行させるために、プリフィックス命令のような特殊な命令を別途用意する必要がない。   As described above, according to the present embodiment, the CPU 11 of the microcomputer 10 is configured to be able to execute processing with the peripheral function instruction described in the L task as one instruction. The CPU 11 obtains information necessary for executing the peripheral function instruction from the general-purpose register 30 specified by the operand, and stores information related to the execution result of the instruction in the general-purpose register 30. Therefore, the description of the program for realizing the peripheral function by software becomes extremely simple, and the program size can be reduced. Further, since the bits of the general-purpose register 30 can be manipulated by instructions normally prepared in the CPU 11, there is no need to separately prepare special instructions such as prefix instructions in order to execute peripheral function instructions.

また、CPU11は、インプットキャプチャ命令を実行する場合、タイマ値の取得条件となる入力端子31のエッジ指定情報を汎用レジスタ30より取得し、汎用レジスタ30に格納される入力端子31の状態から取得条件の成立を判定し、その条件成立時に取得したプログラムカウンタ23の値をキャプチャ値として格納すると共に成立フラグを格納する。従って、予め通常命令によって汎用レジスタ30にエッジ指定情報をセットした後、インプットキャプチャ命令を実行することで、ソフトウエアによってインプットキャプチャ機能を実現することができる。   Further, when executing the input capture instruction, the CPU 11 acquires the edge designation information of the input terminal 31 as a timer value acquisition condition from the general-purpose register 30, and acquires the acquisition condition from the state of the input terminal 31 stored in the general-purpose register 30. Is established, the value of the program counter 23 acquired when the condition is established is stored as a capture value, and an establishment flag is stored. Therefore, the input capture function can be realized by software by executing the input capture instruction after the edge designation information is set in the general-purpose register 30 in advance by a normal instruction.

また、CPU11は、サンプリングコンペア命令を実行する場合、汎用レジスタ30にセットされるコンペア周期値を取得し、また、汎用レジスタ30に、サンプリングタイミング毎にコンペア周期値を累積加算したデータをコンペア値として格納する。そして、コンペア値とプログラムカウンタ23の値とが一致した場合に、サンプリング結果及び成立フラグを汎用レジスタ30に格納する。従って、予め通常命令によって汎用レジスタ30にコンペア周期値をセットした後サンプリングコンペア命令を実行することで、ソフトウエアによってサンプリングコンペア機能を実現できる。   Further, when executing the sampling compare instruction, the CPU 11 obtains a compare cycle value set in the general-purpose register 30, and uses data obtained by accumulating the compare cycle value in the general-purpose register 30 at each sampling timing as a compare value. Store. When the compare value matches the value of the program counter 23, the sampling result and the establishment flag are stored in the general-purpose register 30. Therefore, the sampling compare function can be realized by software by executing the sampling compare instruction after setting the compare cycle value in the general-purpose register 30 by the normal instruction in advance.

また、CPU11は、インプットコンペアセット命令を実行する場合、汎用レジスタ30にセットされるコンペア周期値及びコンペアセット条件となる入力端子31のエッジ指定情報を取得し、その条件が成立すると、その時点のプログラムカウンタ23の値にコンペア周期値を加算した値をコンペア値として汎用レジスタ30に格納すると共に成立フラグを格納する。従って、予め通常命令によって汎用レジスタ30にコンペア周期値及びエッジ指定情報をセットした後インプットコンペアセット命令を実行することで、ソフトウエアによってインプットコンペアセット機能を実現できる。   Further, when executing the input compare set instruction, the CPU 11 obtains the compare cycle value set in the general-purpose register 30 and the edge designation information of the input terminal 31 that becomes the compare set condition. A value obtained by adding the compare cycle value to the value of the program counter 23 is stored in the general-purpose register 30 as a compare value, and an establishment flag is stored. Therefore, an input compare set function can be realized by software by executing an input compare set command after setting a compare cycle value and edge designation information in the general-purpose register 30 in advance by a normal command.

また、CPU11は、条件付サンプリング命令を実行する場合、汎用レジスタ30に条件フラグがセットされたか否か判断し、条件フラグのセットを認識すると、汎用レジスタ30にサンプリング結果及び成立フラグを格納する。従って、Lタスクを実行している間に所定の条件が成立した場合に、通常命令によって汎用レジスタ30に条件フラグをセットすることで、ソフトウエアによって条件付サンプリング機能を実現できる。   Further, when executing the conditional sampling instruction, the CPU 11 determines whether or not the condition flag is set in the general-purpose register 30. When the CPU 11 recognizes the setting of the condition flag, the sampling result and the establishment flag are stored in the general-purpose register 30. Accordingly, when a predetermined condition is satisfied while the L task is being executed, a conditional sampling function can be realized by software by setting a condition flag in the general-purpose register 30 with a normal instruction.

また、CPU11は、入力処理系の命令であるインプットキャプチャ命令,サンプリングコンペア命令,インプットコンペアセット命令,条件付サンプリング命令を実行する場合、汎用レジスタ30に前回と今回の入力端子31の状態を格納して、両者の値が一致した場合に入力処理系命令の実行を許可する2度一致フィルタ機能を備えるので、入力信号又はデータの状態が安定したことを確認した段階で、入力処理系命令を実行することができる。そして、CPU11は、汎用レジスタ30におけるビットの設定に応じて2度一致フィルタ機能の実行可否を選択可能に構成されるので、当該フィル多機能の要否を、ユーザのアプリケーションに応じて選択することができる。   The CPU 11 stores the previous and current states of the input terminal 31 in the general-purpose register 30 when executing an input capture instruction, an input compare instruction, a sampling compare instruction, an input compare set instruction, or a conditional sampling instruction. Because it has a double match filter function that allows the execution of input processing instructions when both values match, the input processing instructions are executed when it is confirmed that the state of the input signal or data is stable. can do. Since the CPU 11 is configured to be able to select whether or not the coincidence filter function can be executed according to the bit setting in the general-purpose register 30, the CPU 11 selects whether or not the multi-function of the fill is necessary according to the user application. Can do.

また、CPU11は、アウトプットコンペア命令を実行する場合、汎用レジスタ30にセットされるコンペア周期値及び出力レベル指定条件を取得し、また、汎用レジスタ30には、サンプリングコンペア命令の場合と同様のコンペア値を格納し、そのコンペア値とプログラムカウンタ23値とが一致すれば指定されたレベルを出力端子より出力すると共に成立フラグを汎用レジスタ30に格納するようにした。従って、予め通常命令によって汎用レジスタ30にコンペア周期値をセットした後アウトプットコンペア命令を実行することで、ソフトウエアによってアウトプットコンペア機能を実現できる。   Further, when executing the output compare instruction, the CPU 11 obtains a compare cycle value and an output level designation condition set in the general-purpose register 30, and the general-purpose register 30 stores the same compare as in the case of the sampling compare instruction. The value is stored, and if the compare value and the program counter 23 value match, the designated level is output from the output terminal and the establishment flag is stored in the general-purpose register 30. Therefore, the output compare function can be realized by software by executing the output compare instruction after setting the compare cycle value in the general-purpose register 30 by the normal instruction in advance.

また、CPU11は、条件付アウトプット命令を実行する場合、汎用レジスタ30にセットされる出力レベル指定条件を取得し、汎用レジスタ30に条件フラグがセットされたか否かを判断する。そして、条件フラグのセットを認識すると、前記指定条件に応じたレベルを出力端子に出力させると共に汎用レジスタ30に成立フラグを格納する。従って、予め通常命令によって汎用レジスタ30に出力レベル指定条件をセットした後、特定タスクを実行している間に所定の条件が成立した場合に、通常命令によって汎用レジスタ30に条件フラグをセットすれば、ソフトウエアによって条件付アウトプット機能を実現できる。   Further, when executing the conditional output instruction, the CPU 11 acquires an output level designation condition set in the general-purpose register 30 and determines whether or not a condition flag is set in the general-purpose register 30. When the condition flag set is recognized, the level corresponding to the specified condition is output to the output terminal and the establishment flag is stored in the general-purpose register 30. Therefore, if a predetermined condition is satisfied while a specific task is executed after an output level specifying condition is set in advance in the general-purpose register 30 by a normal instruction, a condition flag is set in the general-purpose register 30 by a normal instruction. Conditional output function can be realized by software.

本発明は上記し又は図面に記載した実施例にのみ限定されるものではなく、以下のような変形が可能である。
2度一致フィルタの実行可否を設定する機能は必要に応じて設ければ良く、また、2度一致フィルタ自体の機能も必要に応じて設ければ良い。
CPUが時分割並行的に処理するタスクの数は、3つ以上あっても良い。
周辺機能命令は、マイクロコンピュータの仕様に応じて必要なものを適宜選択して実現すれば良い。
The present invention is not limited to the embodiments described above or shown in the drawings, and the following modifications are possible.
A function for setting whether or not to execute the double match filter may be provided as necessary, and a function of the double match filter itself may be provided as necessary.
The number of tasks that the CPU processes in a time-sharing manner may be three or more.
Peripheral function instructions may be realized by appropriately selecting necessary functions according to the specifications of the microcomputer.

本発明の一実施例であり、マイクロコンピュータの構成を示す機能ブロック図1 is a functional block diagram showing a configuration of a microcomputer according to an embodiment of the present invention. マイクロコンピュータがAタスク,Lタスクを時分割並行処理する状態を示すタイミングチャートTiming chart showing the state in which the microcomputer processes A task and L task in a time-sharing manner インプットキャプチャ命令について、(a)汎用レジスタにおける各ビットの設定状態、(b)パイプライン処理の実行ステージにおいて実行される処理の内容をC言語で表現したもの、(c)実行形態の一例を示すタイミングチャートRegarding the input capture instruction, (a) the setting state of each bit in the general-purpose register, (b) the contents of the processing executed in the execution stage of the pipeline processing expressed in C language, (c) an example of the execution form Timing chart サンプリングコンペア命令についての図3相当図Figure 3 equivalent diagram of sampling compare instruction アウトプットコンペア命令についての図3相当図Figure 3 equivalent diagram of output compare instruction インプットコンペアセット命令についての図3相当図3 equivalent diagram of the input compare set instruction 条件付サンプリング命令についての図3相当図Figure 3 equivalent diagram of conditional sampling instructions 条件付アウトプット命令についての図3相当図Figure 3 equivalent diagram of conditional output instructions CSMA/CD通信方式について、受信側の機能を周辺機能命令によって実現する場合を示す図The figure which shows the case where the function of a receiving side is implement | achieved by a peripheral function command about a CSMA / CD communication system 同送信側の機能についての図9相当図FIG. 9 equivalent diagram of the function on the transmission side イベントタイマ機能についての図9相当図Figure 9 equivalent diagram of the event timer function ポートサンプリング機能についての図9相当図Figure 9 equivalent diagram of the port sampling function クロック同期シリアル通信機能についての図9相当図Figure 9 equivalent diagram of clock synchronous serial communication function UART通信機能についての図9相当図9 equivalent diagram of the UART communication function LINの通信開始時に行うビット同期機能を実現する場合の図9相当図FIG. 9 equivalent diagram for realizing the bit synchronization function performed at the start of LIN communication

符号の説明Explanation of symbols

図面中、10はマイクロコンピュータ、11はCPU、23はプログラムカウンタ、30は汎用レジスタ、31は入力端子、32は出力端子を示す。

In the drawing, 10 is a microcomputer, 11 is a CPU, 23 is a program counter, 30 is a general-purpose register, 31 is an input terminal, and 32 is an output terminal.

Claims (9)

複数のタスクを時分割並行処理可能であると共に、それらの内少なくとも1つのタスクは、命令アドレスの増分が一定となるようにしてループするプログラムが記述された特定タスクとなっているマイクロコンピュータにおいて、
前記複数のプログラムの1つは、プログラムアドレスの増分が固定され且つループ化された特定タスクとして記述されていると共に、前記プログラムカウンタをタイマカウンタとして利用可能であり、
前記特定タスクには、周辺機能を1命令で実行するための周辺機能命令が記述されており、
前記周辺機能命令は、オペランドとして汎用レジスタを1つ以上指定するように設定され、
前記CPUは、前記周辺機能命令を1命令として実行処理可能に構成され、汎用レジスタより当該命令の実行に要する情報を取得する共に、当該命令の実行結果に関する情報を汎用レジスタに格納することを特徴とするマイクロコンピュータ。
In a microcomputer in which a plurality of tasks can be processed in parallel in a time-sharing manner, and at least one of them is a specific task in which a program that loops so that the increment of the instruction address is constant is described.
One of the plurality of programs is described as a specific task in which the increment of the program address is fixed and looped, and the program counter can be used as a timer counter.
In the specific task, peripheral function instructions for executing peripheral functions with one instruction are described.
The peripheral function instruction is set to designate one or more general-purpose registers as operands,
The CPU is configured to be able to execute the peripheral function instruction as one instruction, acquires information necessary for execution of the instruction from the general-purpose register, and stores information on the execution result of the instruction in the general-purpose register. A microcomputer.
前記CPUは、前記周辺機能命令としてインプットキャプチャ命令を実行する場合、汎用レジスタよりタイマ値を取得する条件となる入力端子のエッジ指定情報を取得し、
汎用レジスタに、前回にサンプリングした前記入力端子のレベルと、前記入力端子の現在のレベルとを格納し、
前回と現在の入力端子の状態に基づいて前記取得条件が成立したと判断するとタイマカウンタの値を取得し、キャプチャ値として汎用レジスタに格納することを特徴とする請求項1記載のマイクロコンピュータ。
When executing an input capture instruction as the peripheral function instruction, the CPU acquires edge designation information of an input terminal that is a condition for acquiring a timer value from a general-purpose register,
The general-purpose register stores the level of the input terminal sampled last time and the current level of the input terminal,
2. The microcomputer according to claim 1, wherein when it is determined that the acquisition condition is satisfied based on the previous and current input terminal states, a value of a timer counter is acquired and stored in a general-purpose register as a capture value.
前記CPUは、前記周辺機能命令としてサンプリングコンペア命令を実行する場合、汎用レジスタにセットされるコンペア周期値を取得し、
汎用レジスタに、サンプリングタイミング毎に前記コンペア周期値を累算したコンペア値をセットし、
前記コンペア値と前記タイマカウンタの値とを比較して一致判断を行い、両者の一致時に入力端子の状態をサンプリングして、成立フラグと共に汎用レジスタに格納することを特徴とする請求項1又は2記載のマイクロコンピュータ。
When the CPU executes a sampling compare instruction as the peripheral function instruction, the CPU obtains a compare cycle value set in a general-purpose register,
Set the compare value obtained by accumulating the compare cycle value at each sampling timing in the general-purpose register,
3. The comparison value and the timer counter value are compared to determine a match, and when the two match, the state of the input terminal is sampled and stored together with the establishment flag in a general purpose register. The microcomputer as described.
前記CPUは、前記周辺機能命令としてインプットコンペアセット命令を実行する場合、汎用レジスタにセットされるコンペアセット値及びコンペアセット条件となる入力端子のエッジ指定情報を取得し、
前記コンペアセット条件が成立すると、汎用レジスタに、前記コンペアセット値にその時点のタイマカウンタの値を加えたコンペア値と共に、成立フラグを格納することを特徴とする請求項1乃至3の何れかに記載のマイクロコンピュータ。
The CPU, when executing an input compare set instruction as the peripheral function instruction, obtains a compare set value set in a general-purpose register and edge designation information of an input terminal serving as a compare set condition,
4. The establishment flag is stored together with a compare value obtained by adding a timer counter value at that time to the compare set value when the compare set condition is established. The microcomputer as described.
前記CPUは、前記周辺機能命令として条件付サンプリング命令を実行する場合、汎用レジスタに条件フラグがセットされたことを認識すると入力端子のサンプリングを行ない、
汎用レジスタに、前記サンプリング結果及び成立フラグを格納することを特徴とする請求項1乃至4の何れかに記載のマイクロコンピュータ。
When the CPU executes a conditional sampling instruction as the peripheral function instruction, it recognizes that the condition flag is set in the general-purpose register, and performs sampling of the input terminal.
5. The microcomputer according to claim 1, wherein the sampling result and the establishment flag are stored in a general-purpose register.
前記CPUは、前記周辺機能命令として入力処理系の命令を実行する場合、汎用レジスタに、前回の入力端子の状態と今回の入力端子の状態とを格納し、
両者の値が一致した場合に、前記入力処理系命令の実行を許可する2度一致フィルタ機能を備えていることを特徴とする請求項2乃至5の何れかに記載のマイクロコンピュータ。
When the CPU executes an input processing instruction as the peripheral function instruction, the general-purpose register stores the previous input terminal state and the current input terminal state;
6. The microcomputer according to claim 2, further comprising a twice-match filter function that permits execution of the input processing system instruction when both values match.
前記CPUは、前記汎用レジスタにおけるビットの設定に応じて、前記2度一致フィルタ機能の実行可否を選択可能に構成されていることを特徴とする請求項6記載のマイクロコンピュータ。   7. The microcomputer according to claim 6, wherein the CPU is configured to be able to select whether or not to execute the double match filter function according to a bit setting in the general-purpose register. 前記CPUは、前記周辺機能命令としてアウトプットコンペア命令を実行する場合、汎用レジスタにセットされるコンペア周期値及び出力レベル指定条件を取得し、
汎用レジスタに、アウトプット条件の成立毎に前記コンペア周期値を累算したコンペア値をセットし、
前記コンペア値と前記タイマカウンタの値とを比較して一致判断を行い、両者が一致すると(アウトプット条件成立)、前記指定条件に応じたレベルを出力端子より出力させると共に、成立フラグを汎用レジスタに格納することを特徴とする請求項1乃至7の何れかに記載のマイクロコンピュータ。
When the CPU executes an output compare instruction as the peripheral function instruction, the CPU obtains a compare cycle value set in a general-purpose register and an output level designation condition,
In the general-purpose register, set the compare value obtained by accumulating the compare cycle value every time the output condition is satisfied,
The compare value and the timer counter value are compared to determine whether they match, and if both match (output condition is established), the level corresponding to the specified condition is output from the output terminal, and the establishment flag is set to a general-purpose register. The microcomputer according to claim 1, wherein the microcomputer is stored in the microcomputer.
前記CPUは、前記周辺機能命令として条件付アウトプット命令を実行する場合、汎用レジスタにセットされる出力レベル指定条件及び条件フラグを取得し、
前記条件フラグがセットされたことを認識すると、前記指定条件に応じたレベルを出力端子より出力させると共に、成立フラグを汎用レジスタに格納することを特徴とする請求項1乃至8の何れかに記載のマイクロコンピュータ。

When executing a conditional output instruction as the peripheral function instruction, the CPU acquires an output level designation condition and a condition flag set in a general-purpose register,
9. When recognizing that the condition flag is set, a level corresponding to the specified condition is output from an output terminal, and the establishment flag is stored in a general-purpose register. Microcomputer.

JP2005009413A 2005-01-17 2005-01-17 Microcomputer Expired - Fee Related JP4507888B2 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2005009413A JP4507888B2 (en) 2005-01-17 2005-01-17 Microcomputer
US11/330,237 US7664933B2 (en) 2005-01-17 2006-01-12 Microcomputer and encoding system for instruction code and CPU
US12/585,781 US7991982B2 (en) 2005-01-17 2009-09-24 Microcomputer and encoding system for executing peripheral function instructions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005009413A JP4507888B2 (en) 2005-01-17 2005-01-17 Microcomputer

Publications (2)

Publication Number Publication Date
JP2006195910A true JP2006195910A (en) 2006-07-27
JP4507888B2 JP4507888B2 (en) 2010-07-21

Family

ID=36801936

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005009413A Expired - Fee Related JP4507888B2 (en) 2005-01-17 2005-01-17 Microcomputer

Country Status (1)

Country Link
JP (1) JP4507888B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013234720A (en) * 2012-05-09 2013-11-21 Denso Corp Solenoid valve drive control device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS54114687A (en) * 1978-02-27 1979-09-06 Toyoda Mach Works Ltd Sequence controller
JPS54138354A (en) * 1978-04-20 1979-10-26 Oki Electric Ind Co Ltd Microprocessor unit
JPS5617441A (en) * 1979-07-23 1981-02-19 Fujitsu Ltd Program interruption system
JPS61237150A (en) * 1985-04-15 1986-10-22 Hitachi Ltd Arithmetic system for input/output processing
JPS6275733A (en) * 1985-09-30 1987-04-07 Nippon Denso Co Ltd Microcomputer
JPH06250857A (en) * 1993-02-26 1994-09-09 Nippondenso Co Ltd Microcomputer
JPH07271408A (en) * 1994-03-30 1995-10-20 Hitachi Ltd Processor for control
JP2003296292A (en) * 2002-03-29 2003-10-17 Denso Corp Port sampling circuit device and microcomputer
JP2003308307A (en) * 2002-02-15 2003-10-31 Denso Corp Micro-computer, and ecu for vehicle

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS54114687A (en) * 1978-02-27 1979-09-06 Toyoda Mach Works Ltd Sequence controller
JPS54138354A (en) * 1978-04-20 1979-10-26 Oki Electric Ind Co Ltd Microprocessor unit
JPS5617441A (en) * 1979-07-23 1981-02-19 Fujitsu Ltd Program interruption system
JPS61237150A (en) * 1985-04-15 1986-10-22 Hitachi Ltd Arithmetic system for input/output processing
JPS6275733A (en) * 1985-09-30 1987-04-07 Nippon Denso Co Ltd Microcomputer
JPH06250857A (en) * 1993-02-26 1994-09-09 Nippondenso Co Ltd Microcomputer
JPH07271408A (en) * 1994-03-30 1995-10-20 Hitachi Ltd Processor for control
JP2003308307A (en) * 2002-02-15 2003-10-31 Denso Corp Micro-computer, and ecu for vehicle
JP2003296292A (en) * 2002-03-29 2003-10-17 Denso Corp Port sampling circuit device and microcomputer

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013234720A (en) * 2012-05-09 2013-11-21 Denso Corp Solenoid valve drive control device

Also Published As

Publication number Publication date
JP4507888B2 (en) 2010-07-21

Similar Documents

Publication Publication Date Title
US6434690B1 (en) Microprocessor having a DSP and a CPU and a decoder discriminating between DSP-type instructions and CUP-type instructions
US6560697B2 (en) Data processor having repeat instruction processing using executed instruction number counter
KR101048234B1 (en) Method and system for combining multiple register units inside a microprocessor
JP2848606B2 (en) Method and apparatus for modifying microinstructions using a macroinstruction pipeline
US5091853A (en) Chained addressing mode pipelined processor which merges separately decoded parts of a multiple operation instruction
JP3745039B2 (en) Microprocessor with delayed instructions
JP2005317023A (en) Breakpoint logic unit, debug logic, and breakpoint method for data processing apparatus
JPH11219302A (en) Method and device affecting subsequent instruction processing in data processor
US7991982B2 (en) Microcomputer and encoding system for executing peripheral function instructions
EP0287115B1 (en) Coprocessor and method of controlling the same
US5838896A (en) Central processing unit for preventing program malfunction
JP4507888B2 (en) Microcomputer
US7010677B2 (en) Data processor speeding up repeat processing by inhibiting remaining instructions after a break in a repeat block
US20010023481A1 (en) Processor that executes control signals included in operand section of control instruction
US5463747A (en) Microprogram data processor processing operand address calculation and instruction execution with common hardware
JP2007004475A (en) Processor and method for executing program
JP5012562B2 (en) Microcomputer
US20220197853A1 (en) Central Processing Unit
EP2525285A1 (en) Central processing unit and microcomputer
JP4702004B2 (en) Microcomputer
JP2721610B2 (en) Programmable controller
US8516225B2 (en) Central processing unit and microcontroller
JP3060917B2 (en) Processor
JP2559924B2 (en) Programmable controller
JP2008083762A (en) Microcomputer

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070905

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20091215

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100209

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100323

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: 20100413

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100426

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

Free format text: PAYMENT UNTIL: 20130514

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20130514

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140514

Year of fee payment: 4

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees