Forum Discussion

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

less pre calculating possible ?

Hi guys.

I'm currently testing out my cyclone II starter board with quartus II.

I wanted to check out how fast the chip is and was really impressed.

Then i finally realised that quartus is precalculating nearly everything.(yes, i'm really a newbie here)

Well that's all nice, but makes some serious problems.

For example if simple calculations take 80.000+ logic elements and my poor cyclone only got 18.000 :(

So is it possible to let the cyclone calculate itself ?

I did not found any option in quartus making that possible.

Thanks !

8 Replies

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

    Hi,

    First cyclone is not (poor), don't let Altera people here that...

    It has plenty of resource to get you busy for a year.

    If you mean that things were reduced and optimised away then it is because you asked the compiler to do that and possibly you ended up with few wires if at all. There is no such option as precalculate on/off. Your design entry determines any precalculations and any left as hardware. Your request is paradoxical: do you want to precalculate or do want more resource to calculate??
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    well, let me try to explain an example.

    i tried to use the sieve of erastosthenes (http://en.wikipedia.org/wiki/sieve_of_eratosthenes) (http://en.wikipedia.org/wiki/sieve_of_eratosthenes)

    So i wrote this in verilog together with a counter.

    each second :

    - calculate next prime number

    - show number on 7-segment

    and it works fine, but the problem is that it does not scale.

    If i set the numbers to work on to be <15 i already need 18.000 logic elements but it works as it should.

    if i set it higher i need even much more elements....

    But what i want : no matter how huge the numbers get, it should still work.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    i finally realised that quartus is precalculating nearly everything

    --- Quote End ---

    Looks like a basic misunderstanding of how such operations can be implemented effectively in hardware logic respectively a hardware description language. It's very different from ususal sequential programming.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    yes, as i said i'm all new to this :o

    so, there is NO possibility to calculate this kind of functions in hardware ?

    i don't care if it's slow.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    There is a gray line between applications that should be done in software and those done in firmware(e.g.HDL).

    FPGAs can implement both; firmware for direct hardwiring of functionality giving maximum speed and software(nios) for slower work that depends on fetch-execute cycles.

    Generally, complex slow algorithms are done in software and fast intensive data processing in firmware. So I don't see any reason not to use software to search for the largest prime number so far. In fact all keyboard/display issues that interface with human beings and other creatures can be done in software without speed problems.

    In all cases there will be a limit of the finite representation, you can't go towards that infinity of mathematicians.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    so, there is NO possibility to calculate this kind of functions in hardware ?

    --- Quote End ---

    Of course it's possible. But you have to serialize the operation in a suitable way. An iteration over the intended number interval can e.g. process one value per clock cycle. But this has to be defined explicitely, not by a HDL for construct, that has the purpose of specifying parallel processing.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for explaining :)

    --- Quote Start ---

    Of course it's possible. But you have to serialize the operation in a suitable way

    --- Quote End ---

    Do you maybe know an example on how to do this ?

    Any website or tutorial for ?

    i only worked with verilog till now, because i thought i can do everything with that :o
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You probably can find examples solving similar problems with HDL classes or text books. Without a need to optimize the operations particularly, you can try to code the algorithm as is - sequentially. This implies a state machine to control the processing steps, a register for the next number and a memory to flag the numbers that have been sieved out.