export custom reference design from soc model
you can use the function to generate a reference design from an soc blockset™ model and avoid the manual steps required to generate and register a custom reference design. the function generates these artifacts.
board registration files
reference design registration file
ip repository
design files
constraint files
soc models can be one of these types.
an soc model with an fpga, memory, and optional i/o (no processor)
an soc model with a processor, fpga, memory, and optional i/o
create soc model of system
when exporting a custom reference design from an soc model, the reference design does not include the design under test (dut) and the interface to the dut is exposed. after generating the reference design, you can integrate your custom ip by using the hdl workflow advisor tool. your custom ip must have the same interface as the fpga algorithm block.
to export a custom reference design, first create an soc model to model the system and the i/o available on your board. to create an soc blockset model, use one of these methods.
create a model by using an soc blockset template (recommended). for more information, see use template to create soc model.
build an soc model from scratch. for more information, see .
include a dut subsystem in the model. this subsystem must have the same interface as the ip core that you are developing. because the generated reference design does not include the dut subsystem, the dut can be a simple model or just a pass-through block.
prepare soc model for reference design export
you can use the soc axi manager feature in the exported reference design to interact with the soc device from the host. in simulink®, open the configuration parameters dialog box by clicking model settings on the modeling tab, and on the left pane, select hardware implementation. then, expand target hardware resources, select fpga design (top-level), and then select include 'axi manager' ip for host-based interaction.
in the ip core clock frequency (mhz) box, specify the ip core clock frequency in mhz.
to ensure that your soc model supports code generation, use the tool to generate executables and deploy your model. for more information about the soc builder tool, see .
for an example showing this workflow on an fpga-only case, see export custom reference design.
additional preparation when soc model includes processor
a device tree (dt) is a data structure that describes the hardware to the operating system. when you add an ip to the design, you should generate a new device tree so that the operating system can access the ip.
if your model contains both fpga and processor subsystems, these additional steps are required before exporting the reference design.
in the configuration parameters , click hardware implementation on the left. then, expand target hardware resources, and select include processing system in fpga design (top-level).
run the soc builder tool, follow the guided steps for code generation, and then load the binaries to the fpga. this step is required because soc builder automatically generates a device tree file (
.dtb
) on the sd card namedhdlcoder_rd/soc_prj.output.dtb
and a software model with matching device names.copy the device tree file from the folder
hdlcoder_rd
to the root folder of the sd card. in the generatedplugin_rd.m
file, the custom device tree file is specified as:hrd.devicetreename = 'soc_prj.output.dtb';
execute socexportreferencedesign
function
export the custom reference design for your model by using the
socexportreferencedesign
function. for example, for a model
named soc_image rotation
, enter this code at the matlab® command prompt.
socexportreferencedesign('soc_image_rotation')
the function generates these artifacts in the current folder.
board registration files
reference design registration file
ip repository
design files
constraint files
integrate ip core into generated reference design
add the generated folder to the matlab path. use the hdl workflow advisor tool to guide you through the steps for integrating your ip and generating hardware and software executables for deployment on an soc device.
for an example showing the full workflow on an fpga-only case, see export custom reference design. if your model includes a processing system, these additional steps are required when using the hdl workflow advisor tool.
in simulink, right-click the dut block that you want to integrate into the reference design, and select hdl code > hdl workflow advisor to open the hdl workflow advisor tool. alternatively, use the (hdl coder) function.
in step 1.1, set target workflow to
ip core generation
and target platform to the platform generated by thesocexportreferencedesign
function.click run this task to run the set target device and synthesis tool task.
in step 1.3, set the target interface by connecting each port in your ip to the corresponding port in the reference design.
click run this task to run the set target interface task.
continue with the remaining steps of the hdl workflow advisor tool.
optional: in step 4.2, you can choose to generate a software interface model with ip core driver blocks (requires an embedded coder® license). if you choose to generate this software interface model, clear skip this task under generate a software interface model with ip core driver blocks for c code generation.
for more information, see the section titled "generate a software interface model" in (hdl coder).
the generated software interface model contains axi driver blocks that match the interface of the dut subsystem. the device name is set to
'/dev/mwipcore'
by default. change the device name in these axi driver blocks to match the in the device tree file used by the sd card image.there are several ways to find the device name:
the device name is derived from the dut name of the soc model. if you export a reference design using an soc model with the dut name specified as
'soc_hwsw_stream_fpga/fpga algorithm wrapper'
, the generated device name in the axi driver blocks is'/dev/mwfpga_algorithm_wrapper_ip0'
.find the device name in your operating system (os) image after booting the soc device. to do that, login to the board using uart or ssh protocols, and execute:
for example:ls/dev
in step 4.4, set programming method to download.
when the hdl workflow advisor tool is done building, it returns a generated bitstream file. program the fpga with the generated bitstream file.
you can now deploy the software interface model in standalone mode, or use it in external mode to interact with the soc device. for an example, see the section titled "run the software interface model on zynq zc702 hardware" in (hdl coder).
see also
related topics
- (hdl coder)
- export custom reference design
- getting started with the hdl workflow advisor (hdl coder)