Forum Discussion

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

NIOS II On-chip Memory size

Hi,

I am using DE0 board with Cyclone III FPGA. If I am not wrong, it has 56 M9K blocks. According to my calculation, it gives 57344 bytes for me to use as on-chip RAM for my NIOS II processor.

However, compilation report in Quartus tells me the error "Can't place all RAM cells in design", why?

Thank you very much in advance.

Cheers, Jimmy

8 Replies

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

    Some of the memory blocks are used by the processor itself.

    The registers use one.

    Any data/instruction caches will use some.

    The branch prediction tables will use at least one.

    Any boot code will use some.

    The JTAG debug will use some.

    Also be aware that quartos may give a 'memory used' total in bits - which doesn't include all the 'wasted' bits inpartially used blocks.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hm, okay... my problem is that the small C library does not support float, but without the small C library my elf-file is too big for the on-chip memory.

    Is the only solution then to extend to SRAM?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Is float support your only option?

    Maybe it's convenient changing your code and use fixed point instead of float.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have to use floating point, it is part of the requirement specification.

    I have just read that printf pulls in a lot of library code, are there any alternative methods to output to the console?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can use alt_printf() which supports only fixed strings and a reduced set of formatting options (neither %d nor %f).

    Are you sure the small C library doesn't support floating point? I thought the limitation was only on I/O, namely you can use float type in code but you cannot use it in printf like functions. Please check, I'm not sure of this.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Well, I also need to print out the result from a float calculation. But you just gave me the idea of converting the floating point to string first and then printf the string... :)

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

    --- Quote Start ---

    Well, I also need to print out the result from a float calculation. But you just gave me the idea of converting the floating point to string first and then printf the string...

    --- Quote End ---

    I guess you'll still get an increase of code similar to printf("%f") if you convert the float to string using a stdlib function. Infact the involved library calls are probalby the same.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can probably write a convertion function that is 'good enough' for your values.

    For instance, if you want to print positive values to 2 decimal places something like:

        unsigned int x = float_val;
        unsigned int y = (float_val - x) * 100;
        printf("%u.%2.2u\n", x, y);