Storing and Accessing Data From Different Parts of an FPGA Design (FPGA Module)

LabVIEW 2018 FPGA Module Help


Edition Date: March 2018
Part Number: 371599P-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2015 FPGA Module Help
LabVIEW 2016 FPGA Module Help
LabVIEW 2017 FPGA Module Help
LabVIEW 2018 FPGA Module Help
LabVIEW 2019 FPGA Module Help

To store data using an FPGA application when you need to access that data from multiple clock domains, select from the following options:

Method Use case
Register items
  • You need to store a single data point
  • The data transfer can be lossy
  • You need to post a status every clock cycle
Memory items implemented using block memory
  • You need to store multiple data points
  • The data transfer can be lossy
Handshake items
  • The reader and writer nodes are synchronized
  • The data transfer must be lossless

Register Items

Use register items to store data when you need to access that data from multiple clock domains or from different parts of your design and you need to write reusable code. Register items consume fewer FPGA resources than FIFOs, and they do not consume block memory, which is a limited type of FPGA resource.

Note  Register items do not support type definitions. If your application requires you to use a type definition, use a global variable instead of a register item.

The LabVIEW FPGA Module has two types of register items:

  • VI-defined register items: Use VI-defined register items to create reentrant subVIs and avoid resource conflicts. If you configure a VI-defined register item in a reentrant FPGA VI, LabVIEW creates a separate copy of the register item for each instance of the VI.
  • Target-scoped register items: Use target-scoped register items if you want the register item to be visible and configurable from the Project Explorer window. Target-scoped register items are available within any FPGA VI under the same target in the Project Explorer window.

The following block diagram shows how you can read from and write to a register item using a Register Method Node configured for a target-scoped register item. This VI adds the value of two controls, X and Y, writes the sum to a register item, reads the stored value, increments the stored value, and prints the result to an indicator. Note that the Write and Read methods are in two different clock domains.

Creating a Target-Scoped Register Item from the Project Explorer Window

Complete the following steps to create a target-scoped register item from the Project Explorer window.

  1. In the Project Explorer window, right-click the FPGA target.
  2. Select New»Register to display the FPGA Register Properties dialog box.
  3. Click OK to finish creating the register item.
  4. Drag the register item from the Project Explorer window to the block diagram. LabVIEW adds a Register Method Node configured for the register item.
Note  If you use this method to create a register item, the register item is bound by name to the corresponding item in the project, meaning that updates to the project item affect all instances of the register item on the block diagram.

Creating a Register Item from the Block Diagram

You can create either a target-scoped or a VI-defined register item from the block diagram.

Target-Scoped:

  1. Display the block diagram of the FPGA VI.
  2. From the Functions palette, add a Register Method Node to the block diagram. 

  3. Right-click the Register Method Node and select Add New Register to display the FPGA Register Properties dialog box.
    Tip  You also can right-click the Register Method Node and select Select Register»x, where x is an existing register item.
  4. Click OK to finish creating the register item.

You also can wire a reference to the Register In input to specify an existing register item. LabVIEW configures the Register Method Node with the default method, Write. After you specify the register item, right-click the Register Method Node and select Select Method»y, where y is the specific method.

VI-Defined:

  1. Display the block diagram of the FPGA VI.
  2. From the Functions palette, add a VI-Defined Register Configuration Node to the block diagram. 

  3. Right click the VI-Defined Register Configuration Node and select Configure to display the FPGA Register Properties dialog box.
  4. Click OK to finish creating the register item.

Handshake Items

Handshake items behave like single-element FIFOs. Use handshake items to transfer one data element between a writer node in one clock domain and a reader node in the same or a different clock domain. Use handshake items to achieve lossless transfer from a writing domain to a reading domain and notify the writing domain when the reader receives the data. Handshake items consume fewer FPGA resources than FIFOs, and they do not consume block memory, which is a limited type of FPGA resource.

The LabVIEW FPGA Module has two types of handshake items:

  • VI-defined handshake items: Use VI-defined handshake items to create reentrant subVIs and avoid resource conflicts. If you configure a VI-defined handshake item in a reentrant FPGA VI, LabVIEW creates a separate copy of the handshake item for each instance of the VI.
  • Target-scoped handshake items: Use target-scoped handshake items if you want the handshake item to be visible and configurable from the Project Explorer window. Target-scoped handshake items are available within any FPGA VI under the same target in the Project Explorer window.

Reading Data Using a Handshake Method Node

There are two ways to read data using a Handshake Method Node:

Method Use case
Read method
  • You only need to read the data element one time. The Read method automatically acknowledges the data, meaning that it removes the data to prepare for the next transfer.
Acknowledge and Read Without Acknowledge methods
  • You need control over when the node acknowledges the data transfer. The reader node can read the same data element multiple times until the acknowledge executes.

The following block diagram shows how you can read from and write to a handshake item using a Handshake Method Node configured for a target-scoped handshake item. This VI increments a value by one, writes the data to a handshake item, reads the stored value, and automatically acknowledges the read. Input Valid is TRUE when Ready for Input is TRUE. The VI then writes the stored value to an indicator when Output Valid is TRUE. Note that the Write method and the Read method are in two different clock domains, indicated by two red boxes. This design ensures lossless data transfer by writing all data points to the faster clock domain.

Note  Aborting and restarting the VI does not reset a handshake item. Use the Clear method to return a handshake item to the default state.

Creating a Target-Scoped Handshake Item from the Project Explorer Window

Complete the following steps to create a target-scoped handshake item from the Project Explorer window:

  1. In the Project Explorer window, right-click the FPGA target.
  2. Select New»Handshake to display the FPGA Handshake Properties dialog box. Use the options in this dialog box to configure the handshake item.
  3. Click OK to finish creating the handshake item.
  4. Drag the handshake item from the Project Explorer window to the block diagram. LabVIEW adds a Handshake Method Node configured for the handshake item.
Note  If you use this method to create a handshake item, the handshake item is bound by name to the corresponding item in the project, meaning that updates to the project item affect all instances of the handshake item on the block diagram.

Creating a Handshake Item from the Block Diagram

You can create either a target-scoped or a VI-defined handshake item from the block diagram.

Target-Scoped:

  1. Display the block diagram of the FPGA VI.
  2. Add a Handshake Method Node to the block diagram. 

  3. Right-click the Handshake Method Node and select Add New Handshake to display the FPGA Handshake Properties dialog box.
    Tip  You also can right-click the Handshake Method Node and select Select Handshake»x, where x is an existing handshake item.
  4. Click OK to finish creating the handshake item.

You also can wire a reference to the Handshake In input to specify the handshake item. LabVIEW configures the Handshake Method Node with the default method, Write. After you specify the handshake item, right-click the Handshake Method Node and select Select Method»y, where y is the specific method.

VI-Defined:

  1. Display the block diagram of the FPGA VI.
  2. Add a Handshake Method Node to the block diagram. 

  3. Double-click the VI-Defined Handshake Configuration Node to display the FPGA Handshake Properties dialog box.
  4. Click OK to finish creating the handshake item.

Related Information

Storing Data on an FPGA Target

Implementing Multiple Clock Domains

Using I/O, Clocks, Register Items, Memory Items, FIFOs, and Handshake Items in SubVIs

Determining When to Use Reentrant or Non-Reentrant SubVIs

FPGA Register Properties Dialog Box

Memory Properties Dialog Box

FPGA Handshake Properties Dialog Box

Register Method Node

Memory Method Node

Handshake Method Node

Data Communication Methods Home

WAS THIS ARTICLE HELPFUL?

Not Helpful