Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

fixed-point tips

Hi

I have some experience with Quartus, but in the past have only worked on projects that implement very basic boolean expressions (like generating pulses with user defined widths and delays). I have been asked to try and build a block that does some stuff rather more complicated than I am used to with real numbers... but of course the final block has to be synthesizable. Here is an example of a "phase diff block" that is needed.

Inputs:

I1, I2, Q1, Q2, A1, A2 (all 16-bit with values lying between -1 and +1)

cMode (Boolean)

kc (all 16-bit with values lying between 0 and +1)

Outputs:

Pd (16-bit with values lying between -1 and +1)

LD (Boolean)

The function to implement is something like:

Pd = (I1 * Q2 - I2 * Q1) / (A1 * A2)

ld = (1-kc) * ld + kc * (I1 * I2 + Q1 * Q2) / (A1 * A2)

If cMode = '0' THEN LD = 0

ELSIF ld > 0 THEN LD = 1 ELSE LD = 0

To be honest I don't really know where to start with how to define the data types and the equation for Pd. Any tips most welcome.

Many thanks, Kurt

18 Replies