Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12596 Discussions

NIOS II On-chip Memory size

Altera_Forum
Honored Contributor II
3,093 Views

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
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
1,258 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

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?
0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

Is float support your only option?  

Maybe it's convenient changing your code and use fixed point instead of float.
0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

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?
0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

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... :)

0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

 

--- 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.
0 Kudos
Altera_Forum
Honored Contributor II
1,258 Views

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);
0 Kudos
Reply