JPH0625965B2 - Rounding specification method - Google Patents

Rounding specification method

Info

Publication number
JPH0625965B2
JPH0625965B2 JP60291140A JP29114085A JPH0625965B2 JP H0625965 B2 JPH0625965 B2 JP H0625965B2 JP 60291140 A JP60291140 A JP 60291140A JP 29114085 A JP29114085 A JP 29114085A JP H0625965 B2 JPH0625965 B2 JP H0625965B2
Authority
JP
Japan
Prior art keywords
rounding
instruction
designating
type
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.)
Expired - Lifetime
Application number
JP60291140A
Other languages
Japanese (ja)
Other versions
JPS62150431A (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
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP60291140A priority Critical patent/JPH0625965B2/en
Publication of JPS62150431A publication Critical patent/JPS62150431A/en
Publication of JPH0625965B2 publication Critical patent/JPH0625965B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、数値演算を実行するシステムに於ける型変換
及び異なるデータタイプとの演算時に生ずる丸めの制御
に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to type conversion in a system that performs numerical operations and control of rounding that occurs during operations with different data types.

〔従来の技術〕[Conventional technology]

数値演算に於る丸めの種類としては、例えばIEEEでは
4種類の丸めモード(toward+as,toward-as,toward 0,ne
arest)が規定されている。従来の数値演算システムに於
てはこれら4種類の丸めの一つを指定することにより演
数の種類に拘らず一種類の丸めを実行する形式となって
いた。例えば文献(1)によると、丸めの種類は、コント
ロール・ワードのRC(Round-Control)フィールドによっ
て選択できる様になっており、ユーザーがいずれかを指
定すると、指定を変更しない限りその一種類の丸めがあ
らゆる演算に対し適用、実行される。
As the types of rounding in the numerical operation, for example, I EEE has four types of rounding modes (toward + as, toward-as, toward 0, ne.
arest) is specified. In the conventional numerical operation system, by designating one of these four types of rounding, one type of rounding is executed regardless of the type of play. For example, according to reference (1), the rounding type can be selected by the RC (Round-Control) field of the control word, and if the user specifies one, that type of rounding will be used unless the specification is changed. Rounding is applied and performed for every operation.

文献(1) 「IAPX86ファミリ・ユーザーズマユュアル」
第3章インテルジャパン(1981) 〔発明が解決しようとする問題点〕 上述した従来の丸め指定方式は一度丸めの種類を指定す
ると、一種類のみが、丸めが実行されない。このためC,
FORTRAN言語等の様に、代入文の実行による。自動型変
換とそれに伴う丸めがしばしば行なわれ、しかも、型変
換のタイプと対応する丸め方式が何種類かある様な場合
には、指定が一種類のみであると異った型変換が生じる
毎に丸めの種類を、指定し直さなければならずオーバー
ヘッドが生じるという欠点がある。
Reference (1) "IAPX86 Family User's Manual"
Chapter 3 Intel Japan (1981) [Problems to be Solved by the Invention] In the above-described conventional rounding designation method, once the rounding type is designated, only one type is not rounded. Therefore C,
By executing an assignment statement, as in the FORTRAN language. In cases where automatic type conversion and rounding associated with it are often performed, and there are several types of rounding methods that correspond to the type of type conversion, each time a different type conversion occurs if only one type is specified. There is a drawback in that the rounding type must be re-specified and overhead occurs.

たとえば、C言語での型変換を第3図のプログラム例と
演算結果を用いて説明することにする。プログラム例の
line10,17,24,31は実数から整数への型変
換、line11,18,25,32は実数の倍精度から単
精度への型変換、演算結果のline2,5,8,11は実
数から整数への型変換の演算結果、line3,6,9,1
2は実数の倍精度から単精度への型変換の演算結果であ
る。これらに示される様に実数から整数への変換時の丸
めは切り捨てであり、実数の倍精度から単精度への変換
時の丸めは四捨五入で行なわれる。
For example, the type conversion in C language will be described using the program example of FIG. 3 and the operation result. Program example
line10,17,24,31 is type conversion from real number to integer, line11,18,25,32 is type conversion from double precision of real number to single precision, line2,5,8,11 of operation result is real number to integer Result of type conversion to line3,6,9,1
Reference numeral 2 is the calculation result of the type conversion from the double precision of the real number to the single precision. As shown in these figures, the rounding when converting from a real number to an integer is rounded down, and the rounding when converting from a double precision of a real number to single precision is done by rounding off.

従って、他の演算時に、他の丸めモードを指定した場
合、型変換が生じる毎に丸めの種類を指定し直さなけれ
ばならないのである。
Therefore, when another rounding mode is specified during another operation, the rounding type must be specified again each time a type conversion occurs.

〔問題点を解決するための手段〕[Means for solving problems]

本発明の丸め指定方式は、丸めの種類を指定する第一の
指定手段と、特定の命令を識別する識別手段と、識別手
段の指示により丸めの種類を指定する第二の指定手段
と、第一、又は第二の指定手段のいづれかの選択を指示
する指示手段と、指示手段の指示に従い丸めを実行する
丸め手段を有し、指示手段による指示のない場合には、
第一の指定手段の指定に従い丸めを実行し、指示手段に
よる指示があり、かつ、命令の識別手段により特定の命
令が識別された場合には、第二の指定手段の指定を優先
して、丸めを実行し、その他の場合には、第一の指定手
段の指定を優先して丸めを実行することが可能な丸め指
定方式である。
The rounding designation method of the present invention includes a first designating means for designating a rounding type, an identifying means for identifying a specific command, a second designating means for designating a rounding type according to an instruction of the identifying means, In the case where there is no instruction by the instructing means, there is an instructing means for instructing selection of either the first or the second instructing means, and a rounding means for performing rounding in accordance with the instruction of the instructing means.
When the rounding is performed according to the designation of the first designating means, and there is an instruction by the designating means, and the specific instruction is identified by the identifying means of the instruction, the designation of the second designating means is given priority, In this case, the rounding is performed, and in other cases, the rounding is performed by giving priority to the designation of the first designating unit.

〔実施例〕〔Example〕

次に本発明について図面を参照して説明する。 Next, the present invention will be described with reference to the drawings.

第1図は、本発明の請求範囲の一実施例の構成概要図、
第2図は優先回路の説明図、第4図は命令と丸めの種類
による対応表である。
FIG. 1 is a schematic configuration diagram of an embodiment of the claims of the present invention,
FIG. 2 is an explanatory diagram of the priority circuit, and FIG. 4 is a correspondence table according to instructions and rounding types.

第1図に於て、1は4ビットのフリップフロップ、2は
命令デコーダ、3はPLA、4は1ビットのフリップフ
ロップ、5は優先回路、6は丸め実行回路である。
In FIG. 1, 1 is a 4-bit flip-flop, 2 is an instruction decoder, 3 is a PLA, 4 is a 1-bit flip-flop, 5 is a priority circuit, and 6 is a rounding execution circuit.

1の情報はCPUの特つ書き込み命令等によりセットさ
れる。各ビットは、それぞれの丸めモードに対応し、4
ビット中の1ビットのみが1の値を持つように値をセッ
トする。この値は4の値が0の場合は、5の優先回路に
従い、6へ出力される。又、4の値が1の場合は2によ
り特定の命令がデコードされて、3のPLAに入力され
ている信号線の内、対応するものが1になると第1表に
従い、PLAでプログラムされた出力線が1となり、5
の優先回路に従い3から6へ出力される。5は優先回路
であり、4の出力が0の時は1からの出力を優先し、6
へ供給し、4の出力が1の時には、3の出力のいずれか
が1であれば、その出力を、そうでなければ、1からの
出力を優先し、6へ供給する。
The information 1 is set by a special write command of the CPU. Each bit corresponds to its rounding mode, 4
Set the value so that only one of the bits has the value 1. When the value of 4 is 0, this value is output to 6 according to the priority circuit of 5. When the value of 4 is 1, the specific instruction is decoded by 2, and when the corresponding one of the signal lines input to the PLA of 3 becomes 1, it is programmed by the PLA according to Table 1. Output line becomes 1 and 5
It is output from 3 to 6 according to the priority circuit of. 5 is a priority circuit, and when the output of 4 is 0, the output from 1 is given priority, and 6
When one of the outputs of 3 is 1, when the output of 4 is 1, the output is prioritized, otherwise the output from 1 is given, and the output is supplied to 6.

次に優先回路5の具体例を、第2図に用いて、説明す
る。第2図に於て11〜16はアンド回路、17〜19
はオア回路、20はナンド回路、21〜24は1からの
出力信号、25,26は3からの出力信号、27は1ビ
ットのフリップフロップ28〜31は6への出力信号で
ある。たとえば、1からの信号24が1であったとす
る。
Next, a specific example of the priority circuit 5 will be described with reference to FIG. In FIG. 2, 11 to 16 are AND circuits, 17 to 19
Is an OR circuit, 20 is a NAND circuit, 21 to 24 are output signals from 1, 25 and 26 are output signals from 3, 27 is a 1-bit flip-flop 28 to 31 is an output signal to 6. For example, suppose the signal 24 from 1 was 1.

この時27からの信号が0であれば、1からの信号24
が優先され、30が6へ出力される。
At this time, if the signal from 27 is 0, the signal from 1 is 24
Is prioritized and 30 is output to 6.

次に1からの信号24が1でかつ27の信号が1であっ
たとする。この時、3からの信号25が1の時には3か
らの信号が優先され、28が6へ出力される。又、3か
らの信号25,26が共に0の場合1からの信号が優先
されて、30が6へ出力される。
Next, it is assumed that the signal 24 from 1 is 1 and the signal of 27 is 1. At this time, when the signal 25 from 3 is 1, the signal from 3 is prioritized and 28 is output to 6. When the signals 25 and 26 from 3 are both 0, the signal from 1 is prioritized and 30 is output to 6.

以上説明した様に4からの出力により1で指定した信号
か3で指定した信号のいずれかが、優先され、丸めを実
行する。
As described above, either the signal designated by 1 or the signal designated by 3 is given priority by the output from 4, and rounding is performed.

〔発明の効果〕〔The invention's effect〕

以上説明したように、本発明は、丸めの種類を指定する
第一の指定手段以外に、命令を識別する。識別手段によ
り丸めの種類を指定する第二の指定手段、第一の指定手
段又は第二の指定手段のいずれかを指示する指示手段を
設け、指示手段の指示に従い、丸めを実行させることに
より、丸めの種類があらかじめ決まっているある特定の
命令に対しては、命令が変わる毎に改めて丸めを指定し
直す必要がなく、オーバーヘッドが生じなくてすむとい
う効果がある。
As described above, the present invention identifies an instruction in addition to the first specifying means for specifying the rounding type. By providing the second designating means for designating the type of rounding by the identifying means, the designating means for designating either the first designating means or the second designating means, and executing the rounding according to the instruction of the designating means, For a specific instruction whose rounding type is predetermined, it is not necessary to re-specify the rounding each time the instruction changes, and there is an effect that overhead does not occur.

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

第1図は本発明の一実施例の構成概要図、第2図は優先
回路の説明図、第3図はプログラム例と、演算結果を示
す図、第4図は命令と丸めの種類の対応の図である。 1……4ビットのフリップフロップ、2……命令デコー
ダ、3……PLA、4……1ビットのフリップフロッ
プ、5……優先回路、6……丸め回路、11〜16……
アンド回路、17〜19……オア回路、20……ナンド
回路、21〜24……1からの出力信号、25〜26…
…3からの出力信号、27……1ビットのフリップフロ
ップ、28〜31……6への出力信号。
FIG. 1 is a schematic configuration diagram of an embodiment of the present invention, FIG. 2 is an explanatory diagram of a priority circuit, FIG. 3 is a program example and a diagram showing a calculation result, and FIG. 4 is a correspondence between an instruction and a rounding type. FIG. 1 ... 4-bit flip-flop, 2 ... instruction decoder, 3 ... PLA, 4 ... 1-bit flip-flop, 5 ... priority circuit, 6 ... rounding circuit, 11-16 ...
AND circuit, 17-19 ... OR circuit, 20 ... NAND circuit, 21-24 ... Output signal from 1 ... 25-26 ...
3 output signal, 27 1-bit flip-flop, 28 to 31 output signal to 6.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】複数のデータタイプを扱い数値演算を実行
するシステムに於て、丸めの種類を指定する第一の指定
手段と、特定の命令を識別する識別手段と、識別手段の
指示により丸めの種類を指定する第二の手段と、第一あ
るいは第二の指定手段のいずれかの選択を指示する指示
手段と、この指示手段の指示に従い、丸めを実行する丸
め手段とを備え、前記指示手段による指示のない場合に
は、前記第一の指定手段の指定に従い前記丸め手段を活
性化して丸めを実行させ、前記指示手段による指示があ
りかつ前記識別手段により前記特定の命令が識別された
場合には、前記第二の指定手段の指定を優先して丸めを
実行させ、その他の場合には、前記第一の指定手段によ
る指定を優先して丸めを実行させることを特徴とする丸
め指定方式。
1. In a system that handles a plurality of data types and executes a numerical operation, a first designating unit that designates a type of rounding, an identifying unit that identifies a specific instruction, and a rounding by an instruction of the identifying unit. And a rounding means for performing rounding in accordance with the instruction of the instructing means, the instruction means for instructing selection of either the first or the second instructing means. When there is no instruction by the means, the rounding means is activated according to the designation of the first designating means to perform rounding, and there is an instruction by the instructing means, and the specific instruction is identified by the identifying means. In this case, the rounding designation is performed by giving priority to the designation by the second designating means and by executing the rounding in the other cases by giving priority to the designation by the first designating means. method.
JP60291140A 1985-12-23 1985-12-23 Rounding specification method Expired - Lifetime JPH0625965B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP60291140A JPH0625965B2 (en) 1985-12-23 1985-12-23 Rounding specification method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP60291140A JPH0625965B2 (en) 1985-12-23 1985-12-23 Rounding specification method

Publications (2)

Publication Number Publication Date
JPS62150431A JPS62150431A (en) 1987-07-04
JPH0625965B2 true JPH0625965B2 (en) 1994-04-06

Family

ID=17764963

Family Applications (1)

Application Number Title Priority Date Filing Date
JP60291140A Expired - Lifetime JPH0625965B2 (en) 1985-12-23 1985-12-23 Rounding specification method

Country Status (1)

Country Link
JP (1) JPH0625965B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2586840Y2 (en) * 1991-08-21 1998-12-14 建治 大朏 Heading labels

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5931094B2 (en) * 1976-03-25 1984-07-31 カシオ計算機株式会社 Arithmetic control method for electronic calculator with program
JPS60164247U (en) * 1984-03-30 1985-10-31 カシオ計算機株式会社 Rounding calculation circuit

Also Published As

Publication number Publication date
JPS62150431A (en) 1987-07-04

Similar Documents

Publication Publication Date Title
US4691278A (en) Data processor executing microprograms according to a plurality of system architectures
JPH07104842B2 (en) External storage interrupt control method
JPH0625965B2 (en) Rounding specification method
EP0240606A2 (en) Pipe-line processing system and microprocessor using the system
JPS60231211A (en) Interface device between numerical control device and high power control circuit
JPS6156812B2 (en)
JPS6149209A (en) Program execution system of numerical controller
JP2526703B2 (en) Programmable controller
JP2536609B2 (en) Bus selection circuit
JPS60134940A (en) Register selecting system of information processing device
JPH0617195Y2 (en) Musical sound generator
JPS6115453B2 (en)
JPS6325373B2 (en)
JPS6049335B2 (en) Branch address determination method in microprogram controlled data processing equipment
JPS6373332A (en) Microprogram control system
JPH0239812B2 (en)
JPS59116857A (en) Processor for microprogram control data
JPS6232500B2 (en)
JPH06282601A (en) Logical simulator
JPH052481A (en) Arithmetic control circuit
JPH02266439A (en) Microcomputer for evaluating program
JPH0670772B2 (en) Micro program controller
JPH0740243B2 (en) Information processing equipment
JPS5943446A (en) Microcomputer system
JPS59218510A (en) Sequence controller