See Vitis™ Development Environment on xilinx.com |
Use the AMD Vivado™ tools to create the hardware design for the ZCU104 AMD Vitis™ acceleration platform. Start from a ZCU104 preset design, add platform required peripherals, and configure them. After everything is set, export the hardware design to XSA.
-
Create workspace and Launch Vivado
Run the following commands on a Linux console.
source <Vivado_Install_Directory>/settings64.sh mkdir WorkSpace cd WorkSpace mkdir zcu104_hardware_platform #create directory for our step1 cd zcu104_hardware_platform vivado &
-
Create a Vivado project named zcu104_custom_platform.
-
Select File->Project->New, and click Next.
-
In Project Name dialog box, set Project name to zcu104_custom_platform. Uncheck Create project subdirectory, and click Next.
-
Enable Project is an extensible Vitis platform and click Next.
-
Select the Boards tab, then select Zynq UltraScale+ ZCU104 Evaluation Board, and click Next.
-
Review the project summary and click Finish.
Note: If you need to change an existing Vivado project to an extensible Vitis platform project, you can go to Settings in Flow Navigator in an opened Vivado design, go to General and enable project is an extensible Vitis platform
-
-
Create a block design.
- In Project Manager, under IP INTEGRATOR, select Create Block Design.
- (Optional) Change the design name to system.
- Click OK.
-
Add the AMD Zynq™ UltraScale+™ MPSoC IP and run block automation to configure it.
-
Right-click Diagram view, and select Add IP.
-
Search for
zynq
and then double-click the Zynq UltraScale+ MPSoC from the IP search results. -
Click the Run Block Automation link to apply the board presets.
-
In the Run Block Automation dialog, ensure the following is checked:
- All Automation
- Zynq_ultra_ps_e_0
- Apply Board Presets
-
Click OK. You should get MPSoC block configured like below:
-
What Just Happened?
At this stage, the Vivado block automation has added a Zynq UltraScale+ MPSoC block and applied all board presets for the ZCU104. The presets includes MPSoC PS side block configurations and pin assignments.
What to do for custom boards?
For a custom board, double-click MPSoC block and set up parameters according to the board hardware. Next, add the IP blocks and metadata to create a base hardware design that supports the acceleration kernels.
The V++ linker can automatically link the clock signals between kernel and platform. The available clock signals in the platform are exported by PFM.CLK property.
For simple designs, interrupt signals can be sourced by the processor's pl_clk. The limitation is that the processor has a maximum of four pl_clks
and their phase is not aligned.
To provide more interrupt signals, or to provide phase-aligned clocks, use the Clocking Wizard.
To add the Clocking Wizard to the block diagram and enable clock signals for the platform, follow these steps:
-
Add the clocking wizard block to generate three clocks:
-
Right-click Diagram view and select Add IP.
-
Search for and add a Clocking Wizard from the IP Search dialog box.
-
Double-click the clk_wiz_0 IP block to open the Re-Customize IP dialog box.
-
Click the Output Clocks tab.
-
Enable
clk_out1
throughclk_out3
in the Output Clock column. Set the Requested Output Freq as follows:- clk_out1 to 100 MHz.
- clk_out2 to 200 MHz.
- clk_out3 to 400 MHz.
-
At the bottom of the dialog box set the Reset Type to Active Low.
-
Click OK to close the dialog box.
Note: So now you have set up the clock system for your design. This clock wizard uses the
pl_clk
as input clock and generates clocks needed for the whole logic design. In this simple design, use a 100 MHz clock as theaxi_lite
control bus clock. 200 MHz and 400 MHz clocks are reserved for the DPU AXI interface clock and the DPU core clock during the design linking phase. You can modify the clock quantities and frequency to fit your target design. Before exporting the clock, you must create reset signals for each clock because they are needed in clock export setup.**
-
-
Add three Processor System Reset blocks corresponding to the three clocks:
- Right-click Diagram view and select Add IP.
- Search for and add a Processor System Reset from the IP Search dialog box.
- Rename the reset block to proc_sys_reset_1 so that it is easy to understand the relationship between reset modules and clock signals.
- Select the proc_sys_reset_1 block, type Ctrl-C and Ctrl-V to replicate two modules. They are named as proc_sys_reset_2 and proc_sys_reset_3, by default.
-
Connect Clocks and Resets:
-
Click Run Connection Automation to open a dialog box to connect the
proc_sys_reset
blocks to the clocking wizard clock outputs. -
Enable All Automation on the left side of the Run Connection Automation dialog box.
-
Select clk_in1 on
clk_wiz_0
, and set the Clock Source to /zynq_ultra_ps_e_0/pl_clk0. -
For each proc_sys_reset instance, select the slowest_sync_clk, and set the Clock Source as follows:
- proc_sys_reset_1 with /clk_wiz_0/clk_out1
- proc_sys_reset_2 with /clk_wiz_0/clk_out2
- proc_sys_reset_3 with /clk_wiz_0/clk_out3
-
On each
proc_sys_reset
instance, select ext_reset_in, set Board Part Interface to Custom and set the Select Manual Source to /zynq_ultra_ps_e_0/pl_resetn0. -
Make sure all checkboxes are enabled, and click OK to close the dialog and create the connections.
-
Connect all the dcm_locked signals on each
proc_sys_reset
instance to the locked signal on clk_wiz_0.
-
-
Enable clocks for the platform
-
Go to the Platform Setup tab.
If it does not open, use menu Window -> Platform Setup to open it.
-
Click the Clock tab.
-
Enable all clocks under
clk_wiz_0
: clk_out1, clk_out2, clk_out3. -
Change their ID to 1, 2, and 3.
-
Set a default clock, and click Is Default for clk_out2.
After everything is set up, it should report
Info: No problem with Clock interface
.Note: There should be one and only one default clock in the platform. During the v++ linking stage, the linker uses the default clock to connect the IP blocks if there are no user assignments for link configuration.
-
The V++ linker can automatically link the interrupt signals between kernel and platform. The available interrupt signals in the platform are exported by PFM.IRQ property.
For simple designs, interrupt signals can be sourced by processor's pl_ps_irq. The limitation is that it can only provide a maximum of 16 interrupt signals. To provide more interrupt signals, use AXI Interrupt Controller. You can also enable AXI HPM0 LPD to control the AXI Interrupt Controller. In the next steps, you have to add the AXI Interrupt Controller and enable interrupt signals for PFM.IRQ.
-
Enable AXI HPM0 LPD to control the AXI Interrupt Controller
-
In the block diagram, double-click the Zynq UltraScale+ MPSoC block.
-
Select PS-PL Configuration > PS-PL interfaces > Master interface.
-
Enable the AXI HPM0 LPD option.
-
Expand the arrow before AXI HPM0 LPD. Check the AXI HPM0 LPD Data width settings and keep it as default 32.
-
Disable AXI HPM0 FPD and AXI HPM1 FPD.
-
Click OK to finish the configuration.
Note:
- AXI HPM0 LPD is used mainly for controlling purposes. It reads and writes 32-bit control registers. If the interface has more than 32 bits, AXI Interconnect or SmartConnect will perform the AXI bus width conversion using PL logic. However, it would cost logic resource and introduce unnecessary latency.
- AXI HPM0 FPD and AXI HPM1 FPD are reserved for kernel usage. Disabling them from the block diagram can prevent auto connection using it by accident. Unused AXI interfaces can be exported in the Platform Setup, irrespective of its visibility in the block diagram.
-
-
Add the AXI Interrupt Controller and configure it.
- Right-click Diagram view and select Add IP, search and add AXI Interrupt Controller IP. It is instantiated as axi_intc_0.
- Double click the AXI Interrupt Controller block, change Interrupt Output Connection to Single so that it can be connected to PS IRQ interface.
- Click OK.
-
Connect AXI Interfaces of
axi_intc_0
to AXI HPM0 LPD of PS.- Click Run Connection Automation
- Review the settings (axi_intc_0 is enabled, s_axi is to be connect to /zynq_ultra_ps_e_0/M_AXI_HPM0_LPD).
- Set Clock Source for Slave Interface and Clock Source for Master Interface to /clk_wiz_0/clk_out2(200 MHz).
- Click OK.
Note: In this example, the interrupt controller and most kernel IRQ signals are synchronous to one clock for stability. It is okay to have asynchronous IRQ if kernels are running at different clocks. The interrupt controller can also handle asynchronous IRQ with level interrupt signals.
-
Connect IRQ of the Interrupt Controller by connecting axi_intc_0.irq to zynq_ultra_ps_e_0.pl_ps_irq[0:0]
Note: If you have more than one IRQ signals to connect to
pl_ps_irq
of PS, use a concat IP to concatenate them to a bus and then connect the bus topl_ps_irq
. -
Enable interrupt signals for the platform.
-
Go to Platform Setup tab.
-
Go to Interrupt tab.
-
Enable intr under
axi_intc_0
. -
Tcl console shows the corresponding
Tcl
command for this setup:set_property PFM.IRQ {intr { id 0 range 32 }} [get_bd_cells /axi_intc_0]
-
At this stage, the IPI design connection will look as shown in the following diagram:
-
Enable AXI Master interfaces from PS.
- Go to the Platform Setup tab.
- Go to AXI Port tab in Platform Setup.
- Under
zynq_ultra_ps_e_0
, enable M_AXI_HPM0_FPD and M_AXI_HPM1_FPD. Keep the Memport and sptag default to M_AXI_GP and empty.
Note:
- M_AXI_GP means general purpose AXI Master interface.
- sptag is only applicable to AXI slave interfaces.
- v++ linker will instantiate AXI Interconnect automatically to connect between PS AXI Master interfaces and slave interfaces of acceleration kernels. One AXI Master interface will connect up to 16 kernels.
-
Enable AXI Master interfaces from AXI Interconnect.
- Under ps8_0_axi_periph, click M01_AXI, press Shift and click M07_AXI to multi-select master interfaces from M01_AXI to M07_AXI.
- Right-click the selection and click on Enable.
- Keep the Memport and sptag default to M_AXI_GP and empty.
Note:
- v++ will not cascade another level of AXI Interconnect if the AXI master interface is exported from AXI Interconnect IP.
- AXI Master interfaces from PS and AXI Interconnect are functionally equivalent to the platform.
- In general, platform designer should export as many as AXI interfaces to the platform. Application developer should decide which interface to use.
-
Enable AXI Slave interfaces from PS to allow kernels access DDR memory.
- Under zynq_ultra_ps_e_0, multi-select all AXI slave interfaces: press Ctrl and click S_AXI_HPC0_FPD, S_AXI_HPC1_FPD, S_AXI_HP0_FPD, S_AXI_HP1_FPD, S_AXI_HP2_FPD, S_AXI_HP3_FPD.
- Right-click the selections and select enable.
- Change Memport of S_AXI_HPC0_FPD and S_AXI_HPC1_FPD to S_AXI_HP because any coherent features for these interfaces will not be used in this example.
- Type in simple sptag names for these interfaces so that they can be selected by v++ configuration during linking phase: HPC0, HPC1, HP0, HP1, HP2, HP3.
Note: This step is only required when creating an emulation-capable platform.
When a component comes with multiple types of simulation models, selecting a SystemC TLM (Transaction-level Modeling) model is recommended as it is faster than an RTL model. For Processing System component, it is mandatory to use TLM for Hardware Emulation.
-
Change PS simulation model to TLM.
-
Select the PS instance zynq_ultra_ps_e_0 in the block diagram
-
check the Block Properties window.
-
The Properties tab shows
ALLOWED_SIM_MODELS=tlm,rtl
. It means this component supports two types of simulation models.- Scroll down to
SELECTED_SIM_MODEL
property. Change it from rtl to tlm to select to use TLM model. - Notice the equivalent Tcl command shown in the Tcl console is:
set_property SELECTED_SIM_MODEL tlm [get_bd_cells /zynq_ultra_ps_e_0]
- Scroll down to
-
Note: This step is not mandatory for platform creation. Please refer to it according to your requirement.
If users need to modify the IP address in some cases please go through following steps.
- Check the location address space of your IP
- Go to address editor by clicking Window-> Address editor to open it.
Next, we will use the example of modifying the interrupt controller IP address to illustrate how to modify the IP address in the address editor.
-
As the interrupt controller is connected with M_AXI_HPM0_LPD domain, we need check LPD domain supported address space. Please check the ZYNQMP Technical Reference Manual. You could find following address range. That means the IP connected to LPD domain could be placed in 0x8000_0000-0x9FFF_FFFF address space. But conflict is not allowed.
-
Go to address editor, modify the interrupt controller IP base address according to your requirement.
Note: The modified base address should be in the LPD address space and the high address should also be in the LPD address space.
-
Validate the block design. by clicking the Validate Design button in the block design diagram window.
Note: During validation, Vivado reports a critical warning that /axi_intc_0/intr is not connected. This warning can be safely ignored because v++ linker will link kernel interrupt signals to this floating intr signal.
CRITICAL WARNING: [BD 41-759] The input pins (listed below) are either not connected or do not have a source port, and they don't have a tie-off specified. These pins are tied-off to all 0's to avoid error in Implementation flow. Please check your design and connect them as needed: /axi_intc_0/intr
-
Create a top module wrapper for the block design.
- In Source tab, right-click system.bd in Design Sources group.
- Select Create HDL Wrapper....
- Select Let Vivado manage wrapper and auto-update.
- Click OK to generate wrapper for block design.
-
Generate pre-synth design
- Select Generate Block Design from Flow Navigator
- Select Synthesis Options to Global. It will skip IP synthesis during generation.
- Click Generate. .
-
Generate Bitstream (Optional).
This step is optional for Vitis platforms. In most cases, a flat (non-DFX) Vitis platform does not need to generate bitstream before exporting the platform. You can execute this step after you understand its benefits and your requirements.
Generating bitstream will run through hardware design implementation for the platform. It can report errors in the early stage if your platform hardware design has potential errors that cannot be reported by the Validated Design DRC.
Here are the steps to generate bitstream:
- Click Generate Bitstream in the navigation window.
- Select a proper number of jobs for Launch runs on local host.
- Click OK to start building.
-
Export the platform.
In this step, export XSA for hardware design and hardware emulation separately. These XSA files are used in step 2.
Note: Vivado 2023.2 can still export XSA with both hardware and hardware emulation info. This feature will be deprecated in the future. In most real designs, due to the complexity of the design, some peripherals cannot be emulated, or does not need to emulate at a cycle accurate level. It is a common practice to provide a simplified hardware design for hardware emulation to reduce the emulation runtime.
- Click File -> Export -> Export Platform to launch the Export Hardware Platform wizard. This wizard can also be launched by Export Platform button in Flow Navigator or Platform Setup window.
- Click Next in the first information page.
- Select Platform Type: Hardware, click Next. If you skipped the emulation setup previously, select Hardware here.
- Select Platform State: Pre-synthesis
- (Optional) If you have generated bitstream in step4, enable Include bitstream, click Next.
- Input Platform Properties and click Next. For example,
- Name: zcu104_custom_platform
- Vendor: xilinx
- Board: zcu104
- Version: 0.0
- Description: This platform provides high PS DDR bandwidth and three clocks: 100MHz, 200MHz, and 400MHz.
- Fill in XSA file name: zcu104_custom_platform_hw and keep the export directory as default.
- Click Finish.
- zcu104_custom_platform_hw.xsa will be generated. The export path is reported in the Tcl console.
(Optional: Only for Hardware Emulation. If you skipped the emulation setup previously, please skip the following step.)
Rerun the Export Platform wizard again and export the XSA for hardware emulation.
Note: The same hardware and hardware emulation design is used for this simple project. You can use different Vivado designs for hardware and hardware emulation. Platform developers should keep the two designs logically identical. Otherwise your emulation result cannot represent your hardware design.
- Click File -> Export -> Export Platform to launch the Export Hardware Platform wizard. This wizard can also be launched by Export Platform button in Flow Navigator or Platform Setup window.
- Click Next in the first information page.
- Select Platform Type: Hardware Emulation, click Next.
- Select Platform State: Pre-synthesis, click Next.
- Input Platform Properties and click Next. For example,
- Name: zcu104_custom_platform
- Vendor: xilinx
- Board: zcu104
- Version: 0.0
- Description: This platform provides high PS DDR bandwidth and three clocks: 100MHz, 200MHz, and 400MHz.
- Fill in XSA file name: zcu104_custom_platform_hwemu and keep the export directory as default.
- Click Finish.
- zcu104_custom_platform_hwemu.xsa will be generated. The export path is reported in the Tcl console.
Alternatively, the above export can be done using Tcl scripts:
# Setting platform properties set_property platform.default_output_type "sd_card" [current_project] set_property platform.design_intent.embedded "true" [current_project] set_property platform.design_intent.server_managed "false" [current_project] set_property platform.design_intent.external_host "false" [current_project] set_property platform.design_intent.datacenter "false" [current_project] # Write pre-synthesis expandable XSA write_hw_platform -hw -force -file ./zcu104_custom_platform_hw.xsa write_hw_platform -hw_emu -force -file ./zcu104_custom_platform_hwemu.xsa
Scripts are provided to re-create projects and generate outputs. To use these scripts, run the following steps.
-
Run build:
# cd to the step directory, e.g. cd step1_vivado make all
-
To clean the generated files, run the following command:
make clean
This script creates the same design, generate block diagram and export XSA.
A top level all in one build script is also provided. To build everything (step 1 to step 3) with one command, go to ref_files directory and run the following command:
make all COMMON_IMAGE_ZYNQMP=<path/to/common_image/> #Specify the path of the common image
This command is to generate platform with pre-built software components and do software emulation by running vadd
application to test this platform:
make sd_card COMMON_IMAGE_ZYNQMP=<path/to/common_image/> #Specify the path of the common image
This command is to generate platform with pre-built software components and do hw test on board by running vadd
application to test this platform. To clean all the generated files, run the following command:
make clean
The Hardware platform creation flow is now complete. You can go to the Step2: Create Vitis Software platform.
Copyright © 2020–2024 Advanced Micro Devices, Inc