CN208834289U - A kind of trigonometric computing circuit - Google Patents
A kind of trigonometric computing circuit Download PDFInfo
- Publication number
- CN208834289U CN208834289U CN201821267758.1U CN201821267758U CN208834289U CN 208834289 U CN208834289 U CN 208834289U CN 201821267758 U CN201821267758 U CN 201821267758U CN 208834289 U CN208834289 U CN 208834289U
- Authority
- CN
- China
- Prior art keywords
- result
- module
- selector
- sign bit
- operand
- 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.)
- Withdrawn - After Issue
Links
Landscapes
- Complex Calculations (AREA)
Abstract
The utility model discloses a kind of trigonometric computing circuit, in the trigonometric computing circuit, preprocessing module (101) is connected with DDR module (100), interative computation module (103) is connect with preprocessing module (101), under the driving of the counting umber of beats of iteration count module (102), meet position according to the operation result that the pre-processed results of operand one of preprocessing module (101) output and the pre-processed results of operand two determine in advance, the operand of input exports the input next time as the same level in the current of the same level to form feedback arrangement in same level-one iteration, the trigonometric function result of complement code processing is exported after completing 16 interative computations.Compared with the prior art, computing circuit disclosed by the utility model saves the software instruction resource of processor, and guarantees that operational precision is constant under the premise of circuit scale is constant.
Description
Technical field
The utility model relates to integrated circuit fields, are related to a kind of trigonometric computing circuit.
Background technique
In computer software instructions, when being related to the calculating of trigonometric function, software generally requires to call special three
Then angle function library runs tens up to a hundred and instructs the calculating that could complete a trigonometric function, efficiency is extremely low.Moreover,
With the increase of function precision, the complexity of calculating is also to rise in geometric progression.Therefore, the instruction of trigonometric function is often
Time-consuming more part in software instruction.And by the calculating of trigonometric function using hardware circuit come soft for saving by the way of completing
Part instruction tool has great advantage, and does not need to expend excessive software instruction.So completing triangle letter using hardware circuit technology
Several calculating is trend of the times.
The cordic algorithm of traditional pipeline organization, processing speed is very fast, each clock week after assembly line fills up
Phase will calculate one group as a result, realizing that high rate bioreactor provides premise for data.It is although the structure substantially increases
System arithmetic speed, but circuit scale is larger, while the precision of operation result is limited by pipeline series, Yao Tigao operation essence
Degree must increase flowing water series, further increase hardware spending.
Utility model content
It is a kind of sinusoidal based on the commonplace trigonometric function used of 3 classes that in order to solve the above problems, the utility model proposes
(sin), cosine (cos), the hardware implementation method that arc tangent (arctan) calculates, correspondingly with a kind of calculation method of fixed-point number
Calculation process is carried out to these three types of trigonometric functions.
A kind of trigonometric computing circuit, including preprocessing module 101, iteration count module 102, DDR module 100 and repeatedly
For computing module 103;Preprocessing module 101 is connected with DDR module 100, for the counting bat in iteration count module 102
Under several drivings, according to type accordingly input operand one and the operand two, and combination DDR module for calculating trigonometric function
Constant needed for the 100 calculating trigonometric functions provided is respectively modified operand one and operand two, so that the triangle
The sign bit of the operation result of functional operation circuit is determined in advance;Interative computation module 103 connects with preprocessing module 101
It connects, the operand two for being exported in conjunction with preprocessing module 101 under the driving of the counting umber of beats of iteration count module 102
The operand zero of pre-processed results, pre-processed results and input to operand one is extended the level-one CORDIC of sign bit
Algorithm iteration operation, so that next time input of the current output of the same level as the same level is to form feedback arrangement in same level-one iteration
And the outcome symbol position currently exported of the same level remains unchanged, finally use sign bit determined by preprocessing module 101 as
The sign bit of the different type trigonometric function calculated result of 103 parallel output of interative computation module;DDR module 100 is transported with iteration
Calculate module 103 be connected, for iteration count module 102 counting umber of beats driving under, by i rotation angle, θ of storagei
With calculate trigonometric function needed for constant be sent to interative computation module 103, and connect by bus interface with processor, make its
Processor receives the output of interative computation module 103 as a result, wherein θ after receiving the interrupt signal that interative computation module 103 issuesi
=tan-1(2-i), i=0,1,2,3 ... n-1;Iteration count module 102, for by counting umber of beats signal and preprocessing module
101, interative computation module 103 and DDR module 100 establish a connection, and believe so that interative computation module 103 is counted in each bat
Number driving under every level-one interative computation completed according to the signal that preprocessing module 101 and DDR module 100 input;Wherein, it operates
Number zero, operand one and operand two are all that processor issues, and operand zero and operand one are all binary fixed point numbers, behaviour
It counts second is that the binary fixed point number indicated with arc pattern.
Further, operand zero, operand one and operand two all indicate fixed-point number using 32 bits, and
Its decimal point is fixed on the 21st.
As the utility model embodiment one, when the type that processor configures calculating trigonometric function according to user instructions is positive
When string function and cosine function, preprocessing module 101 is angle pretreatment module 200, for by providing with ddr mode 100
The symbol for calculating the sine function of radian value corresponding to constant multilevel iudge input operand two needed for trigonometric function
The sign bit of position and cosine function value, while according to triangulate decomposition method relationship by arc range corresponding to input operand two
It is adapted in [0, pi/2] range;Angle pretreatment module 200 includes the second shift unit 202, the first shift unit 201, divider
203, multiplier 204, symbol selector 208, plus and minus calculation devices 205, the first subtracter 206, the second subtracter 207 and third subtract
Musical instruments used in a Buddhist or Taoist mass 209;Wherein, the first shift unit 201,2 π of constant needed for the calculating trigonometric function for providing ddr mode 100 are corresponding
The fixed-point number toward moving to left 21, and the result data moved to left is exported to divider 203 and multiplier 204;Second displacement
Device 202 is connected with divider 203, for the result data moved to left toward moving to left 21, and to be exported to the operand two of input
To divider 203;Divider 203, while the first shift unit 201 and the second shift unit 202 are connected, it is used for the first shift unit
201 output data and the output data of the second shift unit 202 make binary division operation, and division result is exported to multiplication
Device 204;Multiplier 204, while connecting the first shift unit 201 and divider 203, for the highest order in operand two be 1 or
When operand two is greater than 2 π of the constant corresponding fixed-point number, by the defeated of the output result of divider 203 and the first shift unit 201
Data are multiplied out, and multiplied result is exported to plus and minus calculation devices 205;Plus and minus calculation devices 205 are connected with multiplier 204, use
Control operand two and multiplier 204 export result and carry out add operation when the highest order in operand two is 1, in operand
Control operand two and multiplier 204 are defeated when two highest order is 0 and operand two is greater than 2 π of the constant corresponding fixed-point number
Result carries out subtraction out, so that the two modified corresponding arc range of institute of operand is [0,2 π];First subtracter 206 and
Three subtracters 209, the correction result for being exported according to plus and minus calculation devices 205 executes subtraction, when plus and minus calculation devices 205 are defeated
Correction result out correspond to arc range be [π, 2 π] when, the correction result of plus and minus calculation devices 205 is exported to the first subtracter 206
And it subtracts operation with the corresponding fixed-point number of constant π that ddr mode 100 provides;When the amendment that plus and minus calculation devices 205 export
As a result correspond to arc range be [pi/2, π] when, the correction result of plus and minus calculation devices 205 export to third subtracter 209 and and DDR
The corresponding fixed-point number of constant π that mode 100 provides subtracts operation;Second subtracter 207, for according to the first subtracter
The correction result of 206 outputs executes subtraction operation, be when the correction result of the first subtracter 206 output corresponds to arc range [π/
When 2, π], the correction result of the first subtracter 206 output fixed-point number corresponding with the constant pi/2 that ddr mode 100 provides is made
Subtraction operation, so that it is [0, pi/2] that the correction result of the second subtracter 207 output, which corresponds to arc range,;Symbol selector 208,
For receive can determine simultaneously operand two SIN function sign bit and operand two cosine function sign bit correspondence
Arc range signal, and the transformation relation based on trigonometric function selects corresponding sign bit as the trigonometric function operation
The sign bit of circuit computing result, and export the sign bit signal and cosine of the sine function of the corresponding radian value of operand two
The sign bit signal of functional value, wherein the trigonometric computing circuit operation result includes the corresponding radian value of operand two
Sine function and cosine function value.
Further, interative computation module 103 is sine and cosine interative computation module 300, sine and cosine interative computation module 300
Including the feedback arrangement, which includes X selector 301, Y selector 302, X register 303, y register 304, Z
Selector 316, Z register 317, angle symbol selector 315, Y dextroposition device 305, X dextroposition device 306, cosine plus and minus calculation
Device 307, sinusoidal plus and minus calculation devices 308, arc tangent adder-subtractor 320, X sign bit expander 321 and Y sign bit expander 322;
X sign bit expander 321, for by the sign bit of operand zero and each time cosine plus and minus calculation devices 307 in interative computation
The sign bit repeat replication of result is exported to create the operational data with escape character position, to avoid number during interative computation
According to type change;Y sign bit expander 322, for sine to be added and subtracted by the sign bit of operand one and each time in interative computation
The sign bit repeat replication of the output result of arithmetic unit 308 is to create the operational data with escape character position, to avoid iteration
Data type changes in calculating process;Angle symbol selector 315, the first count for being provided according to iteration count module 102,
The i-stage of the signal entry angle symbol selector 315 of the sign bit for the correction result that selected angle preprocessing module 200 exports
Input terminal in successive iterations operation, as the umber of beats that iteration count module 102 provides is incremented by, selects the i+1 of Z selector 316
The sign bit signal of the data of grade input terminal is as 308 operation class of determining cosine plus and minus calculation devices 307 and sinusoidal plus and minus calculation devices
The judgement signal of type;Z selector 316, the first count for being provided according to iteration count module 102, selected angle pre-process mould
The correction result that block 200 exports enters the i-stage input terminal of Z selector 316, then correction result is stored in Z register 317;Instead
Two operation input terminals of tangent adder-subtractor 320 arc tangent letter with the output end of Z register 317, DDR module 100 respectively
Number output end is connected, and the umber of beats for being provided according to iteration count module 102, DDR module 100 provides corresponding with the umber of beats
Rotation angle, θi, while determining that Z register 317 currently exports according to the sign bit result that angle symbol selector 315 exports
The rotation angle, θ that data and DDR module 100 provideiArithmetic type, and operation result is exported to Z selector 316
I+1 grade input terminal, as the umber of beats that iteration count module 102 provides is incremented by, Z selector 316 is by arc tangent adder-subtractor 320
Enter i+1 grade input terminal in the output result selection that upper one claps, is completed and rotation angle, θ as the input data currently clappedi
Signed magnitude arithmetic(al), wherein θi=tan-1(2-i), i=0,1,2,3 ... n-1;X selector 301, for according to iteration count mould
The first count that block 102 provides, selection operation number zero enter the i-stage input terminal of X selector 301, then export to X symbol Bits Expanding
Device 321 carries out the extension of sign bit, and spreading result is stored in X register 303;The input terminal connection Y deposit of Y dextroposition device 305
Device 304, two operation input terminals of cosine plus and minus calculation devices 307 respectively with the output end of X register 303 and Y dextroposition device 305
Output end be connected, the signal of the sign bit result for being exported according to angle symbol selector 315 determines X register 303
Arithmetic type performed by the shift result that current output data and Y dextroposition device 305 currently export, and operation result is exported
To the i+1 grade input terminal of X selector 301, as the umber of beats that iteration count module 102 provides is incremented by, X selector 301 will be remaining
The output result selection that string plus and minus calculation devices 307 are clapped upper one enters i+1 grade input terminal and is exported again to X sign bit expander
The extension of 321 progress sign bits, the displacement plus and minus calculation after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped,
In, mobile digit of the Y dextroposition device 305 in i-th iteration operation be i, corresponding to iteration count module 102 provide i-th+
1 claps count signal, i=0,1,2,3 ... n-1;Each time in interative computation X sign bit expander 321 obtain have escape character
The operational data bit wide of number position is equal;Y selector 302, the first count for being provided according to iteration count module 102, selection behaviour
Count one enter Y selector 302 i-stage input terminal, then export to Y sign bit expander 322 carry out sign bit extension, will
Spreading result is stored in y register 304;The input terminal of X dextroposition device 306 connects X register 303, sinusoidal plus and minus calculation devices 308
Two operation input terminals are connected with the output end of the output end of y register 304 and X dextroposition device 306 respectively, for according to angle
The signal for spending the sign bit result that symbol selector 315 exports, determines the current output data of y register 304 and X dextroposition device
Arithmetic type performed by 306 shift results currently exported, and it is defeated that operation result exported the i+1 grade to Y selector 302
Enter end, as the umber of beats that iteration count module 102 provides is incremented by, Y selector 302 is by sinusoidal plus and minus calculation devices 308 in upper-bat
Output result selection enters i+1 grade input terminal and exports to Y sign bit expander 322 extension for carrying out sign bit again, as working as
The input data of preceding bat participates in the displacement plus and minus calculation after above-mentioned symbol Bits Expanding, wherein X dextroposition device 306 is in i-th iteration
Mobile digit when operation is i, and the i+1 provided corresponding to iteration count module 102 claps count signal, i=0,1,2,3 ...
n-1;The operational data bit wide with escape character position that Y sign bit expander 322 obtains in interative computation each time is identical;Its
In, operand zero is set as a constant, and operand one is set as 0.
Further, sine and cosine interative computation module 300 further includes X negative processor 309, X result selector 310, X knot
Fruit register 311, Y negative processor 312, Y result selector 313, Y result register 314, X outlet selector 318 and Y are defeated
Selector 319 out;The output end of one selection input terminal connection cosine plus and minus calculation devices 307 of X outlet selector 318, X output
Another selection input terminal of selector 318 is hanging, and the selection end of X outlet selector 318 connects iteration count module 102, uses
Output is selected in output result of the preset umber of beats exported according to iteration count module 102 to cosine plus and minus calculation devices 307;X is negative
The input terminal of number processor 309 is connected with the output end of X outlet selector 318, two selections input of X result selector 310
End is connect with the output end of the output end of X negative processor 309 and cosine plus and minus calculation devices 307 respectively, for according to its selection
The letter of the sign bit of the cosine function value for the corresponding radian value of operand two for holding received angle pretreatment module 200 to export
Number, select the complement data of the output result of X outlet selector 318 to export to X result register 311;Wherein X result register
Cosine function value of the numerical value stored in 311 as the trigonometric computing circuit under preset umber of beats;Y outlet selector
A 319 selection input terminal connects the output end of sinusoidal plus and minus calculation devices 308, another selection of Y outlet selector 319 is defeated
Enter end vacantly, the selection end of Y outlet selector 319 connects iteration count module 102, for defeated according to iteration count module 102
Preset umber of beats out selects output to the output result of sinusoidal plus and minus calculation devices 308;The input terminal and Y of Y negative processor 312 are defeated
The output end of selector 319 is connected out, two selection input terminals of Y result selector 313 respectively with Y negative processor 312
Output end connected with the output end of Y outlet selector 319, for according to its select the received angle pretreatment module 200 in end
The signal of the sign bit of the sine function of the corresponding radian value of operand two of output selects the output of Y outlet selector 319
As a result complement data is exported to Y result register 314;The numerical value wherein stored in Y result register 314 is as the triangle
Sine function of the functional operation circuit under preset umber of beats.
Further, the interative computation number of sine and cosine interative computation module 300 is set as 16, i.e. i=16;Corresponding institute
Stating preset umber of beats is 16;The operational data bit wide with escape character position is 48 bits;X register 303 and y register
304 bit wide is both configured to 48 bits;The bit wide of Z register 317 is set as 32 bits;Iteration count module 102 is one
A 5 counters, the metronome as the trigonometric computing circuit.
As the utility model embodiment two, when the type that processor configures calculating trigonometric function according to user instructions is anti-
When tangent function, preprocessing module 101 is positive and negative preprocessing module 400, including Y0 negative processor 401 and Y0 result selector
402, wherein and one of Y0 result selector 402 selection input terminal is connected with the input terminal of Y0 negative processor 401, be used for
Receive operand one;Another selection input terminal of Y0 result selector 402 is connected with the output end of Y0 negative processor 401
Connect, for according to its select the received operand one in end sign bit determined by numerical symbol signal, to operand one into
The processing of row complement code, and the signal of numerical symbol determined by the sign bit of operand one is exported to interative computation module 103.
Further, interative computation module 103 is arc tangent interative computation module 403, arc tangent interative computation module 403
The feedback arrangement that next time inputs of the current output as the same level including described the same level, which includes X selector
301, Y selector 302, X register 303, y register 304, Z selector 316, Z register 317, X sign bit expander 321, Y
Sign bit expander 322, Y symbol selector 408, Y dextroposition device 305, X dextroposition device 306, cosine plus and minus calculation devices 307, just
String plus and minus calculation devices 308 and arc tangent adder-subtractor 320;X sign bit expander 321, for by the sign bit of operand zero and
Each time in interative computation the sign bit repeat replication of the output result of cosine plus and minus calculation devices 307 to create with escape character
The operational data of position avoids data type during interative computation from changing;Y sign bit expander 322 is used for positive and negative pretreatment
The sign bit for the pre-processed results that module 400 exports and each time in interative computation sinusoidal plus and minus calculation devices 308 output result
Sign bit repeat replication to create the operational data with escape character position, avoid data type during interative computation from changing
Become;Z selector 316, the first count for being provided according to iteration count module 102, selection operation number two enter Z selector 316
I-stage input terminal, be restored again into Z register 317;Two operation input terminals of arc tangent adder-subtractor 320 respectively with Z register
317 output end, the arctan function output end of DDR module are connected, for the umber of beats according to iteration count module 102, DDR
Module 100 provides rotation angle, θ corresponding with the umber of beatsi, while the sign bit result exported according to Y symbol selector 408
Determine the current output data of Z register 317 and the rotation angle, θiArithmetic type, and by operation result export to Z select
The i+1 grade input terminal of device 316, as the umber of beats that iteration count module 102 provides is incremented by, Z selector 316 adds and subtracts arc tangent
The output result selection that musical instruments used in a Buddhist or Taoist mass 320 is clapped upper one enters i+1 grade input terminal, completes and rotation as the input data currently clapped
Angle, θiOperation, wherein θi=tan-1(2-i), i=0,1,2,3 ... n-1;X selector 301, for according to iteration count mould
The first count that block 102 provides, selection operation number zero enter the i-stage input terminal of X selector 301, then export to X symbol Bits Expanding
Device 321 carries out the extension of sign bit, and spreading result is stored in X register 303;The input terminal connection Y deposit of Y dextroposition device 305
Device 304, two operation input terminals of cosine plus and minus calculation devices 307 respectively with the output end of X register 303 and Y dextroposition device 305
Output end be connected, the signal of the sign bit result for being exported according to Y symbol selector 408 determines that X register 303 is worked as
Arithmetic type performed by the shift result that preceding output data and Y dextroposition device 305 currently export, and by operation result export to
The i+1 grade input terminal of X selector 301, as the umber of beats that iteration count module 102 provides is incremented by, X selector 301 is by cosine
The output result selection that plus and minus calculation devices 307 are clapped upper one enters i+1 grade input terminal and is exported again to X sign bit expander 321
Carry out the extension of sign bit, the displacement plus and minus calculation after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped, wherein
Mobile digit of the Y dextroposition device 305 in i-th iteration operation is i, and the i+1 provided corresponding to iteration count module 102 is clapped
Count signal, i=0,1,2,3 ... n-1;Each time in interative computation X sign bit expander 321 obtain have escape character
The operational data bit wide of position is equal;Y selector 302, the first count for being provided according to iteration count module 102 select positive and negative
The pre-processed results that preprocessing module 400 exports enter the i-stage input terminal of Y selector 302, then export to Y symbol Bits Expanding
Device 322 carries out the extension of sign bit, and spreading result is stored in y register 304;The input terminal connection X deposit of X dextroposition device 306
Device 303, two operation input terminals of sinusoidal plus and minus calculation devices 308 respectively with the output end of y register 304 and X dextroposition device 306
Output end be connected, the signal of the sign bit result for being exported according to Y symbol selector 408 determines that y register 304 is worked as
Arithmetic type performed by the shift result that preceding output data and X dextroposition device 306 currently export, and by operation result export to
The i+1 grade input terminal of Y selector 302, as the umber of beats that iteration count module 102 provides is incremented by, Y selector 302 will be sinusoidal
The output result selection that plus and minus calculation devices 308 are clapped upper one enters i+1 grade input terminal, then exports to Y sign bit expander 322
Carry out the extension of sign bit, the displacement plus and minus calculation after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped, wherein
Mobile digit of the X dextroposition device 306 in i-th iteration operation is i, and the i+1 provided corresponding to iteration count module 102 is clapped
Count signal, i=0,1,2,3 ... n-1;Each time in interative computation Y sign bit expander 322 obtain have escape character
The operational data bit wide of position is identical;Y symbol selector 408, the first count for being provided according to iteration count module 102, selection
The signal of the sign bit for the pre-processed results that positive and negative preprocessing module 400 exports enters the i-stage input of Y symbol selector 408
It holds, it is corresponding to select the i-th of Y selector 302 as the umber of beats that iteration count module 102 provides is incremented by successive iterations operation
The signal of the sign bit of the data of+1 grade of input terminal is as determining cosine plus and minus calculation devices 307, sinusoidal plus and minus calculation devices 308 and anti-
The judgement signal of 320 arithmetic type of tangent adder-subtractor;Wherein, operand zero is set as a constant, and operand two is set as
0。
Further, arc tangent interative computation module 403 further includes Z negative processor 404, Z result selector 405, Z knot
Fruit register 406 and Z outlet selector 407;One selection input terminal of Z outlet selector 407 connects arc tangent adder-subtractor
Another selection input terminal of 320 output end, Z outlet selector 407 is hanging, and the selection end connection of Z outlet selector 407 changes
Output of the preset umber of beats to arc tangent adder-subtractor 320 for counting module 102, for being exported according to iteration count module 102
As a result selection output;The input terminal of Z negative processor 404 is connected with the output end of Z outlet selector 407, Z result selector
405 two selection input terminals are connect with the output end of the output end of Z negative processor 320 and Z outlet selector 407 respectively,
For selecting the letter of the received positive and negative output of preprocessing module 400 numerical symbol based on determined by operand one in end according to it
Number, select the respective handling data of the output result of Z outlet selector 407 to export to Z result register 406;Wherein Z result is posted
Arc tangent function value of the numerical value stored in storage 406 as the trigonometric computing circuit under preset umber of beats.
Further, the interative computation number of arc tangent interative computation module 403 is set as 16, i.e. i=16;Corresponding institute
Stating preset umber of beats is 16;The operational data bit wide with escape character position is 48 bits;X register 303 and y register
304 bit wide is both configured to 48 bits;The counter that iteration count module 102 is one 5 is transported as the trigonometric function
Calculate the metronome of circuit.
Compared with prior art, the calculating of three classes trigonometric function is completed by hardware circuit, and processor only needs to fill in calculating
Object and taking-up calculated result, and the outcome symbol position that preprocessing module determines trigonometric function in advance is set, save the software of CPU
Resource consumption can greatly save CPU bandwidth, reduce time-consuming;It is described provided by the utility model embodiment one and embodiment two
Trigonometric computing circuit, which is used, carries out symbol Bits Expanding to the fixed-point number of interative computation each time, so that displacement calculates each time
When data symbol invariant position, prevent the loss of operational precision, save hardware spending.
Detailed description of the invention
Fig. 1 is to mention the utility model embodiment (being divided into embodiment one and embodiment two according to the trigonometric function type of calculating)
A kind of block schematic illustration of the trigonometric computing circuit supplied;
Fig. 2 is the angle pretreatment module schematic diagram of internal structure that the utility model embodiment one provides;
Fig. 3 is the sine and cosine interative computation inside modules electrical block diagram that the utility model embodiment one provides;
Fig. 4 is the arc tangent interative computation inside modules circuit diagram that the utility model embodiment two provides.
Specific embodiment
Specific embodiment of the present utility model is described further with reference to the accompanying drawing:
The circuit design of the utility model embodiment is based primarily upon the hardware realization of cordic algorithm.Cordic algorithm is one
The iterative algorithm that kind of linear convergence and sequence execute at least needs n times iteration to N precision, the secondary iteration of i+1 is only the
It could be executed after the completion of i iteration.Cordic algorithm can be difficult to be decomposed into unification with hard-wired complex calculation by a variety of
Simple shift, add operation, then Approach by inchmeal result.Cordic algorithm can apply polling system, linear system and
Hyperbolic systems, each system are divided into rotary mode and vector pattern again.Since trigonometric function belongs to polling system, below
Application mainly for CORDIC under polling system is illustrated.
A kind of module frame of trigonometric computing circuit is as shown in Figure 1, the trigonometric computing circuit includes pretreatment
Module 101, iteration count module 102, DDR module 100 and interative computation module 103.
Preprocessing module 101 is connected with DDR module 100, the drive for the counting umber of beats in iteration count module 102
Under dynamic, according to the type of the calculating trigonometric function of processor configuration accordingly two Z00 of one Y00 of input operand and operand, and
Constant pi/2, π or 2 π needed for the calculating trigonometric function provided in conjunction with DDR module 100 are respectively to one Y00 of operand and operand
Two Z00 are modified, including corresponding arc range limits and sign bit amendment, so that the fortune of the trigonometric computing circuit
The sign bit for calculating result is determined in advance, and meets the precision of operation result;
Interative computation module 103 is connect with preprocessing module 101, for the counting umber of beats in iteration count module 102
Under driving, in conjunction with the pre-processed results for two Z00 of operand that preprocessing module 101 exports, to the pretreatment knot of one Y00 of operand
Zero X0 of operand of fruit and input is extended the level-one cordic algorithm interative computation of sign bit, passes through the current defeated of the same level
It realizes as the feedback arrangement inputted of the same level next time in same level-one iteration, is finally determined using preprocessing module 101 out
SIN function, cosine function or arctan function different type of the sign bit as 103 parallel output of interative computation module
The sign bit of trigonometric function calculated result;Because the trigonometric computing circuit, which is based on cordic algorithm, to be handled simultaneously just
The operation of string function and cosine function.
DDR module 100 is connected with interative computation module 103, for the counting umber of beats in iteration count module 102
Under driving, by i rotation angle, θ of storageiInterative computation module is sent to constant pi/2, π or 2 π needed for calculating trigonometric function
103, and connect by bus interface with processor, so that it is received the interrupt signal that interative computation module 103 issues in processor
The output of interative computation module 103 is received afterwards as a result, wherein θi=tan-1(2-i), i=0,1,2,3 ... n-1, i.e. interative computation
In the process, it is sent to the rotation angle, θ of interative computation module 103 next timei+1It is the rotation for being currently sent to interative computation module 103
Angle, θiHalf, it is every carry out one count take rotation angle tangent value must be made to be approximately equal to 1/ (2^i), current umber of beats
For i+1.The purpose is to allow the Y-axis under polling system to approach and 0.Then the angle rotated every time is added up to get rotation is arrived
Angle and find out corresponding arc-tangent value.In the utility model embodiment, the rotation angle, θiIt is fixed using 32 binary systems
Points, the maximum value ATAN_MAX=32 ' h4DBA7073 of corresponding arc-tangent value, the minimum value ATAN_MIN of arc tangent
=32 ' hB2458F8D.Wherein n takes 15, then the rotation angle, θiCorrespond to 15 arc tangent constant values;θ025 degree of selection,
Corresponding 32 fixed-point numbers are 32 ' h001921FB, then according to the rotation angle, θi=tan-1(2-i) (i=0,1,2,3 ...
15) changing rule can release corresponding 32 fixed-point numbers of 15 arc tangent constant values.
Iteration count module 102, for by count umber of beats signal and preprocessing module 101, interative computation module 103 and
DDR module 100 establishes a connection, so that interative computation module 103 is under each driving for clapping count signal according to pretreatment
The signal that module 101 and DDR module 100 input completes every level-one interative computation.The trigonometric computing circuit internal logic
16 specific angles are rotated by the method for iteration, so that the angle and infinite approach presetting angle of accumulative rotation, and calculate
As a result meet the station accuracy that precision reaches setting.Therefore, it is iterated to calculate 16 times to meet.Starting to calculate trigonometric function
When, one 5 counters are defined, the metronome calculated as trigonometric function.Iteration count module 102 is one 5
Counter, the metronome as the trigonometric computing circuit.
Specifically, zero X0 of operand, one Y00 of operand and two Z00 of operand are that processor issues, zero X0 of operand
It is all binary fixed point number with one Y00 of operand, two Z00 of operand is the binary fixed point number indicated with arc pattern.Fixed point
Number is actually to carry out fractional arithmetic with integer.Zero X0 of operand, one Y00 of operand and two Z00 of operand use 32
Bit indicates fixed-point number, and its decimal point is fixed on the 21st.It works in the trigonometric computing circuit
When be in operation in the form of complement code, the complement code of positive number is itself, and the complement code of negative will negate plus 1, the fixed point of signed number
Operation is also required to carry out complement code processing.Mould refers to the count range of a metering system simultaneously, indicates n computer metering models
Enclosing is 0~2^ (n) -1, mould=2^ (n), and since the fixed point configuration of the input operand of the utility model embodiment is at 21, therefore
Fixed-point number for the calculating in circuit is 2^21 times of user's actual disposition data.It should be noted that a variable to
It can indicate bigger numberical range, it is necessary to sacrifice precision as cost;And think that precision improves, then several expression ranges is with regard to phase
Reduce with answering.In order to reach optimal operational precision, the fixed point configuration of the utility model embodiment input operand is at 21, into one
Step limits numberical range represented by input operand.
Specifically, CORDIC iterative equation is expressed as follows under polling system:
xi+1=xi-Siyi·2-i,
yi+1=yi+Sixi·2-i, i=0,1,2 ... N-1,
zi+1=zi-Si·tan-1(2-i),
Wherein, xi、yiFor the x of vector under planar circumferential system, y-coordinate, zi+1Residue does not rotate after indicating i-th rotation
Angle, tan-1(2-i) can find out in advance.By above-mentioned iterative formula, cordic algorithm is thin by primary big predetermined angle θ
Turn to the small rotation angle, θ of n timesiThe sum of (i=0,1,2,3 ... n-1), wherein θi=tan-1(2-i).If always towards a side
To rotation, then according to the sum of rotation angleIt is bound to be more than predetermined angle θ.Therefore it needs to small rotation angle, θiSetting one
A direction value Si.When the sum of rotation anglePredetermined angle θ is had been above, then direction value SiIt is -1, indicates to rotate to be next time suitable
Hour hands, i.e., it is close to predetermined angle θ;When the sum of rotation angleAlready less than predetermined angle θ, then direction value SiIt is+1, then
The available angle value θ rotated every timeiSi, then the remaining angle z not rotated after i-th rotatesi+1=zi-θiSi.According to upper
Direction value S in formulaiInterpretation mode, cordic algorithm is divided into rotary mode and vector pattern, and rotary mode is used to solve just remaining
String functional value, vector pattern are used to solve arc tangent function value, and corresponding the utility model embodiment is according to solution trigonometric function
Type be divided into embodiment one and embodiment two, rotary mode corresponds to the utility model embodiment one, and vector pattern corresponds to this reality
With new embodiment two.
Under rotary mode, initial rotation angle z0For predetermined angle θ, by n times iteration, number i constantly increases, the
The remaining angle z not rotated after n-1 rotationi+1It will level off to 0, at this point,
And had by the derivation process of cordic algorithm:
xn=P [x0·cos z0-y0·sin z0],
yn=P [y0·cos z0+x0·sin z0],
zn→ 0,
If taking x0=1/P, y0=0, then have
xn=P [x0·cos z0-y0·sin z0]=cos θ,
yn=P [y0·cos z0+x0·sin z0]=sin θ,
It can be seen that the rotary mode of cordic algorithm can calculate the sine and cosine of an input angle.WhereinLevel off to constant, P is known as correction factor, xn、ynFor postrotational vectorial coordinate, x0、y0Before rotation
Initial vector coordinate.It can be seen that the rotary mode of cordic algorithm can calculate the sine and cosine of an input angle.
Correspondingly, processor configures the class for calculating trigonometric function according to user instructions in the utility model embodiment one
Type is SIN function and cosine function, and zero X0 of operand of the trigonometric computing circuit corresponds to the initial vector before rotation
Abscissa x0, the ordinate y of the initial vector before the corresponding rotation of one Y00 of operand0, two Z00 of operand corresponds to initial rotation angle
z0.The trigonometric computing circuit internal logic rotates 16 specific angles by the method for iteration, so that accumulative rotation
Angle and infinite approach presetting angle, and calculated result meets precision and reaches the station accuracy of setting, wherein rotating every time
Angle is θi=tan-1(2-i), i=0,1,2,3 ..., 15.The utility model embodiment one indicates fixed using 32 bits
Points, scaling position are scheduled on the 21st.Therefore, input radian numerical value must also be indicated using this fixed-point number.Wherein, have
Some normal parameters are also indicated with the fixed-point number of this format.For example π is expressed as 32 ' h006487ED with 32 fixed numbers, 2 π are with 32
Position fixed-point number is expressed as 32 ' h00C90FDB, and pi/2 is expressed as 32 ' h003243F6 with 32 fixed-point numbers;Two Z00 of operand is with arc
Degree indicates 32 binary fixed point numbers, and corresponding decimal system input data range is [- 1023.9999 ,+1023.9999], defeated
Corresponding metric calculated result range out is [- 1,1];Sinusoidal and cosine input data is most worth for 32 ' h80000000
(corresponding ± 1024).Correspondingly, the output calculated result of trigonometric computing circuit described in the utility model embodiment one
Precision is respectively that the precision of SIN function is ± 0.000037, and the precision of cosine function is ± 0.000036.
In the utility model embodiment one, as shown in Fig. 2, preprocessing module 101 is angle pretreatment module 200, it is used for
It is compared by constant pi/2, π or 2 π needed for the calculating trigonometric function that is provided with ddr mode 100, to judge input behaviour
Count radian value corresponding to two Z00 sine function sign bit and cosine function value sign bit, while according to triangle
Arc range corresponding to two Z00 of input operand is adapted in [0, pi/2] range by functional transformation relationship;Angle pre-processes mould
Block 200 includes the second shift unit 202, the first shift unit 201, divider 203, multiplier 204, symbol selector 208, plus-minus fortune
Calculate device 205, the first subtracter 206, the second subtracter 207 and third subtracter 209;Wherein, the first shift unit 201, being used for will
The corresponding fixed-point number of 2 π of constant needed for the calculatings trigonometric function that ddr mode 100 provides is past moves to left 21, and will move to left
Result data is exported to divider 203 and multiplier 204;Second shift unit 202, is connected with divider 203, for that will input
Two Z00 of operand toward moving to left 21, and the result data moved to left is exported to divider 203;When calculating sinusoidal and cosine,
Since two Z00 of operand of input is pinpointed at 21, and hardware circuit only supports integer arithmetic.So, it is necessary first to by decimal
Become integer, i.e., two Z00 of operand is moved to left 21, decimal point is displaced to last below.Similarly, this constant of 2 π
Need to move to left 21, decimal place is also lost, to become integer.Since two Z00 of operand is 32, by the second shift unit
202 move to left after become one 53 binary numbers.
As shown in Fig. 2, divider 203 connects the first shift unit 201 and the second shift unit 202 simultaneously, for moving first
The output data of position device 201 and the output data of the second shift unit 202, which move to left to subtract each other, realizes binary division operation, obtains 53
Integral divide result M, and division result is exported to multiplier 204;Multiplier 204, while connecting 201 He of the first shift unit
Divider 203 is that 1 or two Z00 of operand is greater than the corresponding fixed-point number of 2 π of constant for the highest order in two Z00 of operand
When, by each step-by-step of the output result of divider 203 and the output data of the first shift unit 201 product corresponding with generation
Position, then moves to left addition and obtains multiplied result, and 2 π M of multiplied result is exported to plus and minus calculation devices 205.
As shown in Fig. 2, plus and minus calculation devices 205, are connected with multiplier 204, for the highest order in two Z00 of operand
When bit [31] is 1, i.e. when Z00 < 0, control two Z00 of operand and multiplier 204 export 2 π M of result and carry out add operation, obtain
To correction result Z01=Z00+2 π M, to become positive number, and its corresponding amendment arc range is between [0,2 π].It is operating
When the highest order bit [31] of several two Z00 is that 0 and two Z00 of operand is greater than 2 π of the constant corresponding fixed-point number, i.e. 2 π of Z00 >
When, control two Z00 of operand and multiplier 204 export result and carry out subtraction, obtain correction result Z01=Z00-2 π M, make
Obtaining the modified corresponding arc ranges of two Z00 of operand institute is [0,2 π];This treatment process spends the one of iteration count module 102
A beat.After the processing of this beat, data are all between [0,2 π].But sinusoidal and cosine calculated value is at this
It is also inconsistent within the scope of input value, it is also necessary to determine the sign bit of calculated result.
As shown in Fig. 2, the first subtracter 206 and third subtracter 209, are repaired for what is exported according to plus and minus calculation devices 205
Positive result Z01 executes subtraction, when it is [π, 2 π] that the correction result Z01 that plus and minus calculation devices 205 export, which corresponds to arc range,
The calculated result of the sine of the trigonometric computing circuit and cosine is all then set to negative value, sign bit 1;Fortune is added and subtracted simultaneously
The correction result Z01 for calculating device 205 is exported to the first subtracter 206, the fixed point corresponding with the constant π that ddr mode 100 provides
Number subtracts operations, obtains correction result Z02=Z01- π so that correction result Z02 correspond to arc range be reduced into [0,
π], sinusoidal sign bit is it has been determined that still the sign bit of cosine also needs to confirm again once.Then the second subtracter 207 is used
Subtraction operation is executed in the correction result Z02 exported according to the first subtracter 206, when the amendment knot of the first subtracter 206 output
Fruit correspond to arc range be [pi/2, π] when, the first subtracter 206 output correction result Z02 provided with ddr mode 100 it is normal
The corresponding fixed-point number of number pi/2 subtracts operation, obtains correction result Z03 and correspond to arc range being reduced into [0, pi/2], so that
It is [0, pi/2] that the correction result of second subtracter 207 output, which corresponds to arc range,;The above process spends iteration count module again
102 two beats.
As shown in Fig. 2, when it is [pi/2, π] that the correction result Z01 that plus and minus calculation devices 205 export, which corresponds to arc range, then
The sinusoidal calculations result of the trigonometric computing circuit is positive, and sign bit 0, cosine calculated result is negative, sign bit 1.
Cosine calculated value should be modified to positive value at this time, by character position be 0, then the correction result Z01 of plus and minus calculation devices 205 export to
Third subtracter 209 subtracts operation with the corresponding fixed-point number of constant π that ddr mode 100 provides, obtains correction result
Z03=π-Z01, so that correction result Z03, which corresponds to arc range, is reduced into [0, pi/2], cosine calculated value, which is corrected, to be positive
Value, sign bit is set to 0, to complete makeover process.The above process spends a beat of iteration count module 102 again.
As shown in Fig. 2, symbol selector 208, for receiving the SIN function symbol that can determine two Z00 of operand simultaneously
The signal of the corresponding arc range of the cosine function sign bit of position and operand two, the arc range correspond respectively to determine
[π, 2 π] that sin cos functions sign bit is 1, determine that SIN function sign bit is 0 and [pi/2, π] that cosine function sign bit is 1
[0, pi/2] for being 0 with determining sin cos functions sign bit.The transformation relation for being then based on trigonometric function selects corresponding sign bit
As the sign bit of the trigonometric computing circuit operation result, and export the SIN function of the corresponding radian value of operand two
The sign bit signal sign (Y) of the value and sign bit signal sign (X) of cosine function value, wherein the trigonometric computing circuit
Operation result includes the sine function and cosine function value of the corresponding radian value of two Z00 of operand.
As a kind of mode of the utility model embodiment one, processor configures according to user instructions calculates trigonometric function
Type is SIN function and cosine function, as shown in figure 3, after the completion of angle pretreatment module 200 pre-processes input operand,
Initially enter calculation stages.In next beat, zero X0 of operand passes through X sign bit expander 321 for former 32 behaviour
It counts, to create 48 fixed-point numbers with escape character position highest order continuous replication for 16 times of zero X0.When the operand of input
When zero X0 is constant K, symbol Bits Expanding can be carried out by X sign bit expander 321, the initial results calculated as cosine;Phase
Introduce 48 bits X register 303 with answering is stored to avoid there is precision loss, wherein the numerical value before constant K extension
For 32 ' h00136E9D;The pretreated correction result Y0 of one Y00 of operand is assigned to as sinusoidal calculations initial value for 0 to operate simultaneously
Several Y00, by highest order continuous replication 16 of former 32 zero X0 of operand, have by Y sign bit expander 322 to create
There are 48 fixed-point numbers of escape character position.The corresponding y register 304 for introducing 48 bits, keeps in sine in an iterative process
Calculated result.The utility model embodiment also provides the Z register 317 of 32 bits, keeps in arctan function in iteration mistake
Calculated result in journey.
As shown in figure 3, interative computation module 103 is sine and cosine interative computation module 300, sine and cosine interative computation module
300 include the feedback arrangement that next time inputs of the current output of described the same level as the same level, which includes X selector
301, Y selector 302, X register 303, y register 304, Z selector 316, Z register 317, angle symbol selector 315,
Y dextroposition device 305, X dextroposition device 306, cosine plus and minus calculation devices 307, sinusoidal plus and minus calculation devices 308 and arc tangent adder-subtractor
320。
X sign bit expander 321, for cosine plus-minus to be transported by the sign bit of zero X0 of operand and each time in interative computation
Calculate device 307 output result sign bit repeat replication to create the operational data with escape character position, repeat replication
Number is equal with the number of interative computation to be changed to avoid data type during interative computation;Y sign bit expander 322 is used
In by the sign bit of one Y00 of operand and each time in interative computation the output result of sinusoidal plus and minus calculation devices 308 sign bit
Repeat replication to create the operational data with escape character position, the number of repeat replication and the number of interative computation it is equal with
Data type during interative computation is avoided to change.
As shown in figure 3, angle symbol selector 315, the first count for being provided according to iteration count module 102, selection
Signal sign (Z0) the entry angle symbol selector 315 of the sign bit for the correction result that angle pretreatment module 200 exports
I-stage input terminal sign (Zi), it is corresponding to select as the umber of beats that iteration count module 102 provides is incremented by successive iterations operation
Select the signal entry angle symbol selector of the sign bit of the data of the i+1 grade input terminal sign (Zi+1) of Z selector 316
315, so that the signal of the i+1 grade input terminal sign (Zi+1) of Z selector 316 is as determining 307 He of cosine plus and minus calculation devices
The judgement signal of sinusoidal 308 arithmetic type of plus and minus calculation devices.
Z selector 316, the first count for being provided according to iteration count module 102, selected angle preprocessing module 200
The correction result of output enters the i-stage input terminal Zi of Z selector 316, is restored again into Z register 317;Arc tangent adder-subtractor
320 two operation input terminals are connected with the arctan function output end of the output end of Z register 317, DDR module 100 respectively
It connects, the umber of beats for being provided according to iteration count module 102, DDR module 100 provides rotation angle corresponding with the umber of beats
θi;After entering calculation stages, under i-th of beat that iteration count module 102 provides, if angle symbol selector 315 is defeated
The highest order of Z register 317 corresponding to sign bit result out is 0, and the current output data of Z register 317 subtracts DDR module
The 100 rotation angle, θs providedi, and operation result is exported to the i+1 grade input terminal Zi+1 of Z selector 316;If angle
The highest order of Z register 317 corresponding to the sign bit result that symbol selector 315 exports is 1, and Z register 317 currently exports
Data add the rotation angle, θ that DDR module 100 providesi, and operation result is exported to the i+1 grade input of Z selector 316
Hold Zi+1;As the umber of beats that iteration count module 102 provides is incremented by, Z selector 316 is by arc tangent adder-subtractor 320 upper one
The output result selection of bat enters i+1 grade input terminal, completes and rotation angle, θ as the input data currently clappediPlus-minus
Operation, wherein θi=tan-1(2-i), i=0,1,2,3 ... 15, i.e., the sign bit knot exported according to angle symbol selector 315
Fruit, 317 storing data of Z register in each beat successively plus or minus DDR module 100 provide 16 arc-tangent values,
To obtain new value, calculated value is stored in Z register 317 when as next beat.
As shown in figure 3, X selector 301, the first count for being provided according to iteration count module 102, selection operation number zero
X0 enters the i-stage input terminal Xi of X selector 301, then exports to X sign bit expander 321 extension for carrying out sign bit, will expand
It opens up result and is stored in X register 303;The input terminal connection y register 304 of Y dextroposition device 305, the two of cosine plus and minus calculation devices 307
A operation input terminal is connected with the output end of the output end of X register 303 and Y dextroposition device 305 respectively.When angle symbol selects
The sign bit result for selecting the output of device 315 is 0, i.e., will when the value of 317 store data inside highest order of Z register is 0 under current beat
The current output data of X register 303 subtracts the shift result that Y dextroposition device 305 currently exports, that is, corresponding to when cosine calculates will work as
Preceding sine value moves to right, then subtracts the sine value after moving to right with current cosine value, then exports operation result to X selector
301 i+1 grade input terminal Xi+1, then export to X sign bit expander 321, by operation knot in X sign bit expander 321
Then spreading result is stored back into X register 303 to extension bits by the sign bit continuous replication of fruit, update cosine function value.Work as angle
Spending the sign bit result that symbol selector 315 exports is 1, i.e., the value of 317 store data inside highest order of Z register under current beat
When being 1, the current output data of X register 303 is added into the shift result that Y dextroposition device 305 currently exports, that is, corresponds to cosine meter
Current sinusoidal value is moved to right when calculation, then adds the sine value after moving to right with current cosine value, then exports operation result
It to the i+1 grade input terminal Xi+1 of X selector 301, then exports to X sign bit expander 321, in X sign bit expander 321
By the sign bit continuous replication of operation result to extension bits, spreading result is then stored back into X register 303, updates cosine letter
Numerical value, the bit wide phase of data bit width and X register 303 that wherein operation result extends in X sign bit expander 321
Match.As the umber of beats that iteration count module 102 provides is incremented by, X selector 301 claps cosine plus and minus calculation devices 307 upper one
It exports result selection and enters i+1 grade input terminal Xi+1, then export to X sign bit expander 321 extension for carrying out sign bit, make
Input data currently to clap participates in the displacement plus and minus calculation after above-mentioned symbol Bits Expanding, wherein Y dextroposition device 305 is in i-th
Mobile digit when interative computation is i, and the i+1 provided corresponding to iteration count module 102 claps count signal, i=0,1,2,
3 ... 15;That is first beat moves to right 0, and last sine value is moved to right 1, so analogized by second beat.But it is each
The operational data bit wide with escape character position that X sign bit expander 321 obtains in secondary interative computation is equal.
As shown in figure 3, Y selector 302, the first count for being provided according to iteration count module 102, selection operation number one
Y00 enters the i-stage input terminal Yi of Y selector 302, then exports to Y sign bit expander 322 extension for carrying out sign bit, will
Spreading result is stored in y register 304;The input terminal of X dextroposition device 306 connects X register 303, sinusoidal plus and minus calculation devices 308
Two operation input terminals are connected with the output end of the output end of y register 304 and X dextroposition device 306 respectively.When angle symbol
The sign bit result that selector 315 exports is 0, i.e., when the value of 317 store data inside highest order of Z register is 0 under current beat,
The shift result that X dextroposition device 306 currently exports is added to the current output data of y register 304, that is, it will when corresponding to sinusoidal calculations
Current cosine value moves to right, then is added with current sine value, and it is defeated that operation result is then exported the i+1 grade to Y selector 302
Enter and hold Yi+1, then exports to Y sign bit expander 322, it is in Y sign bit expander 322 that the sign bit of operation result is continuous
Extension bits are copied to, spreading result is then stored back into y register 304, update sine function.When angle symbol selector
The sign bit result of 315 outputs is 1, i.e., when the value of 317 store data inside highest order of Z register is 1 under current beat, posts Y
The current output data of storage 304 subtracts the shift result that X dextroposition device 306 currently exports, that is, will be current when corresponding to sinusoidal calculations
Cosine value moves to right, then subtracts each other with current sine value, then exports operation result to the i+1 grade input terminal of Y selector 302
Yi+1, then export to Y sign bit expander 322, by the sign bit continuous replication of operation result in Y sign bit expander 322
To extension bits, spreading result is then stored back into y register 304, updates sine function.Wherein, operation result is in Y sign bit
The bit wide of the data bit width extended in expander 322 and y register 304 matches.As iteration count module 102 provides
Umber of beats be incremented by, Y selector 302 by sinusoidal plus and minus calculation devices 308 it is upper one clap output result selection enter i+1 grade input
Yi+1 is held, then exports to Y sign bit expander 322 extension for carrying out sign bit, is participated in as the input data currently clapped above-mentioned
Displacement plus and minus calculation after symbol Bits Expanding, wherein mobile digit of the X dextroposition device 306 in i-th iteration operation is i, right
Should in iteration count module 102 provide i+1 clap count signal, i=0,1,2,3 ... 15;I.e. first beat moves to right 0,
Last cosine value is moved to right 1 by second beat, is so analogized.But X sign bit expander 321 in interative computation each time
The obtained operational data bit wide with escape character position is equal.
Particularly, X register 303, y register 304 and Z register 317 are all reusable registers, and X register
303 storages synchronous with the realization of y register 304, so that the trigonometric computing circuit parallel output SIN function result and remaining
String function result.
As a kind of mode of the utility model embodiment one, as shown in figure 3, sine and cosine interative computation module 300 is also wrapped
Include X negative processor 309, X result selector 310, X result register 311, Y negative processor 312, Y result selector 313,
Y result register 314, X outlet selector 318 and Y outlet selector 319.
The output end of one selection input terminal connection cosine plus and minus calculation devices 307 of X outlet selector 318, X output selection
Another selection input terminal of device 318 is hanging, and the selection end of X outlet selector 318 connects iteration count module 102, is used for root
The preset umber of beats exported according to iteration count module 102 carries out complement code to the output result selection output of cosine plus and minus calculation devices 307
Processing;Preset umber of beats is the 16th bat in the utility model embodiment one.After the completion of the calculating of 16 beats, symbol is no longer carried out
The extension of position;In the 17th beat, according to the sign bit signal sign (X) of sinusoidal sign bit signal sign (Y) and cosine to 16
The calculated result of bat is handled.Wherein described sinusoidal and cosine sign bit when handling input operand just
It determines.
The input terminal of X negative processor 309 is connected with the output end of X outlet selector 318, and the two of X result selector 310
A selection input terminal is connect with the output end of the output end of X negative processor 309 and cosine plus and minus calculation devices 307 respectively, is used for
According to the cosine function value of its corresponding radian value of two Z00 of operand for selecting the received angle pretreatment module 200 in end to export
Sign bit signal sign (X), select the complement data of output result of X outlet selector 318 to export to X result register
311, when the sign bit of the cosine function value of the corresponding radian value of two Z00 of operand is 1, in the selection control of its signal sign (X)
Under system, the output data of X outlet selector 318 negate by X negative processor 309 plus an operation, then will be selected defeated
Out to X result register 311, when the sign bit of the cosine function value of the corresponding radian value of two Z00 of operand is 0, in its signal
Under the selection control of sign (X), the output data of X outlet selector 318 is selected to be directly output to X result register 311;Its
The numerical value stored in middle X result register 311 is passed through as the sine and cosine interative computation module 300 of the trigonometric computing circuit
Cross 16 cosine function values counted after clapping.
One selection input terminal of Y outlet selector 319 connects the output end of sinusoidal plus and minus calculation devices 308, Y output selection
Another selection input terminal of device 319 is hanging, and the selection end of Y outlet selector 319 connects iteration count module 102, is used for root
The preset umber of beats exported according to iteration count module 102 carries out complement code to the output result selection output of sinusoidal plus and minus calculation devices 308
Processing;Preset umber of beats is the 17th bat in the utility model embodiment one, i.e., after the completion of the calculating of 16 beats, saves at the 17th
It claps, calculated result is handled according to sinusoidal and cosine sign bit.Sinusoidal and cosine sign bit is to input operand
It is just had determined when being handled.
The input terminal of Y negative processor 312 is connected with the output end of Y outlet selector 319, Y result selector 313
Two selection input terminals are connect with the output end of the output end of Y negative processor 312 and Y outlet selector 319 respectively, are used for root
The sine function for the corresponding radian value of two Z00 of operand that received angle pretreatment module 200 exports according to its selection end
The signal sign (Y) of sign bit selects the complement data of the output result of Y outlet selector 319 to export to Y result register
314, when the sign bit of the sine function of the corresponding radian value of two Z00 of operand is 1, in its control to induction signal sign (Y)
Under system, the output data of Y outlet selector 319 negate by Y negative processor 312 plus an operation, then will be selected defeated
Out to Y result register 314, when the sign bit of the sine function of the corresponding radian value of two Z00 of operand is 0, in its correspondence
Under the control of signal sign (Y), the output data of Y outlet selector 319 is selected to be directly output to Y result register 314;Its
The numerical value stored in middle Y result register 314 is passed through as the sine and cosine interative computation module 300 of the trigonometric computing circuit
It crosses after 16 countings are clapped and obtains sine function.The numerical value one of trigonometric computing circuit described in the utility model embodiment one
Rule is indicated and is stored with complement code.The reason is that sign bit and Numerical Range can be uniformly processed using complement code;Addition and subtract simultaneously
Method can also be uniformly processed.In addition, complement code and true form are mutually converted, calculating process be it is identical, do not need additional hardware
Circuit.
Under vector pattern, if initial rotation angle z0=0, after n times rotate, so that postrotational vectorial coordinate yn
=0, had by the derivation process of cordic algorithm:
yn=0,
zn=z0+tan-1(y0/x0),
Work as x0When=1, zn=tan-1(y0).It can be seen that the rotary mode of cordic algorithm can calculate an input
The arc tangent function value of angle.WhereinLevel off to constant, P is known as correction factor, xn、ynIt is postrotational
Vectorial coordinate, x0、y0For the initial vector coordinate before rotation.
Correspondingly, the type that two processor of the utility model embodiment configures calculating trigonometric function according to user instructions is anti-
Tangent function function, the abscissa x of the initial vector before the corresponding rotation of zero X0 of operand of the trigonometric computing circuit0,
The ordinate y of initial vector before the corresponding rotation of one Y00 of operand0, two Z00 of operand corresponds to initial rotation angle z0.Simultaneously
DDR module calculates resulting 16 arc-tangent values input after π radian is divided equally 16 equal parts under the control instruction effect of processor
The trigonometric computing circuit, wherein 16 arc-tangent values are respectively θi=tan-1(2-i), i=0,1,2,3 ..., 15.This reality
Fixed-point number is indicated using 32 bits with new embodiment two, scaling position is scheduled on the 21st.Therefore, radian is inputted
Numerical value must also be indicated using this fixed-point number.Wherein, some normal parameters are also indicated with the fixed-point number of this format.Than
If π is expressed as 32 ' h006487ED with 32 fixed numbers, 2 π are expressed as 32 ' h00C90FDB with 32 fixed-point numbers, and pi/2 is fixed with 32
Points are expressed as 32 ' h003243F6;One Y00 of operand is 32 binary fixed point numbers, and the maximum value of input fixed-point number is
32 ' h4DBA7073 (corresponding+621.823853), 32 ' hB2458F8D of minimum value (corresponding -621.823853), i.e., it is corresponding
Decimal system input data range is [- 621.823853 ,+621.823853], the corresponding metric calculated result arc of output
Spending range isScaling position of the utility model embodiment two by reality to the decimal data of operation is scheduled on 32
The 21st of position input signal, therefore decimal data of the input signal of the trigonometric computing circuit based on reality to operation
All amplify 2^21 times, trigonometric computing circuit described in the utility model embodiment two export calculated result precision for ±
0.000034, to avoid floating-point operation and maintain the precision of operation result constant.
In the utility model embodiment two, it is arc tangent that processor, which configures calculate the type of trigonometric function according to user instructions,
When function, as shown in figure 4, preprocessing module 101 is positive and negative preprocessing module 400, including Y0 negative processor 401 and Y0 result
Selector 402, wherein the one of Y0 result selector 402 selects input terminal to be connected with the input terminal of Y0 negative processor 401,
For receiving one Y00 of operand to carry out selection pretreatment by its sign bit;Another selection of Y0 result selector 402 is defeated
Enter end to be connected with the output end of Y0 negative processor 401, for selecting the received one Y00 highest order of operand in end according to it
The signal sign (Y00) of numerical symbol determined by bit [31], determines the pretreatment mode of one Y00 of operand, when operand one
Y00 highest order bit [31] is 1, and one Y00 of operand indicates negative, then according to the instruction of signal sign (Y00), one Y00 of operand
Negate in Y0 negative processor 401 plus one operate, then the pre-processed results of Y0 negative processor 401 are selected into output,
When one Y00 highest order bit [31] of operand is 0, one Y00 of operand indicates positive number, then one Y00 of operand is directly defeated by selection
Out.Positive and negative preprocessing module 400 is handled by the complement code that the above method completes one Y00 of operand.
As a kind of mode of the utility model embodiment two, trigonometric function is calculated when processor configures according to user instructions
Type be arctan function when, by one Y00 of input operand processing after the completion of, into calculation stages.It is same herein to introduce one
A 5 counters, i.e. iteration count module 102, the metronome calculated as trigonometric function.Meanwhile also introducing 2 48
X register 303 and y register 304.After the completion of data processing, before starting function and calculating, the highest order of zero X0 of operand is led to
321 repeat replication of X sign bit expander 16 times are crossed, i.e. zero X0 escape character position of operand is to 48, so that input value is combined
At one 48 binary numerals;When zero X0 of operand of input is corrected parameter FIX, X sign bit expander can be passed through
321 carry out symbol Bits Expanding, wherein the corrected parameter FIX before extension is 32 fixed-point numbers of 32 ' h00200000.It simultaneously will just
The correction result that negative preprocessing module 400 is handled has 48 fixed points of escape character position by the creation of Y sign bit expander 322
Number.Meanwhile two Z00 of operand is assigned to an initial value 0.Subsequently into the calculating process of 16 beats.
As shown in figure 4, interative computation module 103 is arc tangent interative computation module 403, arc tangent interative computation module
403 include the feedback arrangement that next time inputs of the current output of described the same level as the same level, which includes X selector
301, Y selector 302, X register 303, y register 304, Z selector 316, Z register 317, Y symbol selector 408, Y are right
Shift unit 305, X dextroposition device 306, cosine plus and minus calculation devices 307, sinusoidal plus and minus calculation devices 308 and arc tangent adder-subtractor
320;X sign bit expander 321, for by the sign bit of zero X0 of operand and cosine plus and minus calculation devices in interative computation each time
The sign bit repeat replication of 307 output result is to create the operational data with escape character position, the number of repeat replication
It is equal with the number of interative computation to change to avoid data type during interative computation;Y sign bit expander 322, being used for will
The sign bit of the correction result of positive and negative preprocessing module 400 and each time in interative computation sinusoidal plus and minus calculation devices 308 output
As a result sign bit repeat replication is to create the operational data with escape character position, the number and interative computation of repeat replication
Number equal change to avoid data type during interative computation.
Z selector 316, the first count for being provided according to iteration count module 102, several two Z00 of selection operation enter Z choosing
The i-stage input terminal Zi for selecting device 316, is restored again into Z register 317;Two operation input terminals of arc tangent adder-subtractor 320 are distinguished
It is connected with the arctan function output end of the output end of Z register 317, DDR module, for according to iteration count module 102
The umber of beats of offer, DDR module 100 provide rotation angle, θ corresponding with the umber of beatsi, while it is defeated according to Y symbol selector 408
Sign bit result out is by the current output data of Z register 317 and the rotation angle, θiMake corresponding arithmetic type.Into meter
Under i-th of beat for calculating arctan function, when 304 store data inside of y register is greater than 0, Z register 317 is currently exported into number
According to the rotation angle, θiMake add operation, i.e., the arctan function calculated value currently exported with Z register 317 is according to iteration
The beat number of counting module 102 successively adds 16 arc tangent constant values, and operation result is exported to the i-th of Z selector 316
+ 1 grade of input terminal, as the umber of beats that iteration count module 102 provides is incremented by, Z selector 316 exists arc tangent adder-subtractor 320
The upper one output result selection clapped enters i+1 grade input terminal, completes and rotation angle, θ as the input data currently clappedi's
Operation, wherein θi=tan-1(2-i), i=0,1,2,3 ... 15;That is the 1st beat adds the 1st arc tangent with current function value
The corresponding rotation angle, θ of constant value0, the 2nd beat, with the 1st beat calculate functional value plus the 2nd arc tangent it is normal
The corresponding rotation angle, θ of numerical value1, and so on, when the 16th beat, the functional value that is calculated with the 15th beat is plus the
The corresponding rotation angle, θ of 16 arc tangent constant values15.Into under i-th of beat for calculating arctan function, y register
When 304 store data insides are less than or equal to 0, by the current output data of Z register 317 and the rotation angle, θiSubtract fortune
It calculates, i.e., the arctan function calculated value currently exported with Z register 317 successively subtracts according to the beat number of iteration count module 102
16 arc tangent constant values are removed, and operation result is exported to the i+1 grade input terminal of Z selector 316, Z is then stored back to and posts
Storage 317 updates the arc tangent function value in Z register 317.As the umber of beats that iteration count module 102 provides is incremented by, Z choosing
It selects device 316 and the output result selection that arc tangent adder-subtractor 320 is clapped upper one is entered into i+1 grade input terminal, clapped as current
Input data complete with rotation angle, θiOperation, wherein θi=tan-1(2-i), i=0,1,2,3 ... 15;I.e. the 1st section
It claps, subtracts the corresponding rotation angle, θ of the 1st arc tangent constant value with current function value0, the 2nd beat, with the 1st section
It claps the functional value calculated and subtracts the corresponding rotation angle, θ of the 2nd arc tangent constant value1, and so on, the 16th beat
When, the corresponding rotation angle, θ of the 16th arc tangent constant value is subtracted with the functional value that the 15th beat calculates15。
As shown in figure 4, X selector 301, the first count for being provided according to iteration count module 102, selection operation number zero
X0 enters the i-stage input terminal Xi of X selector 301, then exports to X sign bit expander 321 extension for carrying out sign bit, will expand
It opens up result and is stored in X register 303;The input terminal connection y register 304 of Y dextroposition device 305, the two of cosine plus and minus calculation devices 307
A operation input terminal is connected with the output end of the output end of X register 303 and Y dextroposition device 305 respectively.When Y symbol selects
When the sign bit result that device 408 exports is 0, the current output data of X register 303 is currently exported plus Y dextroposition device 305
Then shift result exports operation result to the i+1 grade input terminal Xi+1 of X selector 301, then export to X sign bit and expand
The extension that device 321 carries out sign bit is opened up, spreading result is stored back into X register 303, updates the numerical value in X register 303.Work as Y
When symbol selector 408 exports result less than or equal to 0, the current output data of X register 303 is subtracted into Y dextroposition device 305 and is worked as
Then operation result is exported to the i+1 grade input terminal Xi+1 of X selector 301, then exported to X by the shift result of preceding output
Sign bit expander 321 carries out the extension of sign bit, and spreading result is stored back into X register 303, is updated in X register 303
Numerical value.As the umber of beats that iteration count module 102 provides is incremented by, X selector 301 claps cosine plus and minus calculation devices 307 upper one
Output result selection enter i+1 grade input terminal, the shifting after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped
Position plus and minus calculation, wherein mobile digit of the Y dextroposition device 305 in i-th iteration operation is i, corresponds to iteration count module
The 102 i+1s bat count signals provided, i=0,1,2,3 ... 15;Moving to right digit is that metronomic beat number subtracts 1, i.e., the
One beat moves to right 0, and second beat moves to right 1, and third beat moves to right 2, so analogizes, and the 16th beat just moves to right
15.The operational data bit wide with escape character position that X sign bit expander 321 obtains in interative computation each time is equal to
48 bits;Wherein X register 303, y register 304 and Z register 317 are all reusable registers.
As shown in figure 4, Y selector 302, the first count for being provided according to iteration count module 102 select positive and negative pre- place
The output result of reason module 400 enters the i-stage input terminal Yi of Y selector 302, then exports to Y sign bit expander 322 and carry out
Spreading result is stored in y register 304 by the extension of sign bit;The input terminal of X dextroposition device 306 connects X register 303, sinusoidal
Two operation input terminals of plus and minus calculation devices 308 output end phase with the output end of y register 304 and X dextroposition device 306 respectively
Connection.When Y symbol selector 408 export sign bit result be 0, X dextroposition is subtracted to the current output data of y register 304
Then the shift result that device 306 currently exports exports operation result to the i+1 grade input terminal Yi+1 of Y selector 302, then
It exports to Y sign bit expander 322 and carries out the extension of sign bit, spreading result is stored back into y register 304 and updates storage number
Value.When Y symbol selector 408, which exports result, is less than or equal to 0, X dextroposition is added to the current output data of y register 304
Then the shift result that device 306 currently exports exports operation result to the i+1 grade input terminal Yi+1 of Y selector 302, then
It exports to Y sign bit expander 322 and carries out the extension of sign bit, spreading result is stored back into y register 304 and updates storage number
Value.As the umber of beats that iteration count module 102 provides is incremented by, Y selector 302 claps sinusoidal plus and minus calculation devices 308 upper one
It exports result selection and enters i+1 grade input terminal Yi+1, then export to Y sign bit expander 322 extension for carrying out sign bit, make
Input data currently to clap participates in the displacement plus and minus calculation after above-mentioned symbol Bits Expanding, wherein X dextroposition device 306 is in i-th
Mobile digit when interative computation is i, and the i+1 provided corresponding to iteration count module 102 claps count signal, i=0,1,2,
3 ... 15;Moving to right digit is that metronomic beat number subtracts 1, i.e. first beat moves to right 0, and second beat moves to right 1,
Third beat moves to right 2, so analogizes, and the 16th beat just moves to right 15.Y sign bit expander in interative computation each time
The 322 obtained operational data bit wides with escape character position are equal to 48 bits;Wherein X register 303, y register 304
It is all reusable register with Z register 317.
As shown in figure 4, Y symbol selector 408, the first count for being provided according to iteration count module 102 select positive and negative
The signal sign (Y0) that preprocessing module 400 exports the sign bit of result enters the i-stage input terminal of Y symbol selector 408
Sign (Yi), it is corresponding to select Y selector as the umber of beats that iteration count module 102 provides is incremented by successive iterations operation
The signal of the sign bit of the data of 302 i+1 grade input terminal sign (Yi+1) enters Y symbol selector 408, so that Y is selected
The signal of the i+1 grade input terminal sign (Yi+1) of device 302 is as determining cosine plus and minus calculation devices 307, sinusoidal plus and minus calculation devices
308 and 320 arithmetic type of arc tangent adder-subtractor judgement signal.
As shown in figure 4, arc tangent interative computation module 403 further includes Z negative processor 404, Z result selector 405, Z
Result register 406 and Z outlet selector 407.One selection input terminal of Z outlet selector 407 connects arc tangent addition and subtraction
Another selection input terminal of the output end of device 320, Z outlet selector 407 is hanging, the selection end connection of Z outlet selector 407
Iteration count module 102, the output of the preset umber of beats arc tangent adder-subtractor 320 for being exported according to iteration count module 102
As a result selection output carries out complement code processing;Preset umber of beats is the 16th bat in the utility model embodiment one.When the meter of 16 beats
After the completion of calculation, in the 17th beat, handled according to the calculated result that signal sign (Y00) is clapped 16.Wherein signal sign
It (Y00) is arctan function required by the trigonometric computing circuit that is had determined when handling input operand
The sign bit signal of value.
The input terminal of Z negative processor 404 is connected with the output end of Z outlet selector 407, and the two of Z result selector 405
A selection input terminal is connect with the output end of the output end of Z negative processor 320 and Z outlet selector 407 respectively, is used for basis
The signal of numerical symbol determined by its one Y00 of operand for selecting the received positive and negative preprocessing module 400 in end to export, selects Z
The respective handling data of the output result of outlet selector 407 are exported to Z result register 406, when one Y00 of operand is corresponding
The sign bit is 1, then the output data of Z outlet selector 407 negate by Z negative processor 404 plus one operates, then
It will be by selection output to Z result register 406;When the corresponding sign bit of one Y00 of operand is 0, then Z outlet selector
407 output data is selected to be directly output to Z result register 406;The numerical value wherein stored in Z result register 406 is made
It is clapped in arc tangent interative computation module 403 by 16 for the trigonometric computing circuit and counts obtained arctan function
Value.
A kind of trigonometric computing circuit based on fixed-point number provided by the utility model has used hardware program language to exist
RTL level is described.Logic synthesis has been carried out using Verdi synthesis tool based on standard block technology library;It is driven using timing
Dynamic design method has carried out placement-and-routing with Cadence placement-and-routing tool.
Device embodiments described above are only schematical, wherein the unit as illustrated by the separation member
It may or may not be physically separated, component shown as a unit may or may not be physics list
Member, it can it is in one place, or may be distributed over multiple network units.It can be selected according to the actual needs
In some or all of the modules realize the purpose of present embodiment scheme.Those of ordinary skill in the art are not paying creation
Property labour in the case where, it can understand and implement.
Claims (10)
1. a kind of trigonometric computing circuit, which is characterized in that the trigonometric computing circuit include preprocessing module (101),
Iteration count module (102), DDR module (100) and interative computation module (103);
Preprocessing module (101) is connected with DDR module (100), for the counting umber of beats in iteration count module (102)
Under driving, according to type accordingly input operand one and the operand two, and combination DDR module (100) for calculating trigonometric function
Constant needed for the calculating trigonometric function of offer is respectively modified operand one and operand two, so that the trigonometric function
The sign bit of the operation result of computing circuit is determined in advance;
Interative computation module (103) is connect with preprocessing module (101), for the counting umber of beats in iteration count module (102)
Driving under, in conjunction with preprocessing module (101) export operand two pre-processed results, to the pre-processed results of operand one
And the operand zero of input is extended the level-one cordic algorithm interative computation of sign bit, so that the current output of the same level is made
For inputting to form feedback arrangement in the outcome symbol position currently exported of same level-one iteration and the same level and keep for the same level next time
It is constant, finally use sign bit determined by preprocessing module (101) as the difference of interative computation module (103) parallel output
The sign bit of type trigonometric function calculated result;
DDR module (100) is connected with interative computation module (103), for the counting umber of beats in iteration count module (102)
Driving under, by i rotation angle, θ of storageiInterative computation module (103) are sent to constant needed for calculating trigonometric function,
And connect by bus interface with processor, make it after the interrupt signal that processor receives that interative computation module (103) issue
The output of interative computation module (103) is received as a result, wherein θi=tan-1(2-i), i=0,1,2,3 ... n-1;
Iteration count module (102), for by counting umber of beats signal and preprocessing module (101), interative computation module (103)
It establishes a connection with DDR module (100), so that interative computation module (103) basis under each driving for clapping count signal
Preprocessing module (101) and the signal of DDR module (100) input complete every level-one interative computation;
Wherein, operand zero, operand one and operand two are all that processor issues, and operand zero and operand one are all two
System fixed-point number, operand is second is that the binary fixed point number indicated with arc pattern.
2. trigonometric computing circuit according to claim 1, which is characterized in that operand zero, operand one and operand
Two all indicate fixed-point number using 32 bits, and its decimal point is fixed on the 21st.
3. trigonometric computing circuit according to claim 2, which is characterized in that when processor configures meter according to user instructions
When the type for calculating trigonometric function is SIN function and cosine function, preprocessing module (101) is angle pretreatment module (200),
For corresponding to constant multilevel iudge input operand two needed for the calculating trigonometric function by being provided with DDR module (100)
Radian value sine function sign bit and cosine function value sign bit, while will be defeated according to triangulate decomposition method relationship
Enter arc range corresponding to operand two to be adapted in [0, pi/2] range;Angle pretreatment module (200) includes the second displacement
Device (202), the first shift unit (201), divider (203), multiplier (204), symbol selector (208), plus and minus calculation devices
(205), the first subtracter (206), the second subtracter (207) and third subtracter (209);
Wherein, the first shift unit (201), for the correspondence of 2 π of constant needed for the calculating trigonometric function that provides DDR module (100)
The fixed-point number toward moving to left 21, and the result data moved to left is exported to divider (203) and multiplier (204);Second
Shift unit (202) is connected with divider (203), for by the operand two of input toward moving to left 21, and the result that will be moved to left
Data are exported to divider (203);Divider (203), while the first shift unit (201) and the second shift unit (202) are connected, it uses
In the output data of the output data of the first shift unit (201) and the second shift unit (202) is made binary division operation, and handle
Division result is exported to multiplier (204);Multiplier (204), while the first shift unit (201) and divider (203) are connected, it uses
When the highest order in operand two is 1 or operand two is greater than 2 π of the constant corresponding fixed-point number, by divider (203)
Output result is multiplied with the output data of the first shift unit (201), and multiplied result is exported to plus and minus calculation devices (205);
Plus and minus calculation devices (205) are connected with multiplier (204), for the highest order in operand two be 1 when control operand
Two carry out add operation with multiplier (204) output result, and in the highest order of operand two be 0 and operand two is greater than 2 π of constant
Operand two is controlled when the corresponding fixed-point number and multiplier (204) output result carries out subtraction, so that operand two
The modified corresponding arc range of institute is [0,2 π];First subtracter (206) and third subtracter (209), for being transported according to plus-minus
The correction result for calculating device (205) output executes subtraction, when the correction result of plus and minus calculation devices (205) output corresponds to radian model
When enclosing for [π, 2 π], the correction result of plus and minus calculation devices (205) is exported to the first subtracter (206) and is mentioned with DDR module (100)
The corresponding fixed-point number of the constant π of confession subtracts operation;When the correction result of plus and minus calculation devices (205) output corresponds to radian model
When enclosing for [pi/2, π], the correction result of plus and minus calculation devices (205) export to third subtracter (209) and with DDR module (100)
The corresponding fixed-point number of the constant π of offer subtracts operation;Second subtracter (207), for according to the first subtracter (206)
The correction result of output executes subtraction operation, be when the correction result of the first subtracter (206) output corresponds to arc range [pi/2,
π] when, the correction result fixed-point number corresponding with the constant pi/2 that DDR module (100) provides of the first subtracter (206) output
Subtract operation, so that it is [0, pi/2] that the correction result of the second subtracter (207) output, which corresponds to arc range,;
Symbol selector (208), for receiving the SIN function sign bit and operand two that can determine operand two simultaneously
The signal of the corresponding arc range of cosine function sign bit, and the transformation relation based on trigonometric function selects corresponding sign bit
As the sign bit of the trigonometric computing circuit operation result, and export the SIN function of the corresponding radian value of operand two
The sign bit signal of value and the sign bit signal of cosine function value, wherein the trigonometric computing circuit operation result includes behaviour
It counts the sine function and cosine function value of two corresponding radian values.
4. trigonometric computing circuit according to claim 3, which is characterized in that when processor configures meter according to user instructions
When the type for calculating trigonometric function is SIN function and cosine function, interative computation module (103) is sine and cosine interative computation module
(300), sine and cosine interative computation module (300) includes the feedback arrangement, which includes X selector (301), Y choosing
Select device (302), X register (303), y register (304), Z selector (316), Z register (317), angle symbol selector
(315), Y dextroposition device (305), X dextroposition device (306), cosine plus and minus calculation devices (307), sinusoidal plus and minus calculation devices (308),
Arc tangent adder-subtractor (320), X sign bit expander (321) and Y sign bit expander (322);
X sign bit expander (321), for by the sign bit of operand zero and each time cosine plus and minus calculation devices in interative computation
(307) the sign bit repeat replication of output result avoids interative computation mistake to create the operational data with escape character position
Data type changes in journey;
Y sign bit expander (322), for by the sign bit of operand one and each time sinusoidal plus and minus calculation devices in interative computation
(308) the sign bit repeat replication of output result avoids interative computation mistake to create the operational data with escape character position
Data type changes in journey;
Angle symbol selector (315), the first count for being provided according to iteration count module (102), selected angle pretreatment
The i-stage input terminal of the signal entry angle symbol selector (315) of the sign bit of the correction result of module (200) output, after
In continuous interative computation, as the umber of beats that iteration count module (102) provide is incremented by, select the i+1 grade of Z selector (316) defeated
Enter the sign bit signal of the data at end as determining cosine plus and minus calculation devices (307) and sinusoidal plus and minus calculation devices (308) operation class
The judgement signal of type;
Z selector (316), the first count for being provided according to iteration count module (102), selected angle preprocessing module
(200) correction result exported enters the i-stage input terminal of Z selector (316), then correction result is stored in Z register
(317);Two operation input terminals of arc tangent adder-subtractor (320) respectively with the output end of Z register (317), DDR module
(100) arctan function output end is connected, the umber of beats for being provided according to iteration count module (102), DDR module
(100) rotation angle, θ corresponding with the umber of beats is providedi, while the sign bit knot exported according to angle symbol selector (315)
Fruit determines the rotation angle, θ that the current output data of Z register (317) and DDR module (100) provideiArithmetic type, and
Operation result is exported to the i+1 grade input terminal of Z selector (316), as the umber of beats that iteration count module (102) provide is passed
Increasing, the output result selection that arc tangent adder-subtractor (320) is clapped upper one is entered i+1 grade input terminal by Z selector (316),
It is completed and rotation angle, θ as the input data currently clappediPlus and minus calculation, wherein θi=tan-1(2-i), i=0,1,2,3 ...
n-1;
X selector (301), the first count for being provided according to iteration count module (102), selection operation number zero enter X and select
The i-stage input terminal of device (301), then the extension for carrying out sign bit is exported to X sign bit expander (321), spreading result is deposited
Enter X register (303);The input terminal of Y dextroposition device (305) connects y register (304), and the two of cosine plus and minus calculation devices (307)
A operation input terminal is connected with the output end of the output end of X register (303) and Y dextroposition device (305) respectively, is used for basis
The signal of the sign bit result of angle symbol selector (315) output determines that the current output data of X register (303) and Y move to right
Arithmetic type performed by the shift result that position device (305) currently exports, and operation result is exported to X selector (301)
I+1 grade input terminal, as the umber of beats that iteration count module (102) provide is incremented by, X selector (301) is by cosine plus and minus calculation
The output result selection that device (307) is clapped upper one enters i+1 grade input terminal, then exports to X sign bit expander (321) and carry out
The extension of sign bit, the displacement plus and minus calculation after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped, wherein Y is right
Mobile digit of the shift unit (305) in i-th iteration operation is i, corresponds to the i+1 that iteration count module (102) provide
Clap count signal, i=0,1,2,3 ... n-1;Each time in interative computation X sign bit expander (321) obtain have extension
The operational data bit wide of sign bit is equal;
Y selector (302), the first count for being provided according to iteration count module (102), selection operation number one enter Y and select
The i-stage input terminal of device (302), then the extension for carrying out sign bit is exported to Y sign bit expander (322), spreading result is deposited
Enter y register (304);The input terminal of X dextroposition device (306) connects X register (303), and the two of sinusoidal plus and minus calculation devices (308)
A operation input terminal is connected with the output end of the output end of y register (304) and X dextroposition device (306) respectively, is used for basis
The signal of the sign bit result of angle symbol selector (315) output determines that the current output data of y register (304) and X move to right
Arithmetic type performed by the shift result that position device (306) currently exports, and operation result is exported to Y selector (302)
I+1 grade input terminal, as the umber of beats that iteration count module (102) provide is incremented by, Y selector (302) is by sinusoidal plus and minus calculation
The output result selection that device (308) is clapped upper one enters i+1 grade input terminal, then exports to Y sign bit expander (322) and carry out
The extension of sign bit, the displacement plus and minus calculation after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped, wherein X is right
Mobile digit of the shift unit (306) in i-th iteration operation is i, corresponds to the i+1 that iteration count module (102) provide
Clap count signal, i=0,1,2,3 ... n-1;Each time in interative computation Y sign bit expander (322) obtain have extension
The operational data bit wide of sign bit is identical;
Wherein, operand zero is set as a constant, and operand one is set as 0.
5. according to trigonometric computing circuit described in claim 3 or claim 4, which is characterized in that sine and cosine interative computation
Module (300) further includes X negative processor (309), X result selector (310), X result register (311), Y negative processor
(312), Y result selector (313), Y result register (314), X outlet selector (318) and Y outlet selector (319);
The output end of one selection input terminal connection cosine plus and minus calculation devices (307) of X outlet selector (318), X output selection
Another selection input terminal of device (318) is hanging, and the selection end of X outlet selector (318) connects iteration count module (102),
Preset umber of beats for being exported according to iteration count module (102) is defeated to the output result selection of cosine plus and minus calculation devices (307)
Out;
The input terminal of X negative processor (309) is connected with the output end of X outlet selector (318), X result selector (310)
Two selection input terminals connect with the output end of X negative processor (309) and the output end of cosine plus and minus calculation devices (307) respectively
It connects, the cosine of the corresponding radian value of operand two for selecting the received angle pretreatment module in end (200) output according to it
The signal of the sign bit of functional value selects the complement data of the output result of X outlet selector (318) to export to X result and deposits
Device (311);The numerical value wherein stored in X result register (311) is as the trigonometric computing circuit under preset umber of beats
Cosine function value;
One selection input terminal of Y outlet selector (319) connects the output end of sinusoidal plus and minus calculation devices (308), Y output selection
Another selection input terminal of device (319) is hanging, and the selection end of Y outlet selector (319) connects iteration count module (102),
Preset umber of beats for being exported according to iteration count module (102) is defeated to the output result selection of sinusoidal plus and minus calculation devices (308)
Out;
The input terminal of Y negative processor (312) is connected with the output end of Y outlet selector (319), Y result selector (313)
Two selection input terminals connect respectively with the output end of the output end of Y negative processor (312) and Y outlet selector (319),
For selecting the SIN function of the corresponding radian value of operand two of the received angle pretreatment module in end (200) output according to it
The signal of the sign bit of value selects the complement data of the output result of Y outlet selector (319) to export to Y result register
(314);The numerical value wherein stored in Y result register (314) is as the trigonometric computing circuit under preset umber of beats
Sine function.
6. trigonometric computing circuit according to claim 5, which is characterized in that sine and cosine interative computation module (300)
Interative computation number is set as 16, i.e. i=16;The corresponding preset umber of beats is 16;The operation with escape character position
Data bit width is 48 bits;The bit wide of X register (303) and y register (304) is both configured to 48 bits;Z register
(317) bit wide is set as 32 bits;
The counter that iteration count module (102) is one 5, the metronome as the trigonometric computing circuit.
7. trigonometric computing circuit according to claim 2, which is characterized in that when processor configures meter according to user instructions
When the type for calculating trigonometric function is arctan function, preprocessing module (101) is positive and negative preprocessing module (400), including Y0 is born
Number processor (401) and Y0 result selector (402), wherein and the selection input terminal and Y0 of Y0 result selector (402)
The input terminal of negative processor (401) is connected, for receiving operand one;Another selection of Y0 result selector (402)
Input terminal is connected with the output end of Y0 negative processor (401), for selecting the symbol of the received operand one in end according to it
The signal of numerical symbol determined by position carries out complement code processing to operand one, and will be determined by the sign bit of operand one
The signal of numerical symbol is exported to interative computation module (103).
8. trigonometric computing circuit according to claim 7, which is characterized in that when processor configures meter according to user instructions
When the type for calculating trigonometric function is arctan function, interative computation module (103) is arc tangent interative computation module (403), instead
Tangent interative computation module (403) includes the feedback arrangement that next time inputs of the current output of described the same level as the same level, should
Feedback arrangement include X selector (301), Y selector (302), X register (303), y register (304), Z selector (316),
Z register (317), X sign bit expander (321), Y sign bit expander (322), Y symbol selector (408), Y dextroposition device
(305), X dextroposition device (306), cosine plus and minus calculation devices (307), sinusoidal plus and minus calculation devices (308) and arc tangent adder-subtractor
(320);
X sign bit expander (321), for by the sign bit of operand zero and each time cosine plus and minus calculation devices in interative computation
(307) the sign bit repeat replication of output result avoids interative computation mistake to create the operational data with escape character position
Data type changes in journey;
Y sign bit expander (322), the sign bit of pre-processed results for export positive and negative preprocessing module (400) and often
The sign bit repeat replication of the output result of sinusoidal plus and minus calculation devices (308) is in an iteration operation to create with escape character
The operational data of position avoids data type during interative computation from changing;
Z selector (316), the first count for being provided according to iteration count module (102), selection operation number two enter Z and select
The i-stage input terminal of device (316) is restored again into Z register (317);Two operation input terminals of arc tangent adder-subtractor (320) point
It is not connected with the arctan function output end of the output end of Z register (317), DDR module, for according to iteration count mould
The umber of beats of block (102), DDR module (100) provide rotation angle, θ corresponding with the umber of beatsi, while according to Y symbol selector
(408) the sign bit result exported determines the current output data of Z register (317) and the rotation angle, θiArithmetic type,
And operation result is exported to the i+1 grade input terminal of Z selector (316), the umber of beats provided with iteration count module (102)
It is incremented by, the output result selection that arc tangent adder-subtractor (320) is clapped upper one is entered i+1 grade and inputted by Z selector (316)
End is completed and rotation angle, θ as the input data currently clappediOperation, wherein θi=tan-1(2-i), i=0,1,2,3 ...
n-1;
X selector (301), the first count for being provided according to iteration count module (102), selection operation number zero enter X and select
The i-stage input terminal of device (301), then the extension for carrying out sign bit is exported to X sign bit expander (321), spreading result is deposited
Enter X register (303);The input terminal of Y dextroposition device (305) connects y register (304), and the two of cosine plus and minus calculation devices (307)
A operation input terminal is connected with the output end of the output end of X register (303) and Y dextroposition device (305) respectively, is used for basis
The signal of the sign bit result of Y symbol selector (408) output determines the current output data of X register (303) and Y dextroposition
Arithmetic type performed by the shift result that device (305) currently exports, and operation result is exported to the i-th of X selector (301)
+ 1 grade of input terminal, as the umber of beats that iteration count module (102) provide is incremented by, X selector (301) is by cosine plus and minus calculation devices
(307) the output result selection clapped upper one, which is exported again into i+1 grade input terminal to X sign bit expander (321), is accorded with
The extension of number position, the displacement plus and minus calculation after above-mentioned symbol Bits Expanding is participated in as the input data currently clapped, wherein Y is moved to right
Mobile digit of the position device (305) in i-th iteration operation is i, corresponds to the i+1 that iteration count module (102) provide and claps
Count signal, i=0,1,2,3 ... n-1;Each time in interative computation X sign bit expander (321) obtain have escape character
The operational data bit wide of number position is equal;
Y selector (302), the first count for being provided according to iteration count module (102), selects positive and negative preprocessing module
(400) pre-processed results exported enter the i-stage input terminal of Y selector (302), then export to Y sign bit expander (322)
Spreading result is stored in y register (304) by the extension for carrying out sign bit;The input terminal of X dextroposition device (306) connects X register
(303), two operation input terminals of sinusoidal plus and minus calculation devices (308) respectively with the output end of y register (304) and X dextroposition
The output end of device (306) is connected, and the signal of the sign bit result for being exported according to Y symbol selector (408) determines that Y is posted
Arithmetic type performed by the shift result that the current output data of storage (304) and X dextroposition device (306) currently export, and will
Operation result is exported to the i+1 grade input terminal of Y selector (302), as the umber of beats that iteration count module (102) provide is passed
Increasing, the output result selection that sinusoidal plus and minus calculation devices (308) are clapped upper one is entered i+1 grade input terminal by Y selector (302),
It is exported again to Y sign bit expander (322) and carries out the extension of sign bit, participate in above-mentioned sign bit as the input data currently clapped
Displacement plus and minus calculation after extension, wherein mobile digit of the X dextroposition device (306) in i-th iteration operation is i, is corresponded to
The i+1 that iteration count module (102) provides claps count signal, i=0,1,2,3 ... n-1;Y symbol in interative computation each time
The operational data bit wide with escape character position that Bits Expanding device (322) obtains is identical;
Y symbol selector (408), the first count for being provided according to iteration count module (102), selects positive and negative preprocessing module
(400) signal of the sign bit of the pre-processed results exported enters the i-stage input terminal of Y symbol selector (408), successive iterations
In operation, as the umber of beats that iteration count module (102) provide is incremented by, the corresponding i+1 grade for selecting Y selector (302) is defeated
Enter the signal of the sign bit of the data at end as determining cosine plus and minus calculation devices (307), sinusoidal plus and minus calculation devices (308) and anyway
Cut the judgement signal of adder-subtractor (320) arithmetic type;
Wherein, operand zero is set as a constant, and operand two is set as 0.
9. according to trigonometric computing circuit described in claim 7 or claim 8, which is characterized in that arc tangent interative computation
Module (403) further includes Z negative processor (404), Z result selector (405), Z result register (406) and Z output selection
Device (407);
The output end of one selection input terminal connection arc tangent adder-subtractor (320) of Z outlet selector (407), Z output selection
Another selection input terminal of device (407) is hanging, and the selection end of Z outlet selector (407) connects iteration count module (102),
Preset umber of beats for being exported according to iteration count module (102) is defeated to the output result selection of arc tangent adder-subtractor (320)
Out;
The input terminal of Z negative processor (404) is connected with the output end of Z outlet selector (407), Z result selector (405)
Two selection input terminals are connect with the output end of the output end of Z negative processor (404) and Z outlet selector (407) respectively, are used
In the letter for selecting received positive and negative preprocessing module (400) the output numerical symbol based on determined by operand one in end according to it
Number, select the respective handling data of the output result of Z outlet selector (407) to export to Z result register (406);Wherein Z is tied
Arc tangent function value of the numerical value stored in fruit register (406) as the trigonometric computing circuit under preset umber of beats.
10. trigonometric computing circuit according to claim 9, which is characterized in that arc tangent interative computation module (403)
Interative computation number is set as 16, i.e. i=16;The corresponding preset umber of beats is 16;The operation with escape character position
Data bit width is 48 bits;The bit wide of X register (303) and y register (304) is both configured to 48 bits;
The counter that iteration count module (102) is one 5, the metronome as the trigonometric computing circuit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201821267758.1U CN208834289U (en) | 2018-07-27 | 2018-07-27 | A kind of trigonometric computing circuit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201821267758.1U CN208834289U (en) | 2018-07-27 | 2018-07-27 | A kind of trigonometric computing circuit |
Publications (1)
Publication Number | Publication Date |
---|---|
CN208834289U true CN208834289U (en) | 2019-05-07 |
Family
ID=66308410
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201821267758.1U Withdrawn - After Issue CN208834289U (en) | 2018-07-27 | 2018-07-27 | A kind of trigonometric computing circuit |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN208834289U (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108733349A (en) * | 2018-07-27 | 2018-11-02 | 珠海市微半导体有限公司 | A kind of trigonometric computing circuit based on fixed-point number |
CN114707110A (en) * | 2022-06-07 | 2022-07-05 | 中科亿海微电子科技(苏州)有限公司 | Trigonometric function and hyperbolic function extended instruction computing device and processor core |
-
2018
- 2018-07-27 CN CN201821267758.1U patent/CN208834289U/en not_active Withdrawn - After Issue
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108733349A (en) * | 2018-07-27 | 2018-11-02 | 珠海市微半导体有限公司 | A kind of trigonometric computing circuit based on fixed-point number |
CN108733349B (en) * | 2018-07-27 | 2023-05-05 | 珠海一微半导体股份有限公司 | Trigonometric function operation circuit based on fixed point number |
CN114707110A (en) * | 2022-06-07 | 2022-07-05 | 中科亿海微电子科技(苏州)有限公司 | Trigonometric function and hyperbolic function extended instruction computing device and processor core |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108733349A (en) | A kind of trigonometric computing circuit based on fixed-point number | |
CN106155627B (en) | Low overhead iteration trigonometric device based on T_CORDIC algorithm | |
CN103677738B (en) | Low delay based on mixed mode cordic algorithm surmounts function implementation method and device substantially | |
CN102629189B (en) | Water floating point multiply-accumulate method based on FPGA | |
CN101630243B (en) | Transcendental function device and method for realizing transcendental function utilizing same | |
CN107305484B (en) | Nonlinear function operation device and method | |
CN102073472B (en) | Trigonometric function CORDIC iteration operation coprocessor and operation processing method thereof | |
JP4232838B2 (en) | Reconfigurable SIMD type processor | |
CN101326486B (en) | Apparatus and method for implementing division operation or square root operation of floating-point number | |
CN208834289U (en) | A kind of trigonometric computing circuit | |
CN106250098A (en) | For controlling the device and method rounded off when performing floating-point operation | |
CN104679474A (en) | Multiplying unit on finite field GF (2 227) and modular multiplication algorithm | |
CN101874237A (en) | Apparatus and method for performing magnitude detection for arithmetic operations | |
CN111443893A (en) | N-time root calculation device and method based on CORDIC algorithm | |
CN105913118A (en) | Artificial neural network hardware implementation device based on probability calculation | |
CN105608055B (en) | A kind of butterfly processing element, fft processor and method based on bit string framework | |
CN111984227A (en) | Approximate calculation device and method for complex square root | |
CN102799412A (en) | CORDIC (coordinate rotation digital computer) accelerator based on parallel pipeline design | |
CN104536720B (en) | The measuring method and system of angle measurement trigonometric function value based on FPGA | |
CN108037906A (en) | TCORDIC algorithm-based floating point basic function implementation method and device | |
CN100367191C (en) | Fast pipeline type divider | |
CN108055041A (en) | A kind of data type conversion circuit unit and device | |
CN107423026A (en) | The implementation method and device that a kind of sin cos functionses calculate | |
CN109298848A (en) | The subduplicate circuit of double mode floating-point division | |
CN111984226B (en) | Cube root solving device and solving method based on hyperbolic CORDIC |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
GR01 | Patent grant | ||
GR01 | Patent grant | ||
AV01 | Patent right actively abandoned |
Granted publication date: 20190507 Effective date of abandoning: 20230505 |
|
AV01 | Patent right actively abandoned |
Granted publication date: 20190507 Effective date of abandoning: 20230505 |
|
AV01 | Patent right actively abandoned | ||
AV01 | Patent right actively abandoned |