Forum Discussion

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

little question about VHDL

Hi,all,

I want to ask is it costs a lot of resource or time delay to determine when using the sentence "if (vir+M)>500 then" ,here vir and M are both integer type.

Thanks in advance.

9 Replies

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

    The arithmetic complexity depends on the integer range, at worst case, vir and M can be both 32 bit signed numbers. (You shouldn't have integer signals without a range specification in synthesized VHDL anyway).

    To find the exact resource consumption and delay with your FPGA family, compiling a test component/design is the easiest way. But it should fit a 50 - 100 MHz clock cycle in usual synchronous designs.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    adders and comparators are pretty cheap. But as FvM says, make sure you constrain vir and M.

    Personally, Id probably register vir + M before doing the compare, to keep the clock speed up.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,all.

    Thanks for reply in detail.That's the answer to the question that I don't know which arithmetic is expensive.I also think we'd better register the result before doing the compare.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you don't need the DSP blocks on the device you can use these... this will save a lot of resources and allow a very high fmax..

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

    FPGA logic array blocks are usually handling the add/sub/compare operations. Cyclone family has no add function with it's embedded multipliers. Stratix has multiply/add combinations, but it would be rarely used for simple add operation, I think.

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

    --- Quote Start ---

    If you don't need the DSP blocks on the device you can use these... this will save a lot of resources and allow a very high fmax..

    --- Quote End ---

    Hi,paulk.

    So you think we can get a hign fmax if not use the dsp block?

    I want to know why,thank you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    FPGA logic array blocks are usually handling the add/sub/compare operations. Cyclone family has no add function with it's embedded multipliers. Stratix has multiply/add combinations, but it would be rarely used for simple add operation, I think.

    --- Quote End ---

    Hi ,FvM,again.;)

    So,what do you think the cyclone will do adder calculation when we use adder/multipliers?Just a lot of luts and dsp block?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    DSP blocks (they are designated "embedded multipliers" with Cyclone family) only if needed. You can check in the physical netlist of your design.

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

    What's functional simulation in Altera-Modelsim? Is it EDA RTL simulation?