Forum Discussion

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

floating point in verilog question

Hi there,

I'm converting some code in DSP floating point to systemverilog. I always get value 0 instead of 0.00001 in TI DSP. Is there a library to support floating point in Quartus device?

Thanks and have a good weekend.

Sean

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you have a couple of options

    Altera has some floating point megafunctions, i think Verilog is supported:

    http://www.altera.com/literature/ug/ug_altfp_mfug.pdf

    DSP Builder Advanced Blockset has some floating point blocks and full "math.h" support. it generates VHDL:

    http://www.altera.com/literature/hb/dspb/hb_dspb_adv.pdf

    you could also try the VHDL 2008 floating point package (there are some modified for VHDL-93 out there). this is not optimized for/by Altera, so i would expect the lowest fmax and highest resource usage out of the 3
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks pancake,

    I already looked into megacore ip and I don't know where to start. Do you have any samples to let me fresh start.

    In C code.

    float scale_factor;

    scale_factor = 1 / (float) number_of_samples;

    Is there module .v that I just plug the float value in/out?

    Thanks, I will look over the weekend.

    Sean