1. Creating a New Memory BlockSelect Tools»FPGA Utilities»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.
- 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.
- Click the Create Memory Block button. Memory blocks are saved in the LabVIEW\user.lib\FPGA Memory VIs 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.
- Click the OK button in the Message Dialog dialog box that appears.
- Click the Done button in the Create New Memory Block dialog box. The new blocks are saved as VIs in the LabVIEW\user.lib\FPGA Memory VIs directory. You can use the Select a VI palette to find and use the Memory VIs, or after restarting LabVIEW you can find the memory VIs in the User Libraries>>FPGA Memory VIs palette. You can also force a refresh of the palette view by selecting Tools»Advanced»Edit Palette Views.
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 Initialize Memory Block dialog box, shown in Figure 2.
Figure 2. Initialize Memory Block Dialog Box
You can specify the data to populate a memory block by clicking the Define Signal button or by clicking the Call Initialization VI button. The Define Signal 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.
Click the OK button to save your configuration of the memory block. The initialization data stays in the memory block until you click the Remove Memory Block Initialization button in the Initialize Memory Block dialog box.
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 Initialize Memory Block 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 3.
Figure 3. Call Initialization VI
4. Click the OK button. The VI template with the name you chose in the Initialization VI Path text box appears. Figure 4 shows a template VI. The VI includes guidelines on the block diagram that define what you can create for an Initialization VI.
Figure 4. Template Created by Call Initialization VI
5. After you have created the Initialization VI click the Call Initialization VI button on the Initialize Memory Block Window.
6. Select Run/Load Existing Initialization VI from the Mode pull-down menu.
7. Enter a path and a VI name for the existing initialization VI.
8. Click the OK button in the Call Initialization VI window.
9. The Initialize Memory Block window updates with the initialization data.
10. Click the OK button in the Initialize Memory Block 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 5.
Figure 5. Memory Block in an FPGA VI
You can access the memory blocks by clicking the Select a VI palette and navigating to the memory blocks on your development computer or by refreshing the palettes and browsing to the User Libraries>> FPGA Memory VIs 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 Chapter 3, Managing Shared Resources, of the LabVIEW FPGA Module User Manual, available by selecting Start»Programs»National Instruments»LabVIEW 7.1»Module Documents»LabVIEW FPGA Module User Manual, for information about 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 - Tutorial
LabVIEW FPGA Module Memory Extension Utility - Example