1. Creating a New Memory Block
Select Tools»FPGA Module»FPGA Memory Extension Utility to open the FPGA Memory Extension Utility window, as shown in Figure 1.
Figure 1. FPGA Memory Extension Utility Window
Note: No memory blocks are available the first time you use the FPGA Module Memory Extension Utility. You must start by creating a new memory block.
Complete the following steps to create a new memory block.
- Click the Create New Block button in the FPGA Memory Extension Utility window. The Create New Memory Block dialog box appears as shown in Figure 2.
Figure 2. Create New Memory Block window
2. Configure the Data Width, Memory Size, and Icon. Data Width allows you to select among 8, 16, and 32-bit data. Memory Size allows you to select from 128 bytes to 80 KB. Click the Change Icon button to select among four icon templates. Use the unsigned? checkbox to control if the data is signed or unsigned.
3. Click the Create Block button. Memory blocks are saved in the LabVIEW\rvi\MemoryBlocks directory. The name of the memory block is nxm Block k.vi, where n is the selected data width, m is the calculated memory depth (number of addresses), and k is the block identifier starting from 0.
Note: You must include these VIs with an application if you move that application between different LabVIEW installations. If you are moving
4. The new blocks are saved as VIs in the LabVIEW 8.0\rvi\MemoryBlocks directory. When a memory block VI exists in this directory LabVIEW will automatically update the FPGA Functions palette to include a Memory Blocks palette as shown in figure 3. To access the memory blocks navigate to the Memory Blocks palette when programming a VI targeted to an FPGA device.
Figure 3. Addition of the Memory Blocks palette after the create of the memory blocks
You can create multiple memory blocks. Toggle among the memory blocks using the << and >> buttons in the FPGA Memory Extension Utility window.
2. Initializing a Memory Block
After you create a new memory block, you might want to configure it with a specific initial memory condition.
Complete the following steps to initialize a memory block.
- Select the memory block you want to initialize by clicking the << and >> buttons in the FPGA Memory Extension Utility window.
- Click the Initialize Current Block button to open the Define Table window, shown in Figure 4.
Figure 4. Define Table Window
You can specify the data to populate a memory block by clicking the Define Segments button or by clicking the Call Initialization VI button. The Define Segments button opens the Populate Memory Block dialog box. You can select a constant, linear, or sinusoidal signal to populate the memory block. The Call Initialization VI allows you to use the output of a custom VI to populate the memory block. You can also manually type in data values in the Define Table window.
Click the OK button to save your configuration of the memory block. To clear the initialized data click Define Segments in the Define Table window and select a constant mode with a value of 0 for all addresses.
3. Using the Call Initialization VI Option
Use the Call Initialization VI button to create a template VI that you can use to populate the memory block with custom data.
Complete the following steps to create an memory Initialization VI.
- Click the Call Initialization VI button on the Define Table Window.
- Select Create New Initialization VI From Template from the Mode pull-down menu.
- Enter a path and a VI name for the new template. The Call Initialization VI dialog box looks similar to Figure 5.
Figure 5. Call Initialization VI
4. Click the OK button. The VI template with the name you chose in the Initialization VI Path text box appears. Close the Define Table window and edit the template VI. Figure 6 shows an example of the template VI. The VI includes guidelines on the block diagram that define what you can create for an Initialization VI.
Figure 6. Template Created by Call Initialization VI
5. After you have created the Initialization VI click the Initialize Current Block button from the FPGA Memory Extension Utility window.
6. Click the Call Initialization VI button on the Define Table Window
7. Select Run/Load Existing Initialization VI from the Mode pull-down menu.
8. Enter a path and a VI name for the existing initialization VI.
9. Click the OK button in the Call Initialization VI window.
10. The Define Table window updates with the initialization data.
11. Click the OK button in the Define Table window.
4. Using Memory Blocks in FPGA VIs
After you create a memory block, you can use it in an FPGA VI, as shown in Figure 7.
Figure 7. Memory Block in an FPGA VI
You can access the memory blocks by navigating to the Memory Blocks palette on the FPGA functions palette. You also can drag and drop the memory block icon from the front panel or block diagram of the memory block VI.
A memory block VI has the following parameters:
- Address - Location to read or write.
- Data In - Data to write to memory. LabVIEW uses Data In only when Write? is TRUE.
- Write? - Toggles between read and write mode. The default is FALSE, or read.
- Data Out - Data read from memory. LabVIEW returns Data Out only when Write? is FALSE. If Write? is TRUE, Data Out returns the Data In value.
- Failure - Indicates when address input is out of range.
The memory block VI is a shared, non-reentrant subVI that includes an arbiter in cases where the memory block is used in more than one location on the block diagram. Limit all read or write accesses to a specific memory block in one location on your block diagram to avoid arbitration. Refer to LabVIEW Help, Contents>>FPGA Module>>FPGA Module Concepts>>Managing Shared Resources, for information about shared resources and arbitration.
Note: All memory blocks have unique address spaces and are independent of any other memory blocks used on the block diagram. This includes memory blocks used with FIFOs, Look-Up Tables, and the 16kB memory read/write VIs. LabVIEW automatically handles the address spacing for all unique memory blocks.
LabVIEW FPGA Module Memory Extension Utility - Example