LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programatically determine the total number of elements in an FPGA memory?

Solved!
Go to solution

Hi, I need to run through all the elements in an FPGA memory.  The size is set in project explorer where the memory was defined.  Is there any way to get access to this size either during compile time or runtime?  I don't want to define it as a constant on my diagram as it may change in future.

0 Kudos
Message 1 of 5
(2,615 Views)

Hi AnthonV,

 

You can access the memory at any time during runtime, either for modifying the values or accessing the data. 

 

Check this link 

http://zone.ni.com/reference/en-XX/help/371599K-01/lvfpgaconcepts/fpga_memory_items/

 

There are more ways to store data in an FPGA so take a look here http://zone.ni.com/reference/en-XX/help/371599H-01/lvfpgaconcepts/fpga_storing_data/#Memory_Items

 

Regards,

Pedro

0 Kudos
Message 2 of 5
(2,566 Views)

Hi Pedro, I am asking if there is a way to know how many elements a FPGA memory item contains. Sure i can set the memory to a size (say 4096) and then in my fpga vi use a constant with the same value 4096 to loop through all the elements. But is there a way that i dont gave to use this constant, in other words can I use for instance a property node on the memory reference to get its length? (by the way no you cannot use a property node)

0 Kudos
Message 3 of 5
(2,559 Views)
Solution
Accepted by AnthonV

AnthonV,

 

I am afraid there isn't a straightforward procedure to get the block size. I know if you set a memory block of 1024 elements and you try to write in the 1025th, you won't get an error but you can read that value and see if the data you try to write was written.

 

So, it's simply a while loop writing a random number to a memory address and just after that read the value and compare. When you hit the MAX + 1 address in memory, you'll see the value is 0 so MAX is the size of the block.

 

Regards,

PedroR

0 Kudos
Message 4 of 5
(2,543 Views)

This wasn't the solution I was hoping for but I will implement it nonetheless seeing as there is no other way.  

Thank you!

0 Kudos
Message 5 of 5
(2,524 Views)