FIL Simulation with HDL Workflow Advisor for Simulink - MATLAB & Simulink (original) (raw)

Step 1: Start HDL Workflow Advisor

Follow instructions for invoking the HDL Workflow Advisor. See Getting Started with the HDL Workflow Advisor (HDL Coder).

Note

You must have an HDL Coder™ license to generate HDL code using the HDL Workflow Advisor.

Step 2: Set Target and Target Frequency

At step 1, Set Target, click 1.1 Set Target Device and Synthesis Tool and do the following:

  1. Select FPGA-in-the-Loop from the pull-down list atTarget workflow.
  2. Under Target platform, select a development board from the pull-down list. Family, Device, Package, and Speed are filled in by the HDL Workflow Advisor. If you have not yet downloaded an HDL Verifier™ FPGA board support package, select Get more boards. Then return to this step after you have downloaded an FPGA board support package.
  3. For Project folder, enter the folder name to save the project files into. The default is hdl_prj under the current working folder.

After you select a FIL target in Step 1.1, click 1.2 Set Target Frequency.

  1. Set the Target Frequency (MHz) for the clock speed of your design implemented on the FPGA. The available range of frequencies is shown in theFrequency Range (MHz) parameter. For Intel® boards and AMD® boards, Workflow Advisor checks the requested frequency against those possible for the requested board. If the requested frequency is not possible for this board, Workflow Advisor returns an error and suggests an alternate frequency. For AMD Vivado®-supported boards, or PCI Express® boards, Workflow Advisor cannot check the frequency. The synthesis tools make a best effort attempt at the requested frequency but might choose an alternate frequency if the specified frequency was not achievable. The default is 25 MHz.

Step 3: Prepare Model for HDL Code Generation

At step 2, Prepare Model for HDL Code Generation, perform step 2.1 as described in Prepare Model for HDL Code Generation Overview (HDL Coder).

In addition, perform step 2.2 Check FPGA-in-the-Loop Compatibility to verify that the model is compatible with FIL.

Note

If your HDL module includes a black box with a clock enable, you must clear theMinimize clock enable configuration parameter. For more information, see**Minimize clock enables (HDL Coder)**.

Step 4: HDL Code Generation

At step 3, HDL Code Generation, perform steps 3.1 and 3.2 as described in HDL Code Generation Overview (HDL Coder).

Step 5: Set FPGA-in-the-Loop Options

At step 4.1, Set FPGA-in-the-Loop Options, change these options if necessary:

FIL Options

Step 6: Set DUT I/O Ports

This step is enabled only when you select the free-running FPGA mode.

At step 4.2, Set DUT I/O Ports, the HDL Workflow Advisor parses the input and output ports of your DUT from the top file. It infers each port type from the HDL port name. Verify and modify the port type as needed.

Step 7: Generate FPGA Programming File, FIL Model, and Host Interface Script

At step 4.3 (4.2 for lockstep mode), Build FPGA-in-the-Loop, clickRun this task.

During the build process, the following actions occur:

Step 7: Load Programming File onto FPGA

Ensure your FPGA development board is set up, powered on, and connected to your machine as directed by the board manufacturer documentation. Then, perform the following steps to program the FPGA:

  1. Double-click the FIL block in your Simulink model to open the block mask.
  2. On the Main tab, click Load to download the programming file to the FPGA.
    The load process may take several minutes, depending on how large the subsystem is. For very large subsystems, the process can take an hour or longer.

Alternatively, you can use the generated host interface script,gs_ _`DUTName`__interface_fil.m, to program the FPGA.

For further troubleshooting tips, see Load Programming File onto FPGA.

Step 8: Run Simulation

In Simulink, on the Simulation tab, click Run. The results of the FIL simulation should match those of the Simulink reference model or of the original HDL code.

Note

Regarding initialization: Simulink starts from time 0 every time, which means the RAM in Simulink is initialized to zero. However, this is not true in hardware. If you have RAM in your design, the first simulation will match Simulink, but any subsequent runs may not match.

The workaround is to reload the FPGA bitstream before re-running the simulation. To do this, click Load on the FIL block mask.

See Also

Topics