main content

fpga programming and configuration on speedgoat simulink-凯发k8网页登录

this example shows how to implement a simulink® algorithm on a speedgoat® simulink-programmable i/o module by using the hdl workflow advisor. you run the simulink real-time fpga io workflow to:

  1. specify an fpga i/o module and its interfaces.

  2. synthesize the simulink algorithm for fpga programming.

  3. generate a simulink® real-time™ interface subsystem model.

the interface subsystem model contains blocks to program the fpga and communicate with the fpga module through the pcie bus during real-time application execution. you add the generated subsystem to your simulink real-time domain model.

this example uses the speedgoat io397-50k module. see .

setup and configuration

before deploying your algorithm on the speedgoat io module:

1. install the latest version of xilinx® vivado® as listed in .

then, set the tool path to the installed xilinx vivado executable by using the function.

hdlsetuptoolpath('toolname','xilinx vivado','toolpath','c:\xilinx\vivado\2019.2\bin\vivado.bat')

2. for real-time simulation, set up the development environment and target computer settings. see get started with simulink real-time (simulink real-time).

3. install the speedgoat library and the speedgoat hdl coder integration packages. see .

hdl workflow advisor

the hdl workflow advisor guides you through hdl code generation and the fpga design process. use the advisor to:

  • check the model for hdl code generation compatibility and fix incompatible settings.

  • generate hdl code, test bench, and scripts to build and run the code and test bench.

  • perform synthesis and timing analysis.

  • deploy the generated code on socs, fpgas, and speedgoat i/o modules.

to open the hdl workflow advisor for a subsystem inside the model, use the function.

load_system('sschdlextwolevelconverterigbtexample')
hdladvisor('sschdlextwolevelconverterigbtexample/simscape_system')

the left pane of the advisor contains folders that represent a group of related tasks. expanding the folders and selecting a task displays information about that task in the right pane. the right pane contains simple controls for running the task to advanced parameters and option settings that control hdl code and test bench generation. to learn more about each task, right-click that task, and select what's this?. see getting started with the hdl workflow advisor.

simulink loopback domain model

this model is your fpga domain model. it represents the simulation sample rate of the clock on your fpga board. the loopback subsystem contains the algorithm to load on the fpga. the data type and the number of input and output lines of the model are configured to fit the speedgoat io397-50k platform.

open_system('hdlcoder_slrt_loopback')
set_param('hdlcoder_slrt_loopback', 'simulationcommand', 'update')

generate simulink real-time interface model for speedgoat io397 platform

1. open the hdl workflow advisor for the loopback subsystem. this subsystem is loaded on the fpga.

hdladvisor('hdlcoder_slrt_loopback/loopback')

2. expand the set target folder. in the set target device and synthesis tool task, specify target workflow as simulink real-time fpga i/o and target platform as speedgoat io397-50k. right-click the set target reference design task and select run to selected task.

3. in the set target interface task, map ports hwin and hwout to io397_ttl [0:13] and pciread c0-c4 and pciwrite c0-c4 to pcie interface. click run this task.

4. run the set target frequency task with the default value set for target frequency (mhz). the target frequency must be in the range frequency range (mhz).

5. expand the download to target task. right-click the generate simulink real-time interface task and select run to selected task.

this task generates rtl code and ip core, fpga bitstream, and the simulink real-time interface model. in the create project task, open the vivado project to see the implemented block design.

real-time subsystem integration and execution

after the generate simulink real-time interface task passes, click the link to open the simulink real-time interface model.

the simulink-real time interface model contains a masked subsystem that has the same name as the subsystem in the simulink fpga domain model. this subsystem is the simulink real-time interface subsystem that contains the algorithm which is loaded onto the fpga. use the generated simulink real-time interface model or create a simulink real-time domain model and copy the simulink real-time interface subsystem into that model to simulate your fpga algorithm on the speedgoat target machine.

in the simulink real-time interface subsystem mask, set three parameters:

  • device index

  • pci slot

  • sample time

when the target has a single fpga i/o board, leave the device index to the default value. for multiple fpga i/o boards, specify a unique device index. if two or more boards are of the same type, specify the pci slot for each board.

for real-time testing, you can log the signals and view the simulation results on the simulation data inspector.

  1. on the real-time tab, open the simulink real-time explorer and specify the target interface connection settings. for an example, see hardware-in-the-loop implementation of simscape model on speedgoat fpga i/o modules.

  2. on the real-time tab, click run on target to build and download the simulink real-time application. the real-time application loads onto the speedgoat target machine and the fpga algorithm bitstream loads onto the fpga.

you can then view the simulation results on the simulation data inspector.

related topics

    网站地图