Here is a quick overview of how to use Static RAM with the LabVIEW FPGA Module:
You first have to declare a piece of Static RAM, to do this you have 2 options:
Option 1 – Declare an FPGA global Static RAM
Right-click on the FPGA target, and select “New->Memory”
The default options are fine, I chose to rename my RAM to “My_SRAM”, and to set the number of cycles of read latency to 1. (The default option was 2)
Here is what the project looks like after adding FPGA global Static RAM:
Option 2 – Declare FPGA vi-scoped Static RAM
And you will see the following on your Block Diagram:
Double-click on it and you will see the same options as before. Rename it and set the # of cycles of read latency to 1.
After you have added some Static RAM to your project, you will be able to either Read from the memory, or write to it. Additionally, you should only read or write to it from one place each, and to do both operations from inside a Single-Cycle Timed Loop. (Note: Yes, you can do it from outside these locations, but I do not recommend that a newbie do so.)
The VI to use for both reading and writing can be accessed from the “Data Storage & Transfer” palette. It is called “Memory Method Node”. You right-click on it and select between “Read” and “Write”. You also have to wire in a reference to the SRAM. The reference can be from a Constant, where you can pick the FPGA global SRAM from a combox, or it can be a wire from the VI-defined SRAM.
Now the Write method contains 2 input terminals, one for the Address, and one for the data. Memory addresses, are indexed starting with 0, and the data type wired in should match the data type defined in the memory configuration. See here, for what is probably the most simple LabVIEW FPGA SRAM example in the world:
note: The above is also a VI snippet, which means you can drag and drop it directly into a VI and it will produce the appropriate code for you!
You can see the source code on github here:
You can also download a zip file from here:
Here is a quick overview of how to use Static RAM with the LabVIEW FPGA Module: You first have to declare a piece of Sta...