LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fpga: ram usage in report vs calculation

I am trying to find out how does the compilation report come up with the 

 

Memory declared:

# of elements: 30720 elements

Data type: I32

30720 * 32 = 983040 bits used

 

If I have a Vitex-II 3000, I should have 1728kbit of RAM.  That is equal to 1720*1024 = 1769472 bits avaiable

 

If my compilation report tells me that I used 47% of my RAM, I should be able to get the same result by diong (bits used)/(bits available)*100, right? My result is a bit off.  Why is that?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Message 1 of 7
(3,392 Views)

I'm not familiar with the hardware but are you sure you're not mixing up bits and bytes?

0 Kudos
Message 2 of 7
(3,378 Views)

On a second look that's obviously not the case.

 

I've grown tomore or less ignore the estimates resource calculations.  They never add up in the end.

 

Also seems like your software thinks that your hardware has 2048 Kbits, then it adds up.

Message 3 of 7
(3,353 Views)

Hi jyang,

 

If you look at the Virtex-II data sheet, you will see that the data-width of the RAM is 36 bits wide, not 32. Using 36 bits in your above calculation should get you closer to the estimated usage.

 

EDIT: Just did the math, and it comes out to 62.5% used, which is even more than you expected. Do you have a memory item that you aren't using, which might be optimized out during compilation? Which FPGA target is this exactly (781x or 783x)?

 

EDIT 2: FYI, the result should lie between MNEmin and MNEmax from the formulas below, based on how Xilinx optimizes the memory space:

 





Cheers!

TJ G
Message 4 of 7
(3,330 Views)

I guess I am just wondering how is the % ram usage calculated in the compilation report.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 7
(3,314 Views)

Hi T-REX,

 

Your calculation attached appeared as broken links.  I can't see them.  Can you re-attach again?  

 

How does the data-width of the RAM play a role in the calculation?  As you can see, I didn't use it.  

 

I made a little mistake in my previous calculation.  Please see my calculation corrected below.  The I32 is what I declare my waveform memory to have.  It takes I32 in the program.  I am working with a PCI-7833R

 

Memory declared:

# of elements: 30720 elements

Data typen declared: I32

30720 * 32 = 983040 bits used

 

If I have a Vitex-II 3000, I should have 1728kbit of RAM.  That is equal to 1728*1024 = 1769472 bits avaiable

 

If my compilation report tells me that I used 59.4% of my RAM, I should be able to get the same result by diong (bits used)/(bits available)*100, right? I am getting 55.56 in my calculation.  Why is that?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 6 of 7
(3,310 Views)

Hi jyang,

 

This image should work (the other one works fine for me, but...)

 

BRAM Formulas.PNG

MNE = Maximum Number of Elements (i.e., how many Elements can I put in memory items)

 

Basically, we try to optimize what we can fit in the available space, which may take up a maximum of 36 bits, but may be as little as 32 bits (both for a 32 bit number).

 

That %RAM usage is reported back directly from the compiler, and includes every piece of RAM any part of your diagram could use. Some functions (FFTs or other math functions generally) may use Block RAM as well. This could be the source of the difference for you. Also notice that memory comes in 18Kb chunks. If your memory item requires 2.5 of these chunks, then it will really take up 3. This number will be reflected in the "Actual Number of Elements" in the properties window for the memory item (not sure if your above number reflects that).

 

If you're curious, the only sure-fire way to find out (assuming password protected VIs may use BRAM), would be to dig through the (insanely enormous) Xilinx Log to see which components are using up that resource. It may be difficult (or impossible for end users) to find which part of your block diagram is instantiating that resource though.

Cheers!

TJ G
0 Kudos
Message 7 of 7
(3,301 Views)