02-21-2017 07:11 AM
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.
Solved! Go to Solution.
02-22-2017 08:05 AM
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
02-22-2017 09:26 AM
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)
02-23-2017 01:50 PM
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
02-27-2017 08:07 AM
This wasn't the solution I was hoping for but I will implement it nonetheless seeing as there is no other way.
Thank you!