JP3211791B2 - Loop processing method - Google Patents

Loop processing method

Info

Publication number
JP3211791B2
JP3211791B2 JP36555198A JP36555198A JP3211791B2 JP 3211791 B2 JP3211791 B2 JP 3211791B2 JP 36555198 A JP36555198 A JP 36555198A JP 36555198 A JP36555198 A JP 36555198A JP 3211791 B2 JP3211791 B2 JP 3211791B2
Authority
JP
Japan
Prior art keywords
loop
instruction
signal line
signal
condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP36555198A
Other languages
Japanese (ja)
Other versions
JP2000187591A (en
Inventor
大二 石井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP36555198A priority Critical patent/JP3211791B2/en
Publication of JP2000187591A publication Critical patent/JP2000187591A/en
Application granted granted Critical
Publication of JP3211791B2 publication Critical patent/JP3211791B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明はループ処理方式に係
り、特に条件実行機能を有するループ処理方式に関す
る。
The present invention relates to a loop processing method, and more particularly to a loop processing method having a condition execution function.

【0002】[0002]

【従来の技術】信号処理アプリケーションは同じ処理を
繰り返し実行することが多いため、通常のDSP(ディ
ジタル・シグナル・プロセッサ)にはループ処理を高速
化する機構が組み込まれている。従来、この種のループ
処理方式は、例えば特開平3−201131号公報に示
されているように、ループ処理専用のハードウェア回路
を設け、ループ処理をオーバーヘッドなく高速に実行し
ている。
2. Description of the Related Art Since a signal processing application often executes the same processing repeatedly, a general DSP (digital signal processor) has a built-in mechanism for speeding up loop processing. Conventionally, in this type of loop processing method, a hardware circuit dedicated to loop processing is provided and loop processing is executed at high speed without overhead, as shown in, for example, JP-A-3-201131.

【0003】図5は、従来のループ処理方式の構成を示
すブロック図である。図5において、ループ制御部50
はループ処理プログラム内のループ終端に到達する度に
ループカウント用レジスタ52に格納されたループ残り
回数をカウントダウンし、ループカウントレジスタ52
の内容が0でない場合には同プログラム内のループ先頭
に分岐し、ループカウントレジスタ52の内容が0に等
しい場合には分岐せずにループ処理を終了するようにプ
ログラムの実行を制御する。
FIG. 5 is a block diagram showing a configuration of a conventional loop processing system. In FIG. 5, the loop control unit 50
Counts down the number of remaining loops stored in the loop count register 52 each time the loop reaches the end of the loop in the loop processing program.
If the contents of the loop count register 52 are equal to 0, the program execution is controlled so that the processing is terminated without branching when the contents of the loop count register 52 are equal to 0.

【0004】尚、ループ処理プログラムに記述された演
算命令やデータ転送命令は、積和演算ユニット54及び
ロード/ストアユニット56,58において実行され
る。また、60は、ロード/ストアユニット56,58
から出力されるデータを一時的に記憶し、後述のレジス
タファイル62に対してデータ転送を行うデータメモリ
であり、62は、命令実行ユニット入力の読み出しと実
行結果の書き込みが行われるレジスタファイルである。
The operation instructions and data transfer instructions described in the loop processing program are executed in the product-sum operation unit 54 and the load / store units 56 and 58. Reference numeral 60 denotes load / store units 56 and 58.
Is a data memory that temporarily stores data output from the CPU and transfers data to a register file 62 described later. The register memory 62 reads an instruction execution unit input and writes an execution result. .

【0005】図6は、従来のループ処理方式をDSPに
適用することによってループ命令を実装し、このループ
命令を用いてFIRフィルタをソフトウェアで実現した
ときのアセンブラプログラムを示した図である。FIR
フィルタは、ループ命令により高速化できる典型的なル
ープ処理からなる。尚、図6中の記号「:」及びその左
側に記載された数字は行番号を示しており、プログラム
自体の内容を示すものではない。
FIG. 6 is a diagram showing an assembler program when a loop instruction is implemented by applying a conventional loop processing method to a DSP and an FIR filter is realized by software using the loop instruction. FIR
The filter consists of typical loop processing that can be accelerated by a loop instruction. Note that the symbol ":" in FIG. 6 and the number described on the left side thereof indicate the line number, and do not indicate the contents of the program itself.

【0006】図6中、第2行目に記載された「LOOP
N−1」は第2行目に記載された」記号「{」と第4
行目に記載された記号「}」とで挟まれた命令列をN−
1回実行することを意味する命令である。その他、第3
行目及び第5行目に記載された「Rk=Rk+Ri*R
j」はレジスタRj、Ri,Rkの内容に対して積和演
算する命令であり、「Rk=*Ri++」はレジスタR
iの内容をアドレスとするメモリ内データをレジスタR
kにロードした後Riの内容をインクメントする命令で
あり、「*Ri++=Rk」はレジスタRkの内容をレ
ジスタRiの内容をアドレスとするメモリ位置にストア
した後Riの内容をインクリメントする命令である。
In FIG. 6, "LOOP" described on the second line
N-1 ”is the symbol“ 」” described in the second line and the fourth
The instruction sequence between the symbols "@"
This is an instruction to execute once. Other, third
“Rk = Rk + Ri * R” described in the line and the fifth line
"j" is an instruction for performing a product-sum operation on the contents of the registers Rj, Ri, and Rk, and "Rk = * Ri ++" is a register R
The data in the memory having the contents of i as an address is stored in a register R
k is an instruction for incrementing the contents of Ri after loading into register k. "* Ri ++ = Rk" is an instruction for incrementing the contents of Ri after storing the contents of register Rk in a memory location having the contents of register Ri as an address. is there.

【0007】上記「k」,「i」,「j」はレジスタ番
号を表し、これら命令の実行サイクル数は1とする。ま
た、各行に記述された複数の命令は同一のサイクルで実
行され、記号「;」は、各行の終端を意味する。ループ
命令を用いることで、命令数の少ない(即ちコードサイ
ズの小さい)ループ処理プログラムの作成が可能であ
る。
The above "k", "i", and "j" represent register numbers, and the number of execution cycles of these instructions is one. Also, a plurality of instructions described in each line are executed in the same cycle, and the symbol “;” means the end of each line. By using loop instructions, it is possible to create a loop processing program with a small number of instructions (ie, a small code size).

【0008】[0008]

【発明が解決しようとする課題】ところで、従来のDS
Pでは、ある命令の実行結果を次のサイクルにおいて利
用することが可能であったが、動作周波数を上げること
により次のサイクルでは利用できなくなることがある。
例えば、ロード命令の結果が利用できるようになるまで
4サイクル待たなければならない場合を想定する。この
場合、図6に示したプログラムに対応するプログラムは
図7のようになる。
The conventional DS
In P, the execution result of a certain instruction could be used in the next cycle, but it may not be available in the next cycle by increasing the operating frequency.
For example, assume that one must wait four cycles before the result of a load instruction becomes available. In this case, a program corresponding to the program shown in FIG. 6 is as shown in FIG.

【0009】図7は、従来のループ処理方式を用いてD
SPのループ命令を実装した場合に問題となるFIRフ
ィルタ実現プログラムを示す図である。図7において、
第5行目に示された積和演算命令は一回前のループ繰り
返し時に実行された同5行目のロード命令の結果を待た
なければならないため、ループ処理本体内にNOP(ノ
ー・オペレーション)のサイクルを複数挿入することに
なり、プログラム実行の効率が悪くなる。
FIG. 7 shows a conventional loop processing method.
FIG. 14 is a diagram illustrating an FIR filter realization program that causes a problem when an SP loop instruction is implemented. In FIG.
Since the product-sum operation instruction shown in the fifth line must wait for the result of the load instruction in the fifth line executed during the previous loop iteration, a NOP (no operation) is included in the loop processing body. , A plurality of cycles are inserted, and the efficiency of program execution deteriorates.

【0010】命令を実行しない無駄なサイクルによって
プログラムの実行性能が劣化するのは、実時間処理が要
求されるDSPでは致命的である。図8に示すように、
ループの一部を展開することによって上記の問題点を改
善することができる。図8は、従来のループ処理方式を
用いてDSPのループ命令を実装した場合に問題となる
FIRフィルタ実現プログラムを改良したプログラムを
示す図である。
It is fatal for a DSP requiring real-time processing to degrade program execution performance due to a useless cycle in which no instruction is executed. As shown in FIG.
The above problem can be improved by unrolling a part of the loop. FIG. 8 is a diagram showing a program obtained by improving an FIR filter realization program which becomes a problem when a loop instruction of a DSP is implemented using a conventional loop processing method.

【0011】図8中の第6行目に示したように、ロード
命令の結果を待つ間にループ展開によって得られた他の
命令列(第7,8,9行目)を実行する。こうすること
で、無駄なサイクルのないプログラム実行が可能にな
る。しかしながら、プログラムの実行性能は上がるもの
の、プログラム内の命令数が増大してしまうという欠点
を有する。このように、従来のループ処理方式では、ロ
ード命令等の実行に要するサイクル数の増大により、プ
ログラムの実行性能が劣化するのを避けるため、ループ
処理プログラムのコードサイズが大きくなるという問題
がある。
As shown in the sixth line in FIG. 8, while waiting for the result of the load instruction, another instruction sequence (the seventh, eighth, and ninth lines) obtained by loop unrolling is executed. This makes it possible to execute a program without useless cycles. However, although the execution performance of the program is improved, there is a disadvantage that the number of instructions in the program is increased. As described above, in the conventional loop processing method, there is a problem that the code size of the loop processing program is increased in order to prevent the execution performance of the program from deteriorating due to the increase in the number of cycles required for executing the load instruction and the like.

【0012】本発明は、上記事情に鑑みてなされたもの
であり、命令の実行に要するサイクル数が増えるにつれ
てコードサイズも増加してしまうのを抑制するループ処
理方式を提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been made in view of the above circumstances, and has as its object to provide a loop processing method for suppressing an increase in code size as the number of cycles required for executing an instruction increases. .

【0013】[0013]

【課題を解決するための手段】本発明は、ループ処理の
本体に相当する命令列(図8の6,7,8,9行目)を条
件実行することによって、ループ処理プログラムにおけ
るループ前処理部(図8の1,2,3,4行目)と後処理
部(図8の11,12,13,14行目)における命令
数を削減する。
According to the present invention, a pre-loop processing in a loop processing program is performed by conditionally executing an instruction sequence (lines 6, 7, 8, and 9 in FIG. 8) corresponding to the main body of the loop processing. The number of instructions in the section (lines 1, 2, 3, and 4 in FIG. 8) and the post-processing section (lines 11, 12, 13, and 14 in FIG. 8) is reduced.

【0014】より具体的には、ループの繰り返し回数に
関する情報を指示するループ制御手段(ループ制御部1
2)と、前記ループの繰り返し回数に関する情報に応じ
て条件実行するための条件を指定する条件指示手段(条
件コード用レジスタ16,18,20)と、前記ループ
の繰り返し回数に関する情報及び前記条件に基づいて演
算結果の記憶手段への書き込みを制御する書き込み制御
手段(条件判定制御部14)とを具備することを特徴と
する。また、本発明は、前記ループ制御手段が、前記
と並行して、ループ処理実行制御を行うことを特徴と
する。また、本発明は、前記ループの繰り返し回数に関
する情報が、ループの初回,最終回,又はその他の繰り
返し時のいずれかの状態であることを示す情報であるこ
とを特徴とする。
More specifically, a loop control means (loop control unit 1) for instructing information on the number of loop repetitions.
2) and condition instructing means (condition code registers 16, 18, and 20) for designating a condition for condition execution according to the information on the number of times of loop repetition ; Writing control means (condition determination control unit 14) for controlling writing of the calculation result to the storage means based on the calculation result. Further, the present invention, the loop control means, the finger
In parallel with the above-mentioned operation, loop processing execution control is performed. Further, the present invention is characterized in that the information on the number of repetitions of the loop is information indicating that the information is any of the first time, the last time, or another state of the loop. I do.

【0015】このように、ループの繰り返し回数に応じ
てループ処理本体内の命令列を条件実行する手段を有す
ることにより、ループの初回にはループ処理本体におけ
る一部の命令列をループ前処理部として実行し、最終回
には同ループ処理本体における他の一部の命令列を後処
理部として実行することができる。これによって、ルー
プ処理本体の命令列は依然必要だが、前処理部及び後処
理部の命令列が不要になるため、ループ処理プログラム
のコードサイズが小さくなる。
As described above, the provision of the means for conditionally executing the instruction sequence in the loop processing body according to the number of iterations of the loop allows the partial instruction sequence in the loop processing body to be firstly executed in the loop for the first time. And in the last round, another part of the instruction sequence in the same loop processing body can be executed as a post-processing unit. As a result, although the instruction sequence of the loop processing body is still required, the instruction sequence of the pre-processing unit and the post-processing unit is not required, so that the code size of the loop processing program is reduced.

【0016】[0016]

【発明の実施の形態】以下、図面を参照して本発明の一
実施形態によるループ処理方式について詳細に説明す
る。図1は、本発明の一実施形態によるループ処理方式
の構成を示すブロック図である。図1において、10は
ループカウント用レジスタであり、ループの残り回数を
記憶する。12はループ制御部であり、ループ処理プロ
グラム内のループ終端に到達する度にループカウント用
レジスタ10に格納されたループ残り回数をカウントダ
ウンし、ループカウントレジスタ10の内容が0でない
場合には同プログラム内のループ先頭に分岐し、ループ
カウントレジスタ10の内容が0に等しい場合には分岐
せずにループ処理を終了するようにプログラムの実行を
制御する。このループ制御部12は、ループを制御する
と同時にループの初回,最終回,又はその他の繰り返し
時であることを指示する制御信号12aを出力する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, a loop processing method according to an embodiment of the present invention will be described in detail with reference to the drawings. FIG. 1 is a block diagram showing a configuration of a loop processing method according to an embodiment of the present invention. In FIG. 1, reference numeral 10 denotes a register for loop count, which stores the remaining number of loops. Reference numeral 12 denotes a loop control unit, which counts down the remaining number of loops stored in the loop count register 10 each time the loop reaches the end of the loop in the loop processing program. When the content of the loop count register 10 is equal to 0, the execution of the program is controlled so that the loop processing is terminated without branching. The loop controller 12 controls the loop and outputs a control signal 12a indicating that the loop is the first time, the last time, or another repetition.

【0017】条件判定制御部14は、後述する積和演算
ユニット22、ロード/ストアユニット24,26を含
む命令実行ユニットの実行結果を後述するレジスタファ
イル30又はデータメモリ28へ書き込むか否かをルー
プカウント用レジスタ10の内容に基づいて制御する。
また、上述した命令実行ユニットは、各命令コード内に
指定されている条件コードを保持する条件コード用レジ
スタ16〜20を含み、演算やデータ転送を行う。デー
タメモリ28は、レジスタファイル30に対してデータ
転送を行うものであり、レジスタファイル30は、命令
実行ユニット入力の読み出しと実行結果の書き込みが行
われるものである。
The condition determination control unit 14 loops whether or not to write the execution result of the instruction execution unit including the product-sum operation unit 22 and load / store units 24 and 26 to a register file 30 or data memory 28 to be described later. Control is performed based on the contents of the count register 10.
The above-described instruction execution unit includes condition code registers 16 to 20 that hold condition codes specified in each instruction code, and performs calculations and data transfer. The data memory 28 transfers data to and from the register file 30. The register file 30 is used to read an instruction execution unit input and write an execution result.

【0018】以上示した、本発明の一実施形態によるル
ープ処理方式が、図5に示した従来のループ処理方式と
異なる点は、図5に示された構成に対し、図1中に示し
た条件判定制御部14、条件コード用レジスタ16〜2
0、及びそれらに付随した信号線12a,16b,18
b,20b,14a,14b,14cが新規に付加され
た点である。尚、通常のDSPでは本方式の手前に命令
フェッチユニット,命令デコーダが付加された構成にな
っており、信号線10a,16a,18a,20aはそ
の命令デコーダからの出力である。
The above-described loop processing method according to the embodiment of the present invention is different from the conventional loop processing method shown in FIG. 5 in that the structure shown in FIG. Condition determination control unit 14, Condition code registers 16-2
0, and their associated signal lines 12a, 16b, 18
b, 20b, 14a, 14b, and 14c are newly added points. An ordinary DSP has a configuration in which an instruction fetch unit and an instruction decoder are added before this method, and signal lines 10a, 16a, 18a, and 20a are outputs from the instruction decoder.

【0019】条件判定制御部14は、ループの初回,最
終回,又はその他の繰り返し時のいずれかの状態である
ことを指示する制御信号12aと、信号線16b、18
b、20bを介して条件コード用レジスタ16,18,
20の内容とが入力され、レジスタファイル30又はデ
ータメモリ28への各命令実行結果22a,24a,2
4b,26a,26b,28a,28bの書き込みを制
御する信号が信号線14a,14b、14cを介して出
力される。
The condition determination control unit 14 includes a control signal 12a for instructing a state of the first time, the last time of the loop, or another repetition state, and signal lines 16b, 18
b, 20b via the condition code registers 16, 18,
20 is input, and each instruction execution result 22a, 24a, 2 in the register file 30 or the data memory 28 is input.
Signals for controlling the writing of 4b, 26a, 26b, 28a, 28b are output via signal lines 14a, 14b, 14c.

【0020】ループ制御部12には、ループカウント用
レジスタ10に保持されており、信号線10bを介して
出力されるループ残り回数が入力され、この値に基づい
てループ処理を制御し、上記の値から1を減じた値が信
号線10cを介して出力される。更に、ループの初回,
最終回,又はその他の繰り返し時のいずれかの状態であ
ることを示す制御信号が信号線12aを介して出力され
る。
The loop control unit 12 receives the number of remaining loops, which is held in the loop count register 10 and is output via the signal line 10b, and controls the loop processing based on this value. The value obtained by subtracting 1 from the value is output via the signal line 10c. In addition, the first time of the loop,
A control signal indicating that the state is the last one or another state at the time of repetition is output via the signal line 12a.

【0021】ループカウント用レジスタ10では、ルー
プ処理の実行開始前に、ループ命令をデコードすること
によって得られたループ回数が信号線10aを介して入
力される。ループ処理実行中には、カウントダウンした
ループ残り回数の値がループ制御部12から信号線10
cを介して入力され、保持された内容は信号線10bを
介してループ制御部12へ出力される。
The loop count register 10 receives, via a signal line 10a, the number of loops obtained by decoding a loop instruction before starting execution of loop processing. During the execution of the loop processing, the value of the remaining number of loops counted down is transmitted from the loop control unit 12 to the signal line 10.
c, and the held content is output to the loop control unit 12 via the signal line 10b.

【0022】条件コード用レジスタ16,18,20に
は、各命令コードをデコードすることによって得られた
条件コードが信号線16a,18a,20aを介して入
力される。条件コード用レジスタ16,18,20はそ
れらを保持し、信号線16b、18b、20bを介して
出力する。条件コード用レジスタ16,18,20に保
持されるべき条件コードは、プログラム内でプログラマ
が指定した情報であり、各命令コード内に記述されてい
る。
The condition codes obtained by decoding the instruction codes are input to the condition code registers 16, 18, and 20 via signal lines 16a, 18a, and 20a. The condition code registers 16, 18, and 20 hold them and output them via signal lines 16b, 18b, and 20b. The condition codes to be held in the condition code registers 16, 18, and 20 are information specified by the programmer in the program, and are described in each instruction code.

【0023】この条件コードにより、各命令が、 1.ループの初回及び最終回には実行しないが、その他
の繰り返し時には常に実行する命令 2.ループの最終回には実行しないが、その他の繰り返
し時には常に実行する命令 3.ループの初回には実行しないが、その他の繰り返し
時には常に実行する命令 のいずれかであることが指示される。
According to this condition code, each instruction: 1. An instruction that is not executed at the first and last times of the loop, but is always executed at other times. 2. An instruction that is not executed at the last time of the loop, but is always executed at other times. Indicates that it is one of the instructions that are not executed at the beginning of the loop, but are always executed at other iterations.

【0024】積和演算ユニット22には、レジスタファ
イル30の出力30a,30b,30cが演算オペラン
ドとして入力され、それらオペランドに対する積和演算
結果が信号線22aを介して出力される。ロード/スト
アユニット24には、レジスタファイル30の出力30
d,30eがそれぞれメモリアドレス,ストアデータと
して入力され、入力されたアドレス及びストアデータは
それぞれ信号線24c,24bを介してデータメモリ2
8へ出力される。同時に、アドレスをインクリメントし
た値が信号線24aを介してレジスタファイル30へ出
力される。
The outputs 30a, 30b, and 30c of the register file 30 are input as operation operands to the product-sum operation unit 22, and the result of the product-sum operation for these operands is output via a signal line 22a. The load / store unit 24 has an output 30 of the register file 30.
d and 30e are input as a memory address and store data, respectively, and the input address and store data are input to the data memory
8 is output. At the same time, the value obtained by incrementing the address is output to the register file 30 via the signal line 24a.

【0025】ロード/ストアユニット26には、レジス
タファイル30の出力30f,30gがそれぞれメモリ
アドレス, ストアデータとして入力され、入力された
アドレス及びストアデータはそれぞれ信号線26c,2
6bを介してデータメモリ28へ出力される。同時に、
アドレスをインクリメントした値が信号線26aを介し
てレジスタファイル30へ出力される。
Outputs 30f and 30g of the register file 30 are input to the load / store unit 26 as memory addresses and store data, respectively, and the input addresses and store data are applied to signal lines 26c and 2 respectively.
The data is output to the data memory 28 via 6b. at the same time,
The value obtained by incrementing the address is output to the register file 30 via the signal line 26a.

【0026】データメモリ28には、ロード/ストアユ
ニット24,26から出力されたストアデータ24b,
26bをデータメモリ28へ書き込む可否を指示する制
御信号が信号線14b,14cを介して入力される。ス
トア動作時には、信号線14bを介して入力される可否
信号の可否に応じて、信号線24aを介して出力される
メモリアドレスが指し示すメモリ内の位置に信号線24
bを介して出力されるストアデータが書き込まれる。ま
た、信号線14cを介して出力される可否信号について
も同様に、本信号の可否によって、信号線26cを介し
て出力されるメモリアドレスが指し示すメモリ内の位置
に信号線26bを介して出力されるストアデータが書き
込まれる。 一方、ロード動作時には、信号線28a,
28bを介してロードデータがそれぞれ読み出される。
The data memory 28 stores store data 24b output from the load / store units 24 and 26,
A control signal instructing whether or not writing 26b to the data memory 28 is input via the signal lines 14b and 14c. At the time of the store operation, the signal line 24 is set at a position in the memory indicated by the memory address output via the signal line 24a in accordance with the availability of the availability signal input via the signal line 14b.
The store data output via b is written. Similarly, the propriety signal output via the signal line 14c is also output via the signal line 26b to the position in the memory indicated by the memory address output via the signal line 26c, depending on the propriety of this signal. Store data is written. On the other hand, during the load operation, the signal lines 28a,
The load data is read out via the respective terminals 28b.

【0027】レジスタファイル30には、信号線30
a,30b,30cを介して積和演算ユニット22へ向
けて出力される演算入力と、信号線30d,30eを介
してロード/ストアユニット24へ向けて出力されるメ
モリアドレス及びストアデータと、信号線30f,30
gを介してロード/ストアユニット26へ向けて出力さ
れるメモリアドレス及びストアデータとが読み出され
る。そして、信号線14a,14b,14cを介して書
き込み可否信号が入力され、各信号の可否に応じて、積
和演算ユニット22の演算結果,ロードデータ,並びに
更新されたアドレスが書き込まれる。
The register file 30 includes a signal line 30
a, an operation input output to the product-sum operation unit 22 via the a, 30b, 30c, a memory address and store data output to the load / store unit 24 via the signal lines 30d, 30e, and a signal Lines 30f, 30
The memory address and the store data output to the load / store unit 26 via g are read. Then, a write enable / disable signal is input via the signal lines 14a, 14b, and 14c, and the operation result of the product-sum operation unit 22, the load data, and the updated address are written according to the enable / disable of each signal.

【0028】次に、本実施形態の動作について説明す
る。まず、条件コード用レジスタ16,18,20に保
持されている条件コードがそれぞれ信号線16b、18
b、20bを介して条件判定制御部14へ入力される。
同時に、ループ制御部12からループの初回,最終回,
又はその他の繰り返し時のいずれかの状態であることを
示す制御信号も信号線12aを介して条件判定制御部1
4へ入力される。
Next, the operation of this embodiment will be described. First, the condition codes held in the condition code registers 16, 18, and 20 are stored in signal lines 16b and 18 respectively.
b and 20b are input to the condition determination control unit 14.
At the same time, the first time, the last time,
Alternatively, a control signal indicating any state at the time of repetition is also transmitted to the condition determination control unit 1 via the signal line 12a.
4 is input.

【0029】ループ制御部12では、従来ループ処理方
式と同様に、信号線10bを介して出力されるループ残
り回数に基づいてループを制御する。同時に、ループ処
理の開始時にはループの初回であることを示す信号が信
号線12aを介して出力され、ループ処理の最終回には
最終回であることを示す信号が信号線12aを介して出
力され、その他のループ繰り返し時には初回でも最終回
でもないことを示す信号を信号線12aを介して出力さ
れる。
The loop control unit 12 controls the loop based on the number of remaining loops output via the signal line 10b, as in the conventional loop processing method. At the same time, at the start of the loop processing, a signal indicating the first time of the loop is output via the signal line 12a, and at the last time of the loop processing, a signal indicating the last time is output via the signal line 12a. At the time of other loop repetition, a signal indicating that it is neither the first time nor the last time is output via the signal line 12a.

【0030】条件判定制御部14では、信号線16b、
18b、20bを介して入力された条件コードと信号線
12aを介して出力された制御信号とに基づき、ループ
の初回,最終回,及びその他の繰り返し時の各場合に応
じて、命令実行ユニット(積和演算ユニット22,ロー
ド/ストアユニット24,26)の実行結果をレジスタ
ファイル30又はデータメモリ28へ書き込み可能とす
るか否かを判定する。
In the condition determination control unit 14, the signal lines 16b,
Based on the condition code input via the signal lines 18b and 20b and the control signal output via the signal line 12a, the instruction execution unit ( It is determined whether or not the execution result of the product-sum operation unit 22, the load / store units 24, 26) can be written to the register file 30 or the data memory 28.

【0031】そして、命令実行ユニット(積和演算ユニ
ット22,ロード/ストアユニット24,26)それぞ
れに対応する書き込み可否情報が信号線14a,14
b,14cを介してレジスタファイル30及びデータメ
モリ28へ入力される。尚、信号線16b及び信号線1
4aは積和演算ユニット22に対応し、信号線18b、
14bはロード/ストアユニット24に対応し、信号線
20b,14cはロード/ストアユニット26に対応し
ている。
Then, the write enable / disable information corresponding to each of the instruction execution units (the product-sum operation unit 22, the load / store units 24, 26) is transmitted to the signal lines 14a, 14a.
The data is input to the register file 30 and the data memory 28 via b and 14c. The signal line 16b and the signal line 1
4a corresponds to the product-sum operation unit 22, and the signal line 18b,
14b corresponds to the load / store unit 24, and the signal lines 20b and 14c correspond to the load / store unit 26.

【0032】これらの動作と並行して、命令実行ユニッ
ト(積和演算ユニット22,ロード/ストアユニット2
4,26)では、積和演算及びロード/ストアが並列に
実行される。積和演算ユニット22では、レジスタファ
イル30から信号線30a,30b,30cを介して入
力された3データに対して積和演算が行われる。条件判
定制御部14からの制御信号14aが書き込み可の場
合、信号線22aを介して出力される演算結果はレジス
タファイル30へ書き込まれ、さもなければ書き込まれ
ない。
In parallel with these operations, an instruction execution unit (product-sum operation unit 22, load / store unit 2)
In (4, 26), the product-sum operation and the load / store are executed in parallel. The product-sum operation unit 22 performs a product-sum operation on three data input from the register file 30 via the signal lines 30a, 30b, and 30c. If the control signal 14a from the condition determination control unit 14 is writable, the operation result output via the signal line 22a is written to the register file 30, otherwise it is not written.

【0033】ロード/ストアユニット22は、ロード動
作時には、レジスタファイル30から信号線30dを介
して入力されたメモリアドレスが信号線24cを介して
データメモリ28へ転送される。そして、このアドレス
によって指し示されるメモリ内のデータが信号線28a
を介してデータメモリ28からレジスタファイル30へ
ロードされる。条件判定制御部14から信号線14aを
介して出力される制御信号が書き込み可の場合、ロード
データ28aはレジスタファイル30へ書き込まれ、さ
もなければ書き込まれない。
During the load operation, the load / store unit 22 transfers the memory address input from the register file 30 via the signal line 30d to the data memory 28 via the signal line 24c. Then, the data in the memory indicated by this address is transferred to the signal line 28a.
Is loaded from the data memory 28 to the register file 30 via the. If the control signal output from the condition determination control unit 14 via the signal line 14a is writable, the load data 28a is written to the register file 30, otherwise it is not written.

【0034】一方、ストア動作時には、レジスタファイ
ル30から信号線30e,30fを介してロード/スト
アユニット24へ入力されたメモリアドレス,ストアデ
ータが、信号線24c、24bを介してデータメモリ2
8へ転送される。信号線14bを介して出力される信号
が書き込み可の場合、信号線24bを介して出力される
ストアデータは信号線24aを介して出力されるアドレ
スが指し示すメモリ内の位置に書き込まれ、さもなけれ
ば書き込まれない。
On the other hand, at the time of the store operation, the memory address and store data input from the register file 30 to the load / store unit 24 via the signal lines 30e and 30f are transferred to the data memory 2 via the signal lines 24c and 24b.
8 is transferred. If the signal output via the signal line 14b is writable, the store data output via the signal line 24b is written to a location in the memory indicated by the address output via the signal line 24a, otherwise. If not written.

【0035】ロード及びストアいずれの場合にも、これ
ら処理と並行して、メモリアクセスに用いられたアドレ
スはインクリメントされた後、信号線24aを介して出
力され、信号線14bを介して出力される信号が書き込
み可の場合、信号線24aを介して出力される内容はレ
ジスタファイル30へ書き込まれ、さもなければ書き込
まれない。
In both cases of load and store, in parallel with these processes, the address used for the memory access is incremented and then output via the signal line 24a and output via the signal line 14b. If the signal is writable, the content output via signal line 24a is written to register file 30, otherwise it is not written.

【0036】ロード/ストアユニット26は、ロード動
作時には、レジスタファイル30から信号線30fを介
して入力されたメモリアドレスを信号線26cを介して
データメモリ28へ転送する。そして、信号線26cを
介して出力されるアドレスによって指し示されるデータ
メモリ28内のデータが信号線28bを介してデータメ
モリ28からレジスタファイル30にロードされる。
The load / store unit 26 transfers a memory address input from the register file 30 via the signal line 30f to the data memory 28 via the signal line 26c during a load operation. Then, data in the data memory 28 indicated by the address output via the signal line 26c is loaded from the data memory 28 to the register file 30 via the signal line 28b.

【0037】条件判定制御部14からの制御信号14c
が書き込み可の場合、信号線28bを介して出力される
ロードデータはレジスタファイル30へ書き込まれ、さ
もなければ書き込まれない。一方、ストア動作時には、
レジスタファイル30から信号線30f,30gを介し
てロード/ストアユニット26へ入力されたメモリアド
レス,ストアデータが、信号線26c,26bを介して
データメモリ28へ転送される。
Control signal 14c from condition determination control unit 14
Is writable, the load data output via the signal line 28b is written to the register file 30, otherwise it is not written. On the other hand, during store operation,
Memory addresses and store data input from the register file 30 to the load / store unit 26 via the signal lines 30f and 30g are transferred to the data memory 28 via the signal lines 26c and 26b.

【0038】信号線14cを介して出力される信号が書
き込み可の場合、信号線26bを介して出力されるスト
アデータはデータメモリ28へ書き込まれ、さもなけれ
ば書き込まれない。ロード及びストアいずれの場合に
も、これら処理と並行して、メモリアクセスに用いられ
たアドレスはインクリメントされた後、信号線26aを
介して出力され、信号線14cを介して出力される信号
が書き込み可の場合、信号線26aを介して出力される
内容はレジスタファイル30へ書き込まれ、さもなけれ
ば書き込まれない。
If the signal output via the signal line 14c is writable, the store data output via the signal line 26b is written to the data memory 28, otherwise it is not written. In both cases of load and store, in parallel with these processes, the address used for memory access is incremented and then output via the signal line 26a and the signal output via the signal line 14c is written. If yes, the content output via signal line 26a is written to register file 30, otherwise it is not written.

【0039】次に、より具体的に本実施形態について説
明する。いま、図1に示したループ制御部12は、ルー
プの初回のとき、信号線12aを介して「01」を出力
し、ループの最終回のときには「10」を出力し、その
他の繰り返し時には「00」を出力するものとする。
Next, the present embodiment will be described more specifically. Now, the loop controller 12 shown in FIG. 1 outputs “01” via the signal line 12a at the first time of the loop, outputs “10” at the last time of the loop, and outputs “10” at the time of the other iterations. 00 ”is output.

【0040】図2は、命令コード内のフィールド構成を
示す図である。図2に示した例においては、16ビット
長のフィールドのうちビット15,14は条件コードf
1であり、フィールドのビット13からビット0までは
命令固有の操作を指定する操作コードf2である。条件
コードf1が「00」のとき、ループの初回及び最終回
は本条件コードが含まれる命令を実行せず、その他の繰
り返し時には常に実行することを意味する。
FIG. 2 is a diagram showing a field configuration in the instruction code. In the example shown in FIG. 2, bits 15 and 14 of the 16-bit length field have condition code f
It is 1 and bits 13 to 0 of the field are operation codes f2 for specifying an instruction-specific operation. When the condition code f1 is “00”, it means that the instruction including the present condition code is not executed at the first and last times of the loop, and is always executed at other times.

【0041】条件コードf1が「01」のときには、ル
ープの最終回は本条件コードが含まれる命令を実行せ
ず、その他の繰り返し時には常に実行することを意味す
る。また、条件コードf1が「10」のときには、ルー
プの初回は本条件コードが含まれる命令を実行せず、そ
の他の繰り返し時には常に実行することを意味する。
When the condition code f1 is "01", it means that the instruction including the present condition code is not executed at the last time of the loop, and is always executed at other times. Further, when the condition code f1 is “10”, it means that the instruction including the present condition code is not executed at the first time of the loop, and is always executed at other times.

【0042】図3は、図1中の条件判定制御部14の構
成を示すブロック図である。ループ制御部12から信号
線12aを介して出力された2ビット信号と信号線16
b,18b,20bを介して出力される各2ビットの条
件コードが条件判定制御部14に入力され、判定回路4
0,42,44によってレジスタへの書き込み可否を判
定し、信号線14a,14b,14cを介して判定結果
を出力する。
FIG. 3 is a block diagram showing the configuration of the condition determination control unit 14 in FIG. The 2-bit signal output from the loop control unit 12 via the signal line 12a and the signal line 16
b, 18b, and 20b, the 2-bit condition code is input to the condition determination control unit 14, and the determination circuit 4
Whether write to the register is possible or not is determined by 0, 42, and 44, and the determination result is output via the signal lines 14a, 14b, and 14c.

【0043】判定回路40は、信号線12aを介して入
力される信号が「00」のとき(すなわち、ループの初
回でも最終回でもない場合)、書き込み可を意味する
「1」を、信号線14aを介して出力する。信号線12
aを介して入力される信号が「01」のとき(すなわ
ち、ループの初回)、信号線16bを介して入力される
条件コードが信号線12aを介して入力される信号に一
致するとき(すなわち、信号線16bを介して入力され
る条件コードが「01」であり、ループの初回に実行す
べき命令であるとき)のみ信号線14aを介して「1」
を出力し、一致しないときには書き込み不可を意味する
「0」を出力する。
When the signal input via the signal line 12a is "00" (that is, when the signal is neither the first time nor the last time of the loop), the determination circuit 40 outputs "1" which means that writing is possible, to the signal line Output via 14a. Signal line 12
When the signal input via signal line a is "01" (i.e., the first time of the loop), the condition code input via signal line 16b matches the signal input via signal line 12a (i.e., , When the condition code input via the signal line 16b is “01”, which is an instruction to be executed at the first time of the loop), “1” via the signal line 14a
Is output, and when they do not match, "0" which means that writing is disabled is output.

【0044】信号線12aを介して入力される信号が
「10」のとき(すなわち、ループの最終回)、信号線1
6bを介して入力される条件コードが信号線12aを介
して入力される信号に一致するとき(すなわち、信号線
16bを介して入力される条件コードが「10」であ
り、ループの最終回に実行すべき命令であるとき)のみ
信号線14aを介して「1」を出力し、一致しないとき
には書き込み不可を意味する「0」を出力する。 判定
回路42,44も、それぞれ信号線18b,20bを介
して入力される条件コードに対して同様の処理を行い、
信号線14b,14cを介して書き込み可否信号を出力
する。
When the signal input through the signal line 12a is "10" (ie, the last time of the loop), the signal line 1
When the condition code input via the signal line 6b matches the signal input via the signal line 12a (that is, the condition code input via the signal line 16b is "10" and "1" is output via the signal line 14a only when the instruction is to be executed (if the instruction is to be executed). The determination circuits 42 and 44 also perform the same processing on the condition codes input via the signal lines 18b and 20b, respectively.
A write enable / disable signal is output via the signal lines 14b and 14c.

【0045】図4は、本実施形態に基づいてDSPにお
けるループ命令を実装し、このループ命令を用いて図8
のアセンブラプログラムを書き換えた図である。ループ
内の命令列のうち、条件コードが「01」の命令の先頭
には記号「$」、「10」の命令には記号「$$」が付
されており、これら記号はプログラマが指定する。図4
に示されたプログラムは、ループ前処理部及びループ後
処理部が無くなったため、図8に示されたプログラムに
比べて命令数がほぼ半減している。
FIG. 4 shows the implementation of a loop instruction in a DSP based on the present embodiment, and FIG.
FIG. 6 is a diagram obtained by rewriting the assembler program of FIG. Of the instruction sequence in the loop, the instruction with the condition code "01" is prefixed with the symbol "@", and the instruction with the condition code "10" is prefixed with the symbol "@", and these symbols are designated by the programmer. . FIG.
Since the program shown in FIG. 8 does not have the pre-loop processing unit and the post-loop processing unit, the number of instructions is almost halved as compared with the program shown in FIG.

【0046】以上、本発明の一実施形態について説明し
た。本実施形態においては、命令実行ユニット数が3の
場合について説明したが、それ以外の場合でも本発明を
適用できることは明らかである。また、ループの初回や
最終回に限らず、2回目,3回目などのその他の繰り返
し時毎に条件実行させる場合にも、本発明と同様に実現
できることは明らかである。更に、条件コードにおける
条件指定方法や指定内容に対して様々な変形を加えて
も、本発明と同様に実現できることは明らかである。
The embodiment of the present invention has been described above. In the present embodiment, the case where the number of instruction execution units is 3 has been described. However, it is apparent that the present invention can be applied to other cases. In addition, it is apparent that the present invention can be implemented similarly to the present invention not only in the first or last loop, but also in the case of executing the condition every other time such as the second and third times. Further, it is apparent that the present invention can be realized in the same manner as in the present invention even if various modifications are made to the condition designation method and designation contents in the condition code.

【0047】[0047]

【発明の効果】以上、説明したように、本発明によれ
ば、ループ繰り返し回数に基づいてループ内の命令列を
条件実行することにより、ループ前処理部用と後処理部
用の命令列が不要になるため、ループ処理プログラムに
おけるコードサイズを削減できるという効果がある。
As described above, according to the present invention, the instruction sequence for the loop pre-processing unit and the instruction sequence for the post-processing unit can be executed by conditionally executing the instruction sequence in the loop based on the number of loop repetitions. Since it becomes unnecessary, there is an effect that the code size in the loop processing program can be reduced.

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

【図1】 本発明の一実施形態によるループ処理方式の
構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a loop processing method according to an embodiment of the present invention.

【図2】 命令コード内のフィールド構成を示す図であ
る。
FIG. 2 is a diagram showing a field configuration in an instruction code.

【図3】 図1中の条件判定制御部14の構成を示すブ
ロック図である。
FIG. 3 is a block diagram showing a configuration of a condition determination control unit 14 in FIG.

【図4】 本実施形態に基づいてDSPにおけるループ
命令を実装し、このループ命令を用いて 図6のアセン
ブラプログラムを書き換えた図である。
FIG. 4 is a diagram in which a loop instruction in a DSP is implemented based on the present embodiment, and the assembler program of FIG. 6 is rewritten using the loop instruction.

【図5】 従来のループ処理方式の構成を示すブロック
図である。
FIG. 5 is a block diagram showing a configuration of a conventional loop processing method.

【図6】 従来のループ処理方式をDSPに適用するこ
とによってループ命令を実装し、このループ命令を用い
てFIRフィルタをソフトウェアで実現したときのアセ
ンブラプログラムを示した図である。
FIG. 6 is a diagram illustrating an assembler program when a loop instruction is implemented by applying a conventional loop processing method to a DSP, and an FIR filter is realized by software using the loop instruction.

【図7】 従来のループ処理方式を用いてDSPのルー
プ命令を実装した場合に問題となるFIRフィルタ実現
プログラムを示す図である。
FIG. 7 is a diagram showing an FIR filter realization program which becomes a problem when a DSP loop instruction is implemented using a conventional loop processing method.

【図8】 従来のループ処理方式を用いてDSPのルー
プ命令を実装した場合に問題となるFIRフィルタ実現
プログラムを改良したプログラムを示す図である。
FIG. 8 is a diagram showing a program obtained by improving an FIR filter realization program which causes a problem when a DSP loop instruction is implemented using a conventional loop processing method.

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

12 ループ制御部(ループ制御手段) 14 条件判定制御部(書き込み制御手
段) 16,18,20 条件コード用レジスタ(条件指示
手段)
12 loop control unit ( loop control unit ) 14 condition determination control unit ( write control unit) 16, 18, 20 condition code register (condition instruction unit)

───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.7,DB名) G06F 9/30 - 9/42 ──────────────────────────────────────────────────続 き Continued on the front page (58) Field surveyed (Int.Cl. 7 , DB name) G06F 9/30-9/42

Claims (3)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 ループの繰り返し回数に関する情報を指
示するループ制御手段と、 前記ループの繰り返し回数に関する情報に応じて条件実
行するための条件を指定する条件指示手段と、 前記ループの繰り返し回数に関する情報及び前記条件に
基づいて演算結果の記憶手段への書き込みを制御する
き込み制御手段とを具備することを特徴とするループ処
理方式。
And 1. A loop control means for indicating information relating to the number of iterations of the loop, the condition instructing means for specifying a condition for conditional execution in accordance with the information about the number of iterations of the loop, information about the number of iterations of the loop And a control program for controlling the writing of the operation result to the storage means based on the condition .
A loop processing method comprising: a writing control unit.
【請求項2】 前記ループ制御手段は、前記指示と並行
して、ループ処理実行制御を行うことを特徴とする請求
項1記載のループ処理方式。
2. The loop processing method according to claim 1, wherein said loop control means performs loop processing execution control in parallel with said instruction .
【請求項3】 前記ループの繰り返し回数に関する情報
は、ループの初回,最終回,又はその他の繰り返し時の
いずれかの状態であることを示す情報であることを特徴
とする請求項1記載のループ処理方式。
3. The loop according to claim 1, wherein the information on the number of times the loop is repeated is information indicating that the state is any of the first time, the last time, and other times of the loop. Processing method.
JP36555198A 1998-12-22 1998-12-22 Loop processing method Expired - Fee Related JP3211791B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP36555198A JP3211791B2 (en) 1998-12-22 1998-12-22 Loop processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP36555198A JP3211791B2 (en) 1998-12-22 1998-12-22 Loop processing method

Publications (2)

Publication Number Publication Date
JP2000187591A JP2000187591A (en) 2000-07-04
JP3211791B2 true JP3211791B2 (en) 2001-09-25

Family

ID=18484542

Family Applications (1)

Application Number Title Priority Date Filing Date
JP36555198A Expired - Fee Related JP3211791B2 (en) 1998-12-22 1998-12-22 Loop processing method

Country Status (1)

Country Link
JP (1) JP3211791B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1816905A2 (en) 1997-02-03 2007-08-08 Ibiden Co., Ltd. Printed wiring board and method of manufacturing the same

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9201657B2 (en) * 2004-05-13 2015-12-01 Intel Corporation Lower power assembler

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1816905A2 (en) 1997-02-03 2007-08-08 Ibiden Co., Ltd. Printed wiring board and method of manufacturing the same

Also Published As

Publication number Publication date
JP2000187591A (en) 2000-07-04

Similar Documents

Publication Publication Date Title
US6560697B2 (en) Data processor having repeat instruction processing using executed instruction number counter
US20080016321A1 (en) Interleaved hardware multithreading processor architecture
JPH0496825A (en) Data processor
JP2620511B2 (en) Data processor
JP3789583B2 (en) Data processing device
US6055628A (en) Microprocessor with a nestable delayed branch instruction without branch related pipeline interlocks
JPS623342A (en) Pipeline processor
JP3211791B2 (en) Loop processing method
JP7048612B2 (en) Vector generation instruction
JP2002229779A (en) Information processor
JP3786575B2 (en) Data processing device
JPH09212360A (en) Data processor
JP2000039995A (en) Flexible accumulate register file to be used in high performance microprocessor
JP2861560B2 (en) Data processing device
JP3740321B2 (en) Data processing device
JP3490191B2 (en) calculator
JP2880459B2 (en) Variable word length VLIW instruction processor
JP3531856B2 (en) Program control method and program control device
JP3759742B2 (en) Data processing device
JP2005134987A (en) Pipeline arithmetic processor
JP3060917B2 (en) Processor
JPS6020245A (en) Instruction control circuit of data processor
JPH0512009A (en) Digital signal processing device
JPS6149695B2 (en)
JP2000181703A (en) Information processor

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20010619

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

Free format text: PAYMENT UNTIL: 20070719

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20080719

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20090719

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20100719

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20110719

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20110719

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20120719

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20120719

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20130719

Year of fee payment: 12

LAPS Cancellation because of no payment of annual fees