JPH04112320A - Trigonometrical function arithmetic device - Google Patents

Trigonometrical function arithmetic device

Info

Publication number
JPH04112320A
JPH04112320A JP23307390A JP23307390A JPH04112320A JP H04112320 A JPH04112320 A JP H04112320A JP 23307390 A JP23307390 A JP 23307390A JP 23307390 A JP23307390 A JP 23307390A JP H04112320 A JPH04112320 A JP H04112320A
Authority
JP
Japan
Prior art keywords
constant
value
comparison
result
adder
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
JP23307390A
Other languages
Japanese (ja)
Other versions
JP2546916B2 (en
Inventor
Masakazu Chiba
千葉 雅一
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 IC Microcomputer Systems Co Ltd
Original Assignee
NEC IC Microcomputer Systems 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 NEC IC Microcomputer Systems Co Ltd filed Critical NEC IC Microcomputer Systems Co Ltd
Priority to JP2233073A priority Critical patent/JP2546916B2/en
Publication of JPH04112320A publication Critical patent/JPH04112320A/en
Application granted granted Critical
Publication of JP2546916B2 publication Critical patent/JP2546916B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

PURPOSE:To reduce the rate of the number of ROMs contained in the computer hardware by carrying out selectively the operations to add '1' to the output contents of a constant generating means based on the result of comparison of a comparator means. CONSTITUTION:A comparator 2 stores and compares the output value (k) of an exponent computing element 1 with a prescribed constant. The finction values are sequentially generated as the constants in a range covering K=0 through k=m-1 in rK=2<k> X arctan (2<-k>) where k=0, 1...m-1 and (m) is equal to an integer. At the same time, the values of 1/K are sequentially generated as constants in a range covering k=0 through k=m-1 in the function rK=II<m> (1+1<-2k>)<1/2> where k=0, 1...m-1 and (m) is a positive integer. The constant values of 1/k are selectively outputted based on the result of comparison of the comparator 2. Then an adder 6 selects the addresses of rK in response to the result of comparison of the comparator 2 and increases these addresses. An adder 10 adds selectively '1' to the most significant bit MSB of the output contents of the function rK based on the result of comparison of the comparator 2. As a result, the occupying rates of the constant ROM 3 and 4 are reduced in the computer hardware.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は三角関数演算装置に関する。[Detailed description of the invention] [Industrial application field] The present invention relates to a trigonometric function calculation device.

〔従来の技術〕[Conventional technology]

従来、三角関数を演算する方法としては、次式のティラ
ー級数展開即ち、 sinθ=θ〜θ3/3!モθ5151−θ7/7!+
・・・・−・(1)を用いるか、または、連分数展開お
よびチエビシエフ級数展開等による有理関数近似によっ
て求める方法が用いられている。
Conventionally, the method of calculating trigonometric functions is to expand the Tiller series of the following equation, ie, sin θ = θ ~ θ3/3! Mo θ5151-θ7/7! +
. . . (1) or a method of obtaining by rational function approximation using continued fraction expansion, Tievishev series expansion, etc. is used.

然しなから、上記の何れの方法においても、多くの乗算
もしくは除算を必要とするために、演算時間が長くなり
、しかも演算速度の点において満足されないという問題
がある。
However, both of the above methods require a large number of multiplications or divisions, resulting in a long calculation time and an unsatisfactory calculation speed.

上記の問題点に対する方策としては、マイクロプログラ
ム制御の計算機に適合する三角関数演算方式として、C
ORD I C(CordinaLe Rojat、i
onDigital Comput、er)のアルゴリ
ズムがある。このC0RD ICのアルゴリズムにおい
ては、加算、減算および右シフトによって演算を行うこ
とができるため、高速の乗算器を具備しない計算機にお
いても、有効であることが知られている。
As a solution to the above problems, C
ORD I C (Cordina Le Rojat, i
onDigital Compute, er). The C0RD IC algorithm is known to be effective even in computers that are not equipped with high-speed multipliers, since operations can be performed by addition, subtraction, and right shift.

前記C’0RDICのアルゴリズムによる演算原理は、
大要下記のとうりである。
The calculation principle of the C'0RDIC algorithm is as follows:
The summary is as follows.

2進法においてn(正整数)桁の精度のsinθおよび
cosθを求める場合、角度θは、定数γ1と数列 1
a、l を用いて、次式により表わされる。
When calculating sin θ and cos θ with precision of n (positive integer) digits in binary system, the angle θ is the constant γ1 and the sequence 1
It is expressed by the following equation using a and l.

θ=aoXγo+alXγ1−a2Xγ2+・・・・・
・+ a、−I Xγn−1+ε・・・・・・・・・(
2)但し、γ、 = arctan(2”−’)・・・
・・・・・・・・−・・・−・・(3)ak”i÷1.
  1i  ・・・・・・・・・・・・・・(4)数列
 1a5)は、引離し法の除算と類似した方法であり、
−意に決定することができる。なお、この数列 1ak
l を決定する過程は疑似除算と呼ばれる。
θ=aoXγo+alXγ1−a2Xγ2+...
・+ a, -I Xγn-1+ε・・・・・・・・・(
2) However, γ, = arctan(2''-')...
・・・・・・・・・−・・・−・・・(3)ak”i÷1.
1i ・・・・・・・・・・・・・・・(4) Sequence 1a5) is a method similar to division in the separation method,
- Can make decisions at will. Furthermore, this number sequence 1ak
The process of determining l is called pseudo-division.

従って、sinθおよ乙’ cosθは、Rm= 1 
/’ (L + 2−”)”2  ・・−・・・・・・
(5)と置いた場合に、加法定理により下記のようにし
て求められる。
Therefore, sinθ and cosθ are Rm=1
/' (L + 2-")"2 ・・・-・・・・・・
(5), it can be obtained as follows using the addition theorem.

ak=+1のときは、φに+1 =φ5+γ3cos(
φに++)=Rk(cosφy −2−’ X  si
nφk)・・・・・・−・・・・・・・・(6)sin
(φに++)=Rk(sinφに+2−’〆 cosφ
k)・・−・・・・・・・・・・・・ く7)ak= 
 1のときは、φI<+1 =φh  7kcos (
φに++)= Rm(cosφに+2−’ X  si
nφk)・・・・・・・−・・・・・・・(8)sin
(φに++)=Rm(sinφh  2−” X co
sφk)・・・・・−・・・・・−(9> となる。ここにおいて、Roを初期値として、kの値を
増加させるように、以上の演算操作を繰返し実行するこ
とによりφ5をθに近付けてゆく。このような操作を介
して、sinθおよびcosθが求められる。この演算
過程は疑似乗算と呼ばれる。
When ak=+1, +1 to φ =φ5+γ3cos(
+ to φ)=Rk(cosφy −2−′ X si
nφk)・・・・・・−・・・・・・・・・(6) sin
(++ to φ) = Rk (+2-' to sinφ) cosφ
k)・・・-・・・・・・・・・・・・ ku7)ak=
1, φI<+1 = φh 7kcos (
+ to φ) = Rm (+2-' to cosφ
nφk)・・・・・・・・・・・・・・・・・・(8) sin
(++ to φ)=Rm(sinφh 2−”X co
sφk)...--(9>) Here, by using Ro as the initial value and repeatedly performing the above calculation operations to increase the value of k, φ5 can be obtained. θ is approached. Through such operations, sin θ and cos θ are obtained. This calculation process is called pseudo multiplication.

以下に、数式を用いて、C0RDICのアルゴリズムを
用いた三角間数の浮動小数点演算原理を説明する。
The principle of floating point arithmetic of triangular numbers using the C0RDIC algorithm will be explained below using formulas.

[11人カデータである角度をθ(0<θ〈π/2)と
する。
[Let θ (0<θ<π/2) be the angle that corresponds to 11 people.

[2]上記角度θを、 θ=2−’ Xe(1≦θく2、iは整数)として、i
(指数部)およびθ(仮数部)を決定〈浮動小数点化)
し、V+=eを初期値とする。
[2] The above angle θ is set as θ=2−'Xe (1≦θ×2, i is an integer), and i
(exponent part) and θ (mantissa part) are determined (floating point conversion)
Then, let V+=e be the initial value.

[3]k=1、i+1、i + 2、−1m−1(mは
正整数)に対して、下記の[41を反復する。
[3] Repeat the following [41] for k=1, i+1, i + 2, -1m-1 (m is a positive integer).

[41Vk≧0ならば、ak=+1 ■5〈0ならば、ak=  1として、Vk+4=2X
(VkamXr”k)−由・・・(10)但し、 r’ k= 2’−’ X arctan(2−’) 
−−−(11)[5j x−= V=X (1/K) 
、Y、= V、−、、111111、、、、、、、、、
、、、(12)を初期値とする。ここで、 を満たす定数である。
[41 If Vk≧0, ak=+1 ■5 If 0, then ak=1, Vk+4=2X
(VkamXr"k) - (10) However, r' k= 2'-' X arctan (2-')
---(11) [5j x-= V=X (1/K)
,Y,=V,−,,111111,,,,,,,,,
, , (12) is the initial value. Here, is a constant that satisfies .

E61 k=m、m−1、m−2、・・・、i + 1
に対して、下記の[7)を反復する。
E61 k=m, m-1, m-2,..., i + 1
, repeat [7] below.

[7] Xh−x=L−a、x2−2kx:yk”””
’−”””’<14)Yk−1= (Ym f akX
 L)/2−−− ・= ・−・−(15)fLI  
sinθ:H21X Y 、、cosθ=X、が同時に
得られる。
[7] Xh-x=L-a, x2-2kx:yk"""
'-"""'<14) Yk-1= (Ym f akX
L)/2−−− ・= ・−・−(15) fLI
sin θ:H21X Y , cos θ=X, are obtained at the same time.

上記のC0RD ICアルゴリズムを計算機において用
いる場合には、上記の(11)式1式%(2) の定数と、上記(13)式 K = JT ”(1+ 2−2k>”2(k=0、1
.  ・・・、n) の逆数である1/にの定数が必要となる。
When the above C0RD IC algorithm is used in a computer, the constant of the above equation (11) 1 equation % (2) and the above equation (13) K = JT ”(1+ 2-2k>”2(k=0 ,1
.. ..., n) A constant for 1/, which is the reciprocal of , is required.

他方、本アルゴリズムを用いる場合には、θの範囲が、
Oくθくπ/4の時にだけ適応するので、π、・4以上
の場合には、入カテータをπ/4で剰余をとり、その値
について本アルコリズムを用いることになる。従って、
本アルゴリズムに入力されるデータというのは、指数部
が−mから−1までの範囲となる。
On the other hand, when using this algorithm, the range of θ is
It is applied only when O x θ x π/4, so when π,·4 or more, the remainder is taken from the input categor by π/4, and the present algorithm is used for that value. Therefore,
The data input to this algorithm has an exponent part ranging from -m to -1.

このことは、 π、/4=3.14・−・−/4=0.785・−=1
.57・−X2−1であることより明らかである。
This means that π,/4=3.14・−・−/4=0.785・−=1
.. This is clear from the fact that it is 57·-X2-1.

上記のように、−mから−1まで指数部が変化する場合
には、定数の値もm個必要となる。即ち、前記(11)
式の定数「、と、(13)式より求められる定数1/に
は、共にm個ずつ用意しなければならない。従来の計算
機においては、前記定数を予め定数ROM (Read
 0nly 14emoly)に用意しておき、三角関
数の演算処理に使用している。この場合における「kの
定数ROMの内容例を第3図の表に示し、また、定数1
/にの定数ROMの内容例を第4図に示す。但し、仮数
部の演算範囲を32から−1(10進数数)までとした
場合についての定数を示す表であり、16進数表示にて
示されている。
As mentioned above, when the exponent part changes from -m to -1, m constant values are also required. That is, the above (11)
The constant ``,'' in the equation, and the constant 1/ obtained from equation (13) must be prepared in m pieces each.In conventional calculators, the constants are stored in advance in a constant ROM (Read
0nly 14emory) and is used for calculation processing of trigonometric functions. An example of the contents of the constant ROM for "k" in this case is shown in the table of FIG.
An example of the contents of the constant ROM in / is shown in FIG. However, this is a table showing constants when the calculation range of the mantissa part is from 32 to -1 (decimal number), and is shown in hexadecimal notation.

上記のC0RDICアルコリズムを用いる従来の三角関
数演算装置は、−例として第2図のように構成されてい
る。
A conventional trigonometric function calculation device using the above C0RDIC algorithm is configured as shown in FIG. 2, for example.

第2図に示されるように、本従来例は、指数部演算器1
4、定数ROM 15および16、加減算器I7および
20、レジスタ18および21、バレルレジスタ19、
スタック22および乗算器23を備えて構成されている
。以下、第2図を参照して、その動作につき説明する。
As shown in FIG. 2, in this conventional example, the exponent part calculator 1
4, constant ROM 15 and 16, adder/subtractor I7 and 20, registers 18 and 21, barrel register 19,
It is configured to include a stack 22 and a multiplier 23. The operation will be explained below with reference to FIG.

■ 2進数浮動小数点数で表現された θ=2−’ Xe  (1≦θ〈2、iは整数)の値を
、バス103から入力し、指数部iを指数部演算器14
に入力する。θの仮数部eは、レジスタ21に入力され
る。
■ Input the value of θ=2−'
Enter. The mantissa part e of θ is input to the register 21.

■ 指数部演算器14の出力値kを、 k=i、i+l、i+2、・−1m−1とインクリメン
トしながら下記の■に示される動作を反復実行する。
(2) While incrementing the output value k of the exponent part calculator 14 as follows: k=i, i+l, i+2, -1m-1, the operation shown in (2) below is repeatedly executed.

■ レジスタ21に格納されているYk値を、バス10
5を介して加減算器20の入力Aに転送し、同時に、指
数部演算器14において求められるアドレスにより選択
された定数Γkの定数ROM 16における値を、バス
104を介して加減算器20のBに転送する。また、同
時に、レジスタ21の符号桁の正負によって加減算器2
1の動作を制御し、その出力を左1桁シフトしてレジス
タ21に書込む。
■ Transfer the Yk value stored in register 21 to bus 10.
5 to the input A of the adder/subtractor 20, and at the same time, the value in the constant ROM 16 of the constant Γk selected by the address obtained in the exponent part calculator 14 is transferred to the input B of the adder/subtractor 20 via the bus 104. Forward. At the same time, depending on the sign digit of the register 21, the adder/subtractor 2
1 and shifts its output by one digit to the left and writes it into the register 21.

■ レジスタ21からバス104を介してv、、値を取
出し、レジスタ18と乗算器23に転送する。指数部演
算器14により求められるアドレスにより選択される定
数1/にの定数ROM 15における値を、バス104
を介して乗算器23に転送し、乗算器23において求め
られるVヨとL/にとの積V、/Kを、バス104を介
してレジスタ21に転送する。
(2) Take out the value v from the register 21 via the bus 104 and transfer it to the register 18 and multiplier 23. The value in the constant ROM 15 for the constant 1/ selected by the address obtained by the exponent calculator 14 is transferred to the bus 104.
The product V, /K of Vyo and L/ni obtained in the multiplier 23 is transferred to the register 21 via the bus 104.

■ 指数部演算器14の出力値kを。■ The output value k of the exponent part calculator 14.

k=m、m−1、m−2、−・・、i + 1とデクリ
メントしながら下記■の動作を反復実行する。
While decrementing k=m, m-1, m-2, -..., i + 1, the following operation (2) is repeatedly executed.

■ レジスタ21のXkの値を、バス105を介して加
減算器17の入力Cに転送し、同時に、レジスタ18の
Ykの値をバス104を介して加減算器17の入力りに
転送し、更に、同時に、バレルシフタ19において、レ
ジスタ18のYk暁を前述のkの2倍桁数だけ右シフト
して、加減算器20の入力Bに転送する1次に、スタッ
ク22からポツプされた値によって加減算器20を制御
し、その結果をレジスタ21に書込む。また同時に、ス
タック22からポツプされた値によって加減算器L7を
、vlmし、結果を左1桁シフトしてレジスタ21に書
込む。
■ Transfer the value of Xk of the register 21 to the input C of the adder/subtractor 17 via the bus 105, and at the same time transfer the value of Yk of the register 18 to the input of the adder/subtractor 17 via the bus 104; At the same time, in the barrel shifter 19, Yk in the register 18 is shifted to the right by twice the number of digits of the aforementioned k and transferred to the input B of the adder/subtracter 20. and writes the result to the register 21. At the same time, the value popped from the stack 22 causes the adder/subtractor L7 to vlm, and the result is shifted to the left by one digit and written into the register 21.

■ 以上の結果、レジスタ21においてはcosθの仮
数部が得られ、レジスタ18においてはsinθの仮数
部が得られる。
(2) As a result of the above, the register 21 obtains the mantissa part of cos θ, and the register 18 obtains the mantissa part of sin θ.

なお、上記の従来例については、下記の参考文献等が参
照される。
In addition, regarding the above-mentioned conventional example, the following references etc. are referred to.

*産業図書: 萩原 宏 著「マイクロプログラミング」特願昭62−
234195号 〔発明が解決しようとする課題〕 上述した従来の三角関数演算装置においては、三角関数
演算の結果を求めるために、定数「2の定数ROMと、
定数1/にの定数ROMとを余分に用意する必要がある
という欠点があり、また、最近においては、高精度の演
算を行う必要性が求められるため、下記のような問題点
が生じている。
*Industrial book: ``Microprogramming'' written by Hiroshi Hagiwara, patent application 1988-
No. 234195 [Problem to be Solved by the Invention] In the above-mentioned conventional trigonometric function calculation device, in order to obtain the result of trigonometric function calculation, a constant ROM of constant ``2'',
There is a drawback that it is necessary to prepare an extra constant ROM for the constant 1/, and recently there is a need to perform high-precision calculations, so the following problems have arisen. .

(1)浮動小数点演算において、仮数部の精度を上げる
ために使用桁数が増大してきている。従って、定数RO
Mの桁数も同様にして増大してきている。
(1) In floating point arithmetic, the number of digits used is increasing in order to improve the precision of the mantissa. Therefore, the constant RO
The number of digits of M is also increasing in the same way.

(2)関数の定義域を広くとるようにするために、演算
可能な指数部の範囲が広くなり、このために、用意すべ
き定数ROMの数を増加する必要がある。
(2) In order to widen the domain of the function, the range of exponents that can be operated on becomes wider, and therefore it is necessary to increase the number of constant ROMs to be prepared.

以上のような問題点に対応するために、従来は、ROM
の領域を大きくとることにより対処してきているが、そ
のために、ROMのハードウェアの量が増大し、当該計
算機ハードウェアの中に占める定数ROMの割合も増大
傾向にある。特にマイクロプロセッサにおいては、大量
の所要面積を定数ROMのために費やされるために、そ
の池の主要ハードウェアの実装に対する障害要因になる
という欠点がある。
In order to deal with the above problems, conventionally, ROM
However, as a result, the amount of ROM hardware increases, and the proportion of constant ROM in the computer hardware also tends to increase. Particularly in microprocessors, a disadvantage is that the large amount of area required for constant ROM is a hindrance to the implementation of the main hardware of the microprocessor.

〔課題を解決するための手段〕[Means to solve the problem]

本発明の三角関数演算装置は、三角関数sinθおよび
cosθを演算することを目的とする三角関数演算装置
において、前記演算装置内に含まれる指数部演算器の出
力値kを入力して、前記出力値kを予め定められている
所定の定数と比較照合する比較手段と、 関数r’、 =2’X arcjan(2−k)(但し
、k=0、1−、m−1: mは正整数)におけるΓk
の値を、k=oよりに=m−1至るまで逐次定数値とし
て生成する「、の定数発生手段と、 関数に=IT’″(1+2−2k )l/2(但し、k
 = O1L’、−・−m −1、mは正整数)におけ
る1/にの値を、k=oよりに=m−1に至るまで逐次
定数値として生成し、この1/にの定数値を、前記比較
手段における比較結果に応じて選択出力する1、/にの
定数発生手段と、前記Γkの定数発生手段のアドレスを
、前記比較手段における比較結果に応じて選択してイン
クリメントする第1の加算手段と、前記「kの定数発生
手段の出力内容のMSBに1を加算する処理を、前記比
較手段における比較結果に応じて選択実行する第2の加
算手段と、を備えて構成される。
The trigonometric function calculation device of the present invention is a trigonometric function calculation device whose purpose is to calculate trigonometric functions sin θ and cos θ. a comparison means for comparing and comparing the value k with a predetermined constant; and a function r', =2'X arcjan(2-k) (where k=0, 1-, m-1: m is positive). Γk at (integer)
, which sequentially generates the value of as a constant value from k=o until =m-1, and a function =IT'''(1+2-2k)l/2 (where k
= O1L', -・-m -1, m is a positive integer) is successively generated as a constant value until = m-1 by k=o, and the constant value of this 1/ is a constant generating means for selecting and outputting Γk according to the comparison result in the comparing means; and a second addition means that selectively executes the process of adding 1 to the MSB of the output content of the constant generation means for k according to the comparison result in the comparison means. .

〔実施例〕〔Example〕

次に、本発明について図面を参照して説明する。第1図
は、本発明の一実施例のブッロッ図である。第1図に示
されるように、本実施例は、指数部演算部lと、比較器
2と、定数ROM3および4と、加算器5および6と、
加減算器7および10と、レジスタ8および11と、バ
レルシフタ9と、スタック12と、乗算器13と、を備
えて構成される。
Next, the present invention will be explained with reference to the drawings. FIG. 1 is a block diagram of one embodiment of the present invention. As shown in FIG. 1, this embodiment includes an exponent calculation unit l, a comparator 2, constant ROMs 3 and 4, adders 5 and 6,
It is configured to include adder/subtractors 7 and 10, registers 8 and 11, barrel shifter 9, stack 12, and multiplier 13.

本実施例の動作を説明する前に、本発明の動作原理の大
要について説明する。第3図および第4図は、それぞれ
前述の従来例において、アルゴリズムを用いる時に使用
される、定数「kおよび定数17にの定数ROMの内容
を示す表である。この第3図および第4図を比較対照す
ることにより明らかなように、定数「、の定数ROM 
(第3図)におけるに=19の時の内容と、定数1/に
の定数ROMにおけるに=20の時の内容との差異は、
MSB (most 51gn1ficant bit
)が異なるだけである。同様に、kの値が増加していっ
た場合においても、全く同じことが云える。
Before explaining the operation of this embodiment, the outline of the operating principle of the present invention will be explained. 3 and 4 are tables showing the contents of the constant ROM for the constant "k" and the constant 17, respectively, which are used when using the algorithm in the conventional example described above. As is clear by comparing and contrasting the constant ROM of the constant ``,
The difference between the content when N = 19 in (Fig. 3) and the content when N = 20 in the constant ROM of constant 1/ is as follows.
MSB (most 51gn1ficant bit
) are different. Similarly, the same thing can be said even when the value of k increases.

従って、定数1/にの定数ROMの内容としては、l<
 = Qからに=18までを用意すればよいことが分る
。kが19以上になった場合には、そのkの値をインク
リメントしたに′に対応する定数Fk・の定数ROMの
内容のMSBに“1”を加算することにより、定数1/
Kを求めることが可能となる。
Therefore, the contents of the constant ROM for the constant 1/ are l<
It turns out that it is sufficient to prepare from =Q to =18. When k becomes 19 or more, by incrementing the value of k and adding "1" to the MSB of the constant ROM contents of the constant Fk corresponding to ', the constant 1/
It becomes possible to obtain K.

従って、本発明により、定数1/にの定数ROMの内容
を大幅に削減することが可能となり、定数ROMの規模
が縮小され、ROMハードウェア量も減少し、計算機ハ
ードウェア中に占める定数ROMの割合を低減させるこ
とができる。
Therefore, according to the present invention, it is possible to significantly reduce the content of the constant ROM in constant 1/, the scale of the constant ROM is reduced, the amount of ROM hardware is also reduced, and the constant ROM occupies less space in the computer hardware. The ratio can be reduced.

なお、第1図と第2図との比較により明らかなように、
本実施例においては、比較器2、加算器5および6が追
加されるが、実際においては、三角関数演算処理が可能
な計算機レベルにおいては、比較器および加算器等は、
他の目的用として具備されているため、それらのハード
ウェアを流用することが可能であり、現実にハードウェ
アを増加させる必要はない。
Furthermore, as is clear from the comparison between Figures 1 and 2,
In this embodiment, a comparator 2 and adders 5 and 6 are added, but in reality, at the computer level capable of trigonometric function processing, the comparator, adder, etc.
Since the hardware is provided for other purposes, it is possible to reuse the hardware, and there is no need to actually increase the hardware.

第1図において、レジスタ11および8は、2類類の変
数を格納するレジスタ、指数部演算器1は、指数部の演
算を行う演算器、比較器2は、指数部演算器1の演算結
果を見て、kが19以Eの数値か、または19未溝の数
値であるかを判定して、Γkの定数ROM4、または定
数17にノ定数ROM3の何れを選択するかを決める比
較器、加算器6は、比較器2における選択結果により、
定数「kの値のMSBに“1”を加算することが可能な
加算器、加算器5は、指数部演算器1より出力される定
数ROMのアドレスに対して、イクリメントすることが
可能な加算器、バレルシフタ9は、レジスタ8の内容を
指数部演算器1の処理内容により、右シフト可能なバレ
ルシフタ、定数ROM3は、前記(13)式における定
数1/K(k・0.l、・・・・・・18)を格納する
19語の定数ROM、定数ROM4は、前記(11)式
における定数「3を格納するm語の定数ROM、スタッ
ク12は、従来例同様に、数列 (a、l ’(Fir
sL−In、La5L−Out、方式により蓄積するこ
とかできるスタック、乗算器13は、バス101から乗
数および被乗数を入力し、それらの積をバス101に出
力することのできる乗算器である。バス101は、入出
力データおよび演算の中間結果を転送するためのバス、
バス102は、レジスタ11の値を転送するためのバス
であり、バス103は、指数部演算器1において求めら
れる定数ROMのアドレスを転送するバスである。
In FIG. 1, registers 11 and 8 are registers that store variables of class 2, exponent part arithmetic unit 1 is an arithmetic unit that performs exponent part arithmetic, and comparator 2 is the calculation result of exponent part arithmetic unit 1. A comparator that determines whether k is a value between 19 and E or a value that is not equal to 19, and selects either constant ROM4 for Γk or constant ROM3 for constant 17; The adder 6 uses the selection result in the comparator 2 to
Adder 5, which is an adder that can add "1" to the MSB of the value of constant "k," is an adder that can increment the constant ROM address output from exponent part calculator 1. The barrel shifter 9 is a barrel shifter that can shift the contents of the register 8 to the right according to the processing contents of the exponent part calculator 1, and the constant ROM 3 is a constant 1/K (k・0.l, . . . in equation (13)). . . . 18) The constant ROM 4 is a 19-word constant ROM that stores the constant "3" in the equation (11), and the stack 12 is a constant ROM of m words that stores the constant "3" in the formula (11). l'(Fir
The multiplier 13 is a multiplier that can input a multiplier and a multiplicand from the bus 101 and output their product to the bus 101. The bus 101 is a bus for transferring input/output data and intermediate results of operations;
The bus 102 is a bus for transferring the value of the register 11, and the bus 103 is a bus for transferring the address of the constant ROM determined by the exponent part calculator 1.

以下に、第1図を参照して、本実施例の動作につき説明
する。
The operation of this embodiment will be explained below with reference to FIG.

■ 2進数浮動小数点数で表現された θ=2−’ Xe  (1≦θ〈2、iは整数)の値を
、バス101から入力し、指数部iを指数部演算器1に
入力する。θの仮数部θは、レジスタ11に入力される
(2) A value of θ=2-' The mantissa part θ of θ is input to the register 11.

■ 指数部演算器1の出力値kを、 k=i、i+l、i+2、・・・、m、 −1とインク
リメントしながら下記の■に示される動作を反復実行す
る。
(2) While incrementing the output value k of the exponent part calculator 1 as follows: k=i, i+l, i+2, . . . , m, -1, the operation shown in (2) below is repeatedly executed.

■ レジスタ11に格納されているvk値を、バス10
2を介して加′g算器IOの人力Aに転送し、同時に、
指数部演算器1において求められる定数ROMのアドレ
スは加減算器5に入力されるが、加減算器5における加
算は行われず、そのままのアドレスを定数Γkの定数R
OM4に送出する。定数ROM4より出力された値は、
加算器6に転送されるが、ここにおいても加算は行われ
ず、バス101に転送される。また、同時に、レジスタ
11の符号桁の値をスタック12にブツシュする0次に
、レジスタ11の符号桁の正負によって加減算器IOの
動作を制御し、その出力を左1析シフトしてレジスタ1
1に書込む。
■ The vk value stored in register 11 is transferred to bus 10.
2 to the human power A of the adder IO, and at the same time,
The address of the constant ROM obtained in the exponent part calculator 1 is input to the adder/subtracter 5, but no addition is performed in the adder/subtracter 5, and the address as it is is input to the constant R of the constant Γk.
Send to OM4. The value output from constant ROM4 is
The data is transferred to the adder 6, but no addition is performed here either, and the data is transferred to the bus 101. At the same time, the value of the sign digit of the register 11 is pushed onto the stack 12.The operation of the adder/subtractor IO is controlled depending on the sign digit of the register 11, and its output is shifted to the left by 1 to the register 12.
Write to 1.

■ レジスタ11からバス101を介してV、値を取出
し、レジスタ8と乗算器13に転送する。
(2) Take out the value V from the register 11 via the bus 101 and transfer it to the register 8 and the multiplier 13;

■ 指数部演算器1より、比較器2に対して、指数部の
値により求められるkの値を転送し、そのkの値が19
未満であるか、または19以上であるかの判定を行う。
■ The value of k determined by the value of the exponent part is transferred from the exponent part calculator 1 to the comparator 2, and the value of k is 19.
It is determined whether it is less than 19 or 19 or more.

19未満である場合には、指数部演算器1より求められ
る定数ROMのアドレスを、バス103を介して直接定
数1/にの定数ROM3に送り、定数L/Kをバス10
1に転送する。
If it is less than 19, the address of the constant ROM obtained from the exponent part calculator 1 is directly sent to the constant ROM 3 of the constant 1/ via the bus 103, and the constant L/K is sent to the constant ROM 3 of the constant 1/K via the bus 103.
Transfer to 1.

19以上である場合には、指数部演算器1より求められ
る定数ROMのアドレスを加算器5においてインクリメ
ントして、定数Γkの定数ROM4に送出する9次に、
加算器6により定数「2の定数ROM4の出力値のMS
Bに“1”を加算し、バス101に転送する。
If it is 19 or more, the address of the constant ROM obtained from the exponent part calculator 1 is incremented in the adder 5 and sent to the constant ROM 4 of the constant Γk.
The adder 6 calculates the MS of the output value of the constant ROM 4 of constant ``2''.
“1” is added to B and transferred to the bus 101.

■ 上記■において、バス101に転送された定数を、
バス101を介して乗算器13に転送し、積V、、/に
の値をバス101を介してレジスタ11に転送する。
■ In above ■, the constant transferred to bus 101 is
The value of the product V, , / is transferred to the register 11 via the bus 101.

■ 指数部演算器1の出力値kを、 に=m、m −1、m−2、・・・、 i+1とデクリ
メントしながら下記■の動作を反復実行する。
(2) Repeat the operation (2) below while decrementing the output value k of the exponent calculator 1 as follows: = m, m -1, m-2, . . . , i+1.

■ レジスタ11のxkの値を、バス102を介して加
減算器7の入力Cに転送し、同時に、レジスタ8のYk
の値をバス101を介して加減算器7の入力りに転送し
、更に、同時に、バレルシフタ9において、レジスタ8
のYk値を前述のkの2倍桁数だけ右シフトし、て、加
減算器10の入力Bに転送する。次に、スタック12か
らポツプされた値によって加減算器10を制御し、その
結果をレジスタ11に書込む、また同時に、スタック1
2からポツプされた値によって加減算器7を制御し、結
果を左1桁シフトしてレジスタ8に書込む。
■ Transfer the value of xk in register 11 to input C of adder/subtractor 7 via bus 102, and at the same time transfer the value of xk in register 8 to input C of adder/subtractor 7.
is transferred to the input of the adder/subtractor 7 via the bus 101, and at the same time, in the barrel shifter 9, the value is transferred to the register 8.
The Yk value of is shifted to the right by twice the number of digits of the aforementioned k, and is transferred to the input B of the adder/subtractor 10. Next, the adder/subtractor 10 is controlled by the value popped from the stack 12, and the result is written to the register 11.
The adder/subtractor 7 is controlled by the value popped from 2, and the result is shifted to the left by one digit and written to the register 8.

■ 以上の結果、レジスタ11においてはcosθの仮
数部が、レジスタ8においてはsinθの仮数部が、そ
れぞれ同時に得られる。
(2) As a result of the above, the mantissa part of cos θ is obtained in the register 11, and the mantissa part of sin θ is obtained in the register 8 at the same time.

〔発明の効果〕〔Effect of the invention〕

以上、詳細に説明したように、本発明は、定数1/にの
定数ROMの使用領域を縮小させることができるため、
従来の三角関数演算装置に比較して、定数ROMのハー
ドウェア量を減少させ、計算機ハードウェア中に占める
定数ROMの割合を大幅に減少させることができるとい
う効果がある。特に、マイクロプロセッサにおいては、
定数ROMに占有される面積か縮退することにより、そ
の他のハードウェアの実装が容易になるという効果があ
る。
As described above in detail, the present invention can reduce the area used in the constant ROM by the constant 1/;
Compared to conventional trigonometric function calculation devices, the hardware amount of the constant ROM can be reduced, and the proportion of the constant ROM in the computer hardware can be significantly reduced. Especially in microprocessors,
By reducing the area occupied by the constant ROM, there is an effect that other hardware can be easily implemented.

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

第1図は、本発明の一実施例のブロック図、第2図は、
従来例のブロック図、第3図および第4図は、それぞれ
定数ROMの内容を表示する図である。 図において、1,14・−・・・・指数部演算器、2・
・・・・・・−・比較器、3.4.1.5.16・・・
・・・定数ROM、5.6・・・・−・加算器、7 、
10,17.20・・−・・加減算器、8、11.18
.21・・・−・・レジスタ、9,19・・・・・・バ
レルシフタ、12.22・・・・・・スタック、13.
23・−・・・・乗算器。
FIG. 1 is a block diagram of an embodiment of the present invention, and FIG. 2 is a block diagram of an embodiment of the present invention.
The block diagrams of the conventional example, FIG. 3 and FIG. 4, each show the contents of the constant ROM. In the figure, 1, 14... exponent part calculator, 2...
......-Comparator, 3.4.1.5.16...
...constant ROM, 5.6...--adder, 7,
10, 17.20... Adder/subtractor, 8, 11.18
.. 21...--Register, 9,19...Barrel shifter, 12.22...Stack, 13.
23.--Multiplier.

Claims (1)

【特許請求の範囲】 三角関数sinθおよびcosθを演算することを目的
とする三角関数演算装置において、 前記演算装置内に含まれる指数部演算器の出力値kを入
力して、前記出力値kを予め定められている所定の定数
と比較照合する比較手段と、関数Γ_k=2^k×ar
ctan(2^−^k)(但し、k=0、1・・・、m
−1:mは正整数)におけるΓ_kの値を、k=0より
k=m−1至るまで逐次定数値として生成するΓ_kの
定数発生手段と、 ▲数式、化学式、表等があります▼ (但し、k=0、1、・・・・・・m−1、mは正整数
)における1/Kの値を、k=0よりk=m−1に至る
まで逐次定数値として生成し、この1/kの定数値を、
前記比較手段における比較結果に応じて選択出力する1
/Kの定数発生手段と、 前記Γ_kの定数発生手段のアドレスを、前記比較手段
における比較結果に応じて選択してインクリメントする
第1の加算手段と、 前記Γ_kの定数発生手段の出力内容のMSBに1を加
算する処理を、前記比較手段における比較結果に応じて
選択実行する第2の加算手段と、を備えることを特徴と
する三角関数演算装置。
[Scope of Claims] A trigonometric function calculation device whose purpose is to calculate trigonometric functions sin θ and cos θ, wherein an output value k of an exponent part calculation unit included in the calculation device is input, and the output value k is calculated. Comparison means for comparison with a predetermined constant, and function Γ_k=2^k×ar
ctan (2^-^k) (where k=0, 1..., m
-1: m is a positive integer) is used to generate the value of Γ_k as a constant value sequentially from k=0 to k=m-1, and ▲Mathematical formulas, chemical formulas, tables, etc.▼ (However, , k=0, 1,...m-1, where m is a positive integer) is successively generated as a constant value from k=0 to k=m-1, and this The constant value of 1/k is
1 for selectively outputting according to the comparison result in the comparison means;
/K constant generation means; first addition means for selecting and incrementing the address of the Γ_k constant generation means according to the comparison result in the comparison means; and MSB of the output content of the Γ_k constant generation means. A trigonometric function calculation device comprising: second addition means for selectively executing a process of adding 1 to , depending on a comparison result in the comparison means.
JP2233073A 1990-09-03 1990-09-03 Trigonometric function operation unit Expired - Lifetime JP2546916B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2233073A JP2546916B2 (en) 1990-09-03 1990-09-03 Trigonometric function operation unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2233073A JP2546916B2 (en) 1990-09-03 1990-09-03 Trigonometric function operation unit

Publications (2)

Publication Number Publication Date
JPH04112320A true JPH04112320A (en) 1992-04-14
JP2546916B2 JP2546916B2 (en) 1996-10-23

Family

ID=16949381

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2233073A Expired - Lifetime JP2546916B2 (en) 1990-09-03 1990-09-03 Trigonometric function operation unit

Country Status (1)

Country Link
JP (1) JP2546916B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01109428A (en) * 1987-10-22 1989-04-26 Canon Inc Trigonometric function arithmetic unit
JPH02153412A (en) * 1988-12-05 1990-06-13 Nec Corp Inverse trigonometric function arithmetic unit

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01109428A (en) * 1987-10-22 1989-04-26 Canon Inc Trigonometric function arithmetic unit
JPH02153412A (en) * 1988-12-05 1990-06-13 Nec Corp Inverse trigonometric function arithmetic unit

Also Published As

Publication number Publication date
JP2546916B2 (en) 1996-10-23

Similar Documents

Publication Publication Date Title
TW434507B (en) High accuracy estimates of elementary functions
JP2557190B2 (en) Optimization system for argument reduction
WO1990005335A1 (en) Apparatus for multiplication, division and extraction of square root
JPH0454633A (en) High radix divider
US4956799A (en) Trigonometric function arithmetic processor using pseudo-division
Linhardt et al. Digit-by-digit transcendental-function computation
JP2504102B2 (en) Inverse trigonometric function calculator
US7406589B2 (en) Processor having efficient function estimate instructions
US5260889A (en) Computation of sticky-bit in parallel with partial products in a floating point multiplier unit
JP2822399B2 (en) Logarithmic function arithmetic unit
JPH0477932B2 (en)
JP2508784B2 (en) Exponential function calculator
JPH0628155A (en) Method and apparatus for division
Collins Computing multiplicative inverses in 𝐺𝐹 (𝑝)
EP0632369A1 (en) CORDIC algorithms and architectures
JPH04112320A (en) Trigonometrical function arithmetic device
Schulte et al. High-speed reciprocal approximations
Lee et al. SVD by constant-factor-redundant-CORDIC.
Vikasini et al. 16-bit Modified Vedic Paravartya Divider with quotient in fractions
Choudhary et al. Comparative Analysis of Two Hardware-Based Square Root Computational Algorithms
JPH086766A (en) Sine and cosine arithmetic device
Czyżak et al. FPGA realization of an improved alpha max plus beta min algorithm
EP0137525B1 (en) Arithmetic unit in data processing system with bit-extension circuitry
Wires et al. Reciprocal and reciprocal square root units with operand modification and multiplication
JP2512801B2 (en) Multiplier