Forum Discussion

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

###### Code Size in IDE NIOS II ######

Hi Guys and Gurus,

I am back with another intriguing problem.

I am using NIOSII for DSP work. Now, I am realizing that

a. if the elf code size goes past 32KB, so that only 218 KB is left for Stack and heap. IDE with JTAG just crashes.

b. The NIOS II core has FPU which is soft-emulated, and hence the DSP coeffiecient computation takes longer time than is acceptable.

Any suggestion? I am sure I am the first "genius" trying to do this kind of simple stuff.

Thanks and Regards

Navendu Sinha

5 Replies

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

    a. sounds like the wrong memory is being targetted (can you provide more information like what memory (type and size) you have in your hardware and what memory targets are being used in the system library project (right click the project and select properties))

    b. you are correct about the soft emulation of a FPU. However, since FPGAs are meant to hold user defined logic you are in luck. Nios II (and Nios I) have the ability to use "Custom Instructions". A custom instruction (CI) allows the user to add their own logic to the Nios ALU. So a Nios ALU has things like add, subtract, compare, rotate, multiply, etc... and you can add your own logic to expand it's functionality. By the way if you go to the IP section of this forum, there is a floating point unit available there.

    Depending on what you are trying to do perhaps you would not want to use a CI and instead create an Avalon slave to do the calculations (you won't be stalling the CPU while it executes the CI). With that approach you just keep blasting values into it and can even allow it to send them off to the filter.

    I have a question though. Are your coeffs going to be floating or fixed point when used with the DSP logic? If they are going to be fixed point in the end I recommend creating an external wide co-processor to handle the large interger calculations.

    What you are trying to do (if I understood correctly) is a pretty common use of a Nios processor in many FPGA based DSP designs.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks.

    I figured the crashing problem. It is being caused by run-time errors partly and partly because of SRAM timing issues discussed in the posting about "problems with \n". Adjusting the SRAM timing does help.

    Your suggestion of a co-processor is certainly interesting. My coefficients are FP. Right now, my FFT code is giving me some run for my money. It works fine on our linux environment but with NIOSII, phew!!!

    Can anyone lead me to a tried code on NIOSII? or give me some pointers to it?

    Any help shall be greatly appreciated.

    Thanks and Regards

    Navendu

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    GESP,

    One of our Altera embedded specialists created a suite of floating point custom instructions with supporting C libraries that are available for download from this forum. Look in the "Post your own IP" area. His nickname is "mpaolini" -- you may have to go a page or two back. He has done both single & double precision versions.

    Alternatively, another one of our partners in Australia made several floating point custom instructions. These are also in the post-your-IP area.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    A long time ago I looked at adding the floating point hardware available in Quartus (called LPM_FP or something similar). Then you could attach it as a custom instruction. That is another solution to look at (but I would try mpaolini&#39;s FP logic first since it&#39;s less work to reuse than design).

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

    Thanks a lot Guys.

    I am trying the FP instructions and shall be back with more questions/feedbacks on it.

    But has anyone tried a DFT kind of computation on the NIOSII platform(without using a co-processor) as is marketed right now? I would br really surprized to hear a NO.

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif