|
1 | 1 |
|
2 | 2 | # HDL Targeting with HDL-Coder |
3 | 3 |
|
4 | | -Transceiver Toolbox supports the IP Core generation flow from MathWorks which allows for automated integration of DSP into HDL reference designs from Analog Devices. This workflow will take Simulink subsystems, run HDL-Coder to generate source Verilog, and then integrate that into a larger reference design. The figure below is a simplified block diagram of a SoC (Fabric+ARM) device, where specialized IP are inserted into the receive and transmit datapaths. This is supported on specific FPGA families and transceiver based reference designs. This support is based on the Zynq HDL-Coder and support |
| 4 | +Transceiver Toolbox supports the IP Core generation flow from MathWorks which allows for automated integration of DSP into HDL reference designs from Analog Devices. This workflow will take Simulink subsystems, run HDL-Coder to generate source Verilog, and then integrate that into a larger reference design. The figure below is a simplified block diagram of a SoC (Fabric+ARM) device, where specialized IP are inserted into the receive and transmit datapaths. This is supported on specific FPGA families and transceiver based reference designs, and is built on the Zynq HDL-Coder workflow and the HDL Coder Support Package for Xilinx Zynq Platform. |
5 | 5 |
|
6 | | -<img src="/_static/assets/MATLAB_HDL_Ref_Design.png"> |
| 6 | +```{figure} /_static/assets/MATLAB_HDL_Ref_Design.png |
| 7 | +
|
| 8 | +Simplified block diagram of a SoC (FPGA fabric + ARM) device. Simulink-generated IP is inserted into the receive and transmit datapaths of an ADI reference design. |
| 9 | +``` |
7 | 10 |
|
8 | 11 | ## Recommended Review |
9 | 12 |
|
10 | 13 | - [Getting started with Zynq](https://www.mathworks.com/support/search.html/videos/getting-started-with-zynq-80338.html?fq%5B%5D=asset_type_name:video&fq%5B%5D=category:hdlcoder/index&page=1) |
11 | 14 |
|
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Targeting requires the HDL generation dependencies described in [Installation](install.md): |
| 18 | + |
| 19 | +- Xilinx Vivado and Vitis, version matched to your toolbox release (for example, Vivado/Vitis 2022.2 for the R2023b-based release) |
| 20 | +- Simulink, [HDL Coder™](https://www.mathworks.com/products/hdl-coder.html), and the [HDL Coder™ Support Package for Xilinx Zynq Platform](https://www.mathworks.com/matlabcentral/fileexchange/40447-hdl-coder-support-package-for-xilinx-zynq-platform) |
| 21 | + |
| 22 | +Targeting is only available for specific transceiver and FPGA carrier combinations. See the support table on the [home page](index.md) — the **Targeting** column lists the boards and minimum releases that support this flow. |
| 23 | + |
12 | 24 | ## Getting Started |
| 25 | + |
| 26 | +The targeting flow takes a Simulink subsystem (your DSP "DUT"), runs HDL Coder to generate Verilog, and integrates it into an ADI HDL reference design to produce a bitstream you can run on hardware. The steps below outline the user-facing workflow. For a detailed look at what happens internally — the generated TCL scripts, net trimming, and IP insertion — see [HDL Workflow](dev_hdl_workflow.md). |
| 27 | + |
| 28 | +### 1. Point MATLAB at your Xilinx tools |
| 29 | + |
| 30 | +Register Vivado with HDL Coder so it can drive the build. Adjust the path for your installation: |
| 31 | + |
| 32 | +```matlab |
| 33 | +hdlsetuptoolpath('ToolName','Xilinx Vivado', ... |
| 34 | + 'ToolPath','/opt/Xilinx/Vivado/2022.2/bin/vivado'); |
| 35 | +``` |
| 36 | + |
| 37 | +### 2. Open a model |
| 38 | + |
| 39 | +Start from one of the worked examples under `trx_examples/targeting/`: |
| 40 | + |
| 41 | +- `frequency-hopping` — frequency hopping on the ADRV9361-Z7035 |
| 42 | +- `loopback-delay-estimation` — loopback delay estimation |
| 43 | +- `tuneAGC-ad9361` — AGC tuning for the AD9361 |
| 44 | + |
| 45 | +or create your own model. The portion of the algorithm to be implemented in fabric must live in a single subsystem (the **HDL DUT**), with its inputs and outputs mapped to the transceiver datapath (for example, the AD9361 ADC/DAC data and valid interfaces). |
| 46 | + |
| 47 | +### 3. Select a reference design |
| 48 | + |
| 49 | +Open the HDL Workflow Advisor on your DUT subsystem (right-click the subsystem → **HDL Code → HDL Workflow Advisor**, or run `hdladvisor`). Set: |
| 50 | + |
| 51 | +- **Target workflow:** IP Core Generation |
| 52 | +- **Synthesis tool:** Xilinx Vivado |
| 53 | +- **Reference design:** the ADI design matching your board and datapath — Rx, Tx, or Rx & Tx (for example, *AnalogDevices ADRV9361-Z7035*) |
| 54 | + |
| 55 | +Each supported board registers its reference designs through the HDL Coder board and reference-design plugins shipped with the toolbox under `hdl/vendor/AnalogDevices/+AnalogDevices/`. |
| 56 | + |
| 57 | +### 4. Generate IP, build, and (optionally) program |
| 58 | + |
| 59 | +Step through the Workflow Advisor tasks. HDL Coder will: |
| 60 | + |
| 61 | +1. generate Verilog from your DUT subsystem, |
| 62 | +2. build the reference-design Vivado project and trim the nets where your IP will be inserted, |
| 63 | +3. insert and connect your generated IP, and |
| 64 | +4. run synthesis and generate the bitstream. |
| 65 | + |
| 66 | +To re-run the workflow without re-entering settings, use a workflow script. The examples ship a generated `hdlworkflow.m` for exactly this — it configures an `hdlcoder.WorkflowConfig` and calls `hdlcoder.runWorkflow`: |
| 67 | + |
| 68 | +```matlab |
| 69 | +hWC = hdlcoder.WorkflowConfig('SynthesisTool','Xilinx Vivado', ... |
| 70 | + 'TargetWorkflow','IP Core Generation'); |
| 71 | +hWC.ProjectFolder = 'hdl_prj'; |
| 72 | +hWC.RunTaskGenerateRTLCodeAndIPCore = true; |
| 73 | +hWC.RunTaskCreateProject = true; |
| 74 | +hWC.RunTaskBuildFPGABitstream = true; |
| 75 | +hWC.RunTaskProgramTargetDevice = false; % set true to program the board |
| 76 | +hdlcoder.runWorkflow('frequency_hopping/HDL_DUT', hWC, 'Verbosity', 'on'); |
| 77 | +``` |
| 78 | + |
| 79 | +Once built, the bitstream and supporting files can be loaded onto the target (see [Connecting To Hardware](install.md)). |
0 commit comments