His research led to an internal technical report proposing the CORDIC algorithm to solve sine and cosine functions and a prototypical computer implementing it. Daggett, a colleague of Volder at Convair, developed conversion algorithms between binary and binary-coded decimal BCD. Meggitt IBM [15] had proposed as pseudo-multiplication and pseudo-division in CORDIC is particularly well-suited for handheld calculators, in which low cost — and thus low chip gate count — is much more important than speed. Applications[ edit ] CORDIC uses simple shift-add operations for several computing tasks such as the calculation of trigonometric, hyperbolic and logarithmic functions, real and complex multiplications, division, square-root calculation, solution of linear systems, eigenvalue estimation, singular value decomposition , QR factorization and many others. As a consequence, CORDIC has been used for applications in diverse areas such as signal and image processing , communication systems , robotics and 3D graphics apart from general scientific and technical computation.

Author:Juhn Douzilkree
Language:English (Spanish)
Genre:Personal Growth
Published (Last):6 October 2004
PDF File Size:10.95 Mb
ePub File Size:4.46 Mb
Price:Free* [*Free Regsitration Required]

On this page, we will implement a parallel, iterative processor, which is a fairly straightforward mapping of the equations into a bit-parallel data path and a state machine.

This module computes the sine and cosine of an input angle. The floating point numbers are represented as integers by scaling them up with a factor corresponding to the number of bits after the point. Note that outside the generator function, we calculate some data such as the X0 constant, and the look-up table of elementary arctangents, represented by the angles tuple.

The internal number variables are represented by intbv instances. The dual nature of this class comes in very handy. On the one hand, we can constrain the instances as integer subtypes by specifying the valid integer range at construction time. It seems obvious that a type that unifies the integer and the bit vector views should be very useful for hardware design. One would therefore expect a similar feature in other HDLs. Other HDLs seem to try to solve the issues by creating more and more integer and bit-vector like types.

In MyHDL, a single type does it all - the intbv class. Automatic conversion to Verilog Now that we have a working design and only now! Taking advantage of the elaboration phase It is important to realize that the conversion occurs on a design instance. This means that the code has already been elaborated by the Python interpreter.

Therefore, the convertor works on the simulatable data structure, which is a hierarchical list of generators. This means that only the source code of generator functions is converted. The pleasant consequence is that the restrictions of the "convertible subset" apply only to the code inside generator functions, not to any code outside them.

Note how this single-line lookup is expanded into a case statement in the Verilog output. Note that we have been talking about the convertible subset, and not about the "synthesizable subset". The reason is that the convertible subset is much less restrictive.

You can find more information about the convertible subset in the MyHDL manual. Obviously, MyHDL code intended for synthesis also has to take synthesis-related restrictions into account. But again, these restrictions only apply to the code inside generator functions, because only that code is actually converted.

The described behavior is a unique feature of the MyHDL design flow. As long as the code inside them obeys the constraints of the convertible subset, the design instance can always be converted to Verilog. And if that code also obeys the constraints of the synthesizable subset, the result will be synthesizable Verilog. Handling negative numbers One important feature of the convertor is that it handles the details of signed and unsigned representations automatically.

In contrast, a Verilog designer is forced to deal with low-level representational issues explicitly. This can become very tricky, especially with negative numbers and the signed representation. First of all, note in the Verilog output that the convertor infers which variables have to be declared as signed. This is the easy part. The fundamental problem is that Verilog uses an unsigned interpretation by default, which is the opposite from what you should do to get the naturally expected results.

Otherwise, Verilog will interprete all operands in a mixed expression as unsigned. Having said that, the Verilog literature seems to indicate that a shift operation is an exception to this rule. It may be redundant in this case.

Actually, I would have expected that this typecast would not be necessary - after all, we are shifting a signed number. However, my current simulator Cver tells me that it is. Anyway, the cast is an additional safety net. The message you should get from this discussion is the following: working with the signed representation in Verilog is tricky.

I believe that writing the code in a natural, high-level way in MyHDL, and letting the convertor take care of the low-level representation issues, is a better option. Of course, we still need to make sure that the convertor gets it right, which is hard enough. Verilog co-simulation Clearly we will want to verify that the Verilog output from the convertor is correct.

To set up a co-simulation, we need to create a Cosimulation object for the Verilog design. The Verilog convertor makes this task easier. In addition to the Verilog code for the design itself, it also generates a Verilog test bench stub that defines an interface between the Verilog design and a Cosimulation object.

Then, we define the command to start up the Verilog simulator. This is of course simulator-specific. The command shown is for the open-source Cver simulator.

It loads a vpi module that defines the interface between the MyHDL simulator and the Verilog simulator. Also, both the Verilog code for the design and the test bench stub are compiled. The Cosimulation object is then constructed with the command as its first parameter, followed by a number of keyword arguments. The keyword arguments make the link between signal names declared in the Verilog test bench stub and signals in the MyHDL code.

When the signal names in MyHDL and Verilog are identical we can use a little trick and simply pass the local namespace dictionary locals to the constructor. All Rights reserved. So the test bench confirms that the Verilog code is correct. It turned out that the handling of signed variables with shift operations had not been implemented and tested properly.

Therefore, this example has been the trigger to fix these bugs and develop MyHDL 0. For detailed information, you can review the synthesis report.


Use Cordic to Calculate Sin/Cos with Verilog Implementation



Subscribe to RSS



Cordic-based Sine Computer


Related Articles