Use a memory item to transfer data on an FPGA without respect to the sequence in which the data is written to memory.
What to Use
What to Do
Create the following diagram to transfer data between loops on an FPGA.
Customize the gray sections for your unique programming goals.
|
Define the data type, size, and latency of your locally scoped memory item using the
Create Memory
node. In this example, the
Create Memory
node defines the memory item properties to the following values:
-
Memory type
is
Block RAM
-
Read latency
is
1 cycle
-
Read-only
is disabled
|
|
Specify the address within the memory item where you write data from this clock domain. The code in this diagram generates one address per loop iteration in the series {0,1,2} so that the
Write Memory
node can write a value for each of the three cases in the
Case Structure
in this
While Loop.
|
|
Capture or generate the data you write to memory during each loop iteration.
In this diagram, the
Case Structure
performs Square, Negate, and Increment operations on the value received from
input value.
|
|
Use the memory reference from the
Create Memory
node to specify the memory item that the
Write Memory
node writes data samples to. For example, in this diagram, the
Write Memory
node writes the result of the square operation to address 0, writes the result of the negate operation to address 1, and writes the result of the increment operation to address 2.
|
|
Specify the address you read from this loop. The Case Selector, labeled
operation, selects address 0 for
Square, address 1 for
Negate, and address 2 for
Increment.
|
|
The
Read Memory
node waits until data from the specified address is read from the memory.
|
|
The
Read Memory
node returns an error if the specified address is greater than the size of the memory. Use the
error out
output to check if the output data is valid. Use the output data to perform subsequent operations.
|
Troubleshooting
If the memory item returns unexpected data, verify that the input addresses for the
Read Memory
and
Write Memory
nodes are correct.
Examples
Search within the programming environment to access the following installed example:
Memory.