Creating a Custom VI to Simulate I/O
- Updated2023-12-13
- 2 minute(s) read
Creating a Custom VI to Simulate I/O
A test bench is a custom VI that provides some stimulus to the unit under test and reads back the results to verify the design. In this case, the unit under test is the FPGA VI. The test bench passes or fails depending on the response. A simple test bench includes two parts:
- Stimulus—Data going into the component being tested
- Response—Data passed back from the component being tested
You can create a custom VI to simulate I/O in LabVIEW for use as a test bench for your FPGA VI. You can use a custom VI as a test bench to create the data coming from a particular input or monitor an output. For example, if the expected input for a particular component is a noisy sine wave, you can use a custom VI to create the noisy sine wave. Every time an FPGA VI reads an input by calling an FPGA I/O Node, LabVIEW uses the custom VI you specify to provide the data. Using custom VIs for FPGA I/O creates a repeatable scenario for testing and makes it possible to change the data for a particular input. For example, if you need a square wave instead of a sine wave, you can modify the custom VI. You also can use custom VIs for FPGA I/O to monitor an output from FPGA I/O Nodes. For example, if the expected output of a component is a sine wave and the frequency of the sine wave is the important aspect of the output, you can create a custom VI to monitor the output of an FPGA I/O Node to verify that the frequency is correct.
Before debugging an FPGA VI using a test bench, you can test the logic of the VI without compiling it by executing the FPGA VI in simulation mode using simulated I/O. Executing an FPGA VI in simulation mode using simulated I/O saves compilation time, makes tests easier to repeat, and decreases the number of modifications necessary to create a test bench for additional debugging.
Creating a Custom VI Test Bench
Complete the following steps to create a custom VI test bench from a template.
- In the Project Explorer window, right-click the FPGA target to display the FPGA Target Properties dialog box.
- On the Execution Mode page, select Simulation.
- From the pull-down menu, select Use Custom VI for FPGA I/O. LabVIEW displays the VI Path box below the menu.
- Click the New VI from Template button.
- Name the test bench and save it in the user.lib directory. The file path appears in the VI Path box.
- Click the OK button to add the custom VI to the project.
Refer to the Tutorial: Creating Test Benches topic for an example of how to create and use a custom VI test bench.