Re: How to create lookup table for sin(4(pi)x) in VHDL?

but do the setup inside a function, that way you can assign a constant instead of a signal

A function is possibly the more flexible way, and doesn't rely on rarely used VHDL constructs that are mostly ignored by text books.

The difference between a signal and a constant doesn't matter for the actual LUT implementation. My example will usually cause ROM inference, when supported by the respective hardware, and not explicitely prohibited in the compiler settings, and a LUT in logic cells otherwise. The same can be expected for a functions supplying constant values.

You don't necessarily need a full fixed point package, but you should understand how the sine range of -1.0 .. + 1.0 can be represented by integer numbers. It's mostly a question of your overall design, what the table values are used for.

Re: How to create lookup table for sin(4(pi)x) in VHDL?

actually, the equation is f(x) = 21.5 + x sin(4πx) + x cos(20πx). the x range is -4 to +4, find the maximum value of this equation ...The maximum value is 28.25... shall write vhdl code for this equation ...is it posssible to show 28.25 in an output(xilinx)?

Re: How to create lookup table for sin(4(pi)x) in VHDL?

You can use whatever representation you want - usually people stick with floating or fixed point. You could use that equation to generate a look up table in VHDL quite easily, but you have to decide if you want fixed point or floating point for the output. The input (X) will have to be fixed point.

Re: How to create lookup table for sin(4(pi)x) in VHDL?

Originally Posted by TrickyDicky

You can use whatever representation you want - usually people stick with floating or fixed point. You could use that equation to generate a look up table in VHDL quite easily, but you have to decide if you want fixed point or floating point for the output. The input (X) will have to be fixed point.

Re: How to create lookup table for sin(4(pi)x) in VHDL?

Output yes.
Input - you cannot do full precision (32 bit) floating point as this would require a 4GB look up table. You can reduce exponent and mantissa width to something more sensible to reduce the look up table size (total max 20 bits on large expensive FPGA devices). But generally, no. Its easier to stick with fixed point.

Re: How to create lookup table for sin(4(pi)x) in VHDL?

It seems to me, that a 8-Bit fixed point representation is already suggested by the exercise text, e.g. 3.5 for x and 6.2 for y. The objective is apparently to show the principle method, not to achieve high accuracy.