The starting point for hardware co-simulation is the System Generator model or subsystem you would like to run in hardware. A model can be co-simulated if it meets the requirements of the underlying hardware board. The model must include a System Generator token; this block defines how the model should be compiled into hardware.
For information on how to use the System Generator token, see Compiling and Simulating Using the System Generator Token.
To compile your System Generator model for hardware co-simulation, perform the following:
- Double-click the System Generator token to
open the System Generator token dialog box.Figure 1. System Generator Token Dialog Box
- In the Compilation tab, select a
Board and a version of the board.
The boards appearing in the Board list are:
- All of the boards installed as part of the Vivado Design Suite.
- Any custom boards you have created in the Vivado Design Suite.
- Any Partner boards you have purchased and enabled in the Vivado Design Suite.
For a Partner board or a custom board to appear in the Board list, you must configure System Generator to access the board files that describe the board. Board awareness in System Generator is detailed in Specifying Board Support in System Generator.
To compile for hardware co-simulation, you must select a Board. You cannot set the Board field to None and select a Part instead of a Board.
When you select a Board, the Part field displays the name of the Xilinx device on the selected Board, and the Part setting cannot be changed.
- In the Compilation field, select
Hardware Co-Simulation and, where applicable,
select whether you will perform the hardware co-simulation using the JTAG interface or the Point-to-Point Ethernet interface.
If the Hardware Co-Simulation option is grayed out and disabled, you cannot perform JTAG hardware co-simulation on the selected board. Currently, you can perform a Point-to-Point Ethernet hardware co-simulation on the KC705 and the VC707 boards from Xilinx.
-
If you will use burst
mode for a faster hardware co-simulation run, click the Settings button next to the Compilation field, select Burst mode,
and enter a FIFO depth for the burst mode operation.
Then click OK to close the Hardware Co-Simulation
Settings dialog box.
For a description of the burst mode, see Burst Data Transfers for Hardware Co-Simulation.
Figure 2. Burst ModeImportant: To perform a burst mode hardware co-simulation, you must create a test bench by checking the Create Testbench box in the System Generator token dialog box. - If you want to create a test bench as part of the compilation,
select the Create Testbench option.
If you select Create Testbench, the compilation will automatically create an example test bench for you. You can also create your own test bench for hardware co-simulation (see M-Code Access to Hardware Co-Simulation).
- Click the Generate button.
The code generator produces an FPGA configuration bitstream for your design that is suitable for hardware co-simulation. System Generator not only generates the HDL and netlist files for your model during the compilation process, but it also runs the downstream tools necessary to produce an FPGA configuration file.
The configuration bitstream contains the hardware associated with your model, and also contains additional interfacing logic that allows System Generator to communicate with your design using a physical interface between the board and the PC. This logic includes a memory map interface over which System Generator can read and write values to the input and output ports on your design. It also includes any board-specific circuitry that is required for the target FPGA board to function correctly.
When the Compilation finishes the results are as follows:
- If you have not selected
Burst mode in step 4 above (standard mode),
a JTAG Cosim or Point-to-Point Ethernet hardware co-simulation block will appear in a
separate window. Drag (or Copy and Paste) the Hardware Cosim block into your Simulink model. The Hardware Cosim block will enable you
to perform hardware co-simulation from within the Simulink window.
For a description of the hardware co-simulation block, see Hardware Co-Simulation Blocks.
Figure 3. Hardware Co-Simulation Library BlockIf you selected the Create Testbench option for compilation, an M-Code HWCosim example test bench will also be generated (see M-Code Access to Hardware Co-Simulation) by the compilation. You can use this test bench to perform hardware co-simulation, or customize this test bench to develop a test bench of your own.
- If you have selected Burst mode in step 4 above (burst mode), no hardware
co-simulation block will appear. When you perform the burst mode co-simulation, you will
use the
MATLABĀ®
M-code test bench placed in the
target directory during compilation.
- If you compiled the top-level design the test bench will be
named:
<design_name>_hwcosim_test.m
- If you compiled a subsystem of the design the test bench will be
named:
<design_name>_<sub_system>_hwcosim_test.m
The compilation has prepared the Simulink model for performing hardware co-simulation.
To perform the hardware co-simulation, proceed as follows:
- To perform the standard (non-burst mode) hardware co-simulation, see Performing Standard Hardware Co-Simulation.
- To perform the burst mode hardware co-simulation, see Performing Burst Mode Hardware Co-Simulation.
- If you compiled the top-level design the test bench will be
named:
- If you have not selected
Burst mode in step 4 above (standard mode),
a JTAG Cosim or Point-to-Point Ethernet hardware co-simulation block will appear in a
separate window. Drag (or Copy and Paste) the Hardware Cosim block into your Simulink model. The Hardware Cosim block will enable you
to perform hardware co-simulation from within the Simulink window.