UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
1,154 Views
Registered: ‎02-16-2017

Creating a RTL kernel Vivado project with tcl

Jump to solution

I'm working with SDX 2017.2. The tool has a "Create RTL Kernel" wizard, which sets up a Vivado project for a specific SDAccel target platform with a stub containing correct interfaces to the SDAccel infrastructure.

 

In Vivado, using the GUI reports the corresponding tcl-commands in the console.

This does not seem to be the case in SDx (at least not when using the wizard).

 

I've been able to extract the Vivado commands called after the project is created, for example:

 

create_ip -name sdx_kernel_wizard -vendor xilinx.com -library ip -version 1.0 -module_name ${KERNEL_NAME} 
set_property -dict [list CONFIG.NUM_INPUT_ARGS {2} CONFIG.ARG00_NAME {${KERNEL_ARGNAME_0}} CONFIG.ARG01_NAME {${KERNEL_ARGNAME_1}} CONFIG.NUM_M_AXI {2} CONFIG.M00_AXI_NUM_ARGS {1} CONFIG.M00_AXI_ARG00_NAME {gmem0} CONFIG.M01_AXI_NUM_ARGS {1} CONFIG.M01_AXI_ARG00_NAME {gmem1} CONFIG.KERNEL_NAME {${KERNEL_NAME}}] [get_ips ${KERNEL_NAME}]
generate_target {instantiation_template} [get_files ${KERNEL_PROJECT_DIR}/src/sdx_rtl_kernel_wizard/sdx_rtl_kernel_wizard.srcs/sources_1/ip/${KERNEL_NAME}/${KERNEL_NAME}.xci]
set_property generate_synth_checkpoint false [get_files ${KERNEL_PROJECT_DIR}/src/sdx_rtl_kernel_wizard/sdx_rtl_kernel_wizard.srcs/sources_1/ip/${KERNEL_NAME}/${KERNEL_NAME}.xci]
generate_target all [get_files ${KERNEL_PROJECT_DIR}/src/sdx_rtl_kernel_wizard/sdx_rtl_kernel_wizard.srcs/sources_1/ip/${KERNEL_NAME}/${KERNEL_NAME}.xci]
export_ip_user_files -of_objects [get_files ${KERNEL_PROJECT_DIR}/src/sdx_rtl_kernel_wizard/sdx_rtl_kernel_wizard.srcs/sources_1/ip/${KERNEL_NAME}/${KERNEL_NAME}.xci] -no_script -sync -force -quiet

This is however not enough, as vanilla Vivado does not seem to recognize the sdx_kernel_wizard IP.

 

How do I create a Vivado project with a RTL kernel stub as generated by the SDx kernel wizard?

 

Many thanks :-)

0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
1,651 Views
Registered: ‎02-16-2017

Re: Creating a RTL kernel Vivado project with tcl

Jump to solution

Okay, here goes. The missing piece was that I had to use the Vivado that ships with SDx, otherwise the SDx kernel wizard doesn't exist.

The below successfully generates a project called "my_kernel_ex" in the specified directory with the SDx kernel stub according to the documenation.

 

# Implemented according to:
# https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_2/ug1023-sdaccel-user-guide.pdf

# Configuration variables
set kernelName my_kernel 
set workspace my_workspace
set kernelVendor my_company
set partName xcku115-flvb2104-2-e

# Internal 
set kernelPrjName ${kernelName}_ex
set wizardDir $workspace/kernel_wizard
set kernelDir $workspace/$kernelPrjName

# We first create a dummy project for the kernel wizard, which will create the
# actual kernel project
create_project kernel_wizard $wizardDir -part $partName -force

# Instantiate the SDx kernel wizard IP
create_ip -name sdx_kernel_wizard -vendor xilinx.com -library ip -module_name $kernelName 

# We have to first write the command to a string so the variables are expanded,
# otherwise the variable names (rather than their content) are written to the
# generated tcl files, and the example project will fail.
set cmd "set_property -dict \[list CONFIG.NUM_INPUT_ARGS {2} CONFIG.ARG00_NAME {arg0} CONFIG.ARG01_NAME {arg1} CONFIG.NUM_M_AXI {2} CONFIG.M00_AXI_NUM_ARGS {1} CONFIG.M00_AXI_ARG00_NAME {gmem0} CONFIG.M01_AXI_NUM_ARGS {1} CONFIG.M01_AXI_ARG00_NAME {gmem1} CONFIG.KERNEL_NAME {$kernelName} CONFIG.KERNEL_VENDOR {$kernelVendor}] \[get_ips $kernelName]"
# Configure for correct OpenCL input arguments, including memory interfaces.
eval $cmd

set kernelXci $wizardDir/kernel_wizard.srcs/sources_1/ip/$kernelName/$kernelName.xci

# Generate kernel wizard IP core
generate_target {instantiation_template} [get_files $kernelXci]
set_property generate_synth_checkpoint false [get_files $kernelXci]
generate_target all [get_files $kernelXci]

# Reopen project to generate cache
close_project
open_project $wizardDir/kernel_wizard.xpr

# Export files (potentially a lot of things can be removed here)
export_ip_user_files -of_objects [get_files $kernelXci] -no_script -sync -force -quiet
export_simulation -of_objects [get_files $kernelXci] -directory $wizardDir/kernel_wizard.ip_user_files/sim_scripts -ip_user_files_dir $wizardDir/kernel_wizard.ip_user_files -ipstatic_source_dir $wizardDir/kernel_wizard.ip_user_files/ipstatic -lib_map_path [list {modelsim=$wizardDir/kernel_wizard.cache/compile_simlib/modelsim} {questa=$wizardDir/kernel_wizard.cache/compile_simlib/questa} {ies=$wizardDir/kernel_wizard.cache/compile_simlib/ies} {vcs=$wizardDir/kernel_wizard.cache/compile_simlib/vcs} {riviera=$wizardDir/kernel_wizard.cache/compile_simlib/riviera}] -use_ip_compiled_libs -force -quiet

# The IP will generate a script to generate the example project, which we now
# source. This implicitly closes the wizard project and opens the kernel
# project instead
open_example_project -force -dir $workspace [get_ips $kernelName]

# Close and clean up wizard project
close_project
file delete -force $wizardDir

View solution in original post

0 Kudos
2 Replies
Adventurer
Adventurer
1,153 Views
Registered: ‎02-16-2017

Re: Creating a RTL kernel Vivado project with tcl

Jump to solution
Correction (still no support for editing posts it seems):
How do I create a Vivado project with an RTL kernel stub as generated by the SDx kernel wizard *exclusively using the command line*, using one or more tcl/bash scripts?
0 Kudos
Adventurer
Adventurer
1,652 Views
Registered: ‎02-16-2017

Re: Creating a RTL kernel Vivado project with tcl

Jump to solution

Okay, here goes. The missing piece was that I had to use the Vivado that ships with SDx, otherwise the SDx kernel wizard doesn't exist.

The below successfully generates a project called "my_kernel_ex" in the specified directory with the SDx kernel stub according to the documenation.

 

# Implemented according to:
# https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_2/ug1023-sdaccel-user-guide.pdf

# Configuration variables
set kernelName my_kernel 
set workspace my_workspace
set kernelVendor my_company
set partName xcku115-flvb2104-2-e

# Internal 
set kernelPrjName ${kernelName}_ex
set wizardDir $workspace/kernel_wizard
set kernelDir $workspace/$kernelPrjName

# We first create a dummy project for the kernel wizard, which will create the
# actual kernel project
create_project kernel_wizard $wizardDir -part $partName -force

# Instantiate the SDx kernel wizard IP
create_ip -name sdx_kernel_wizard -vendor xilinx.com -library ip -module_name $kernelName 

# We have to first write the command to a string so the variables are expanded,
# otherwise the variable names (rather than their content) are written to the
# generated tcl files, and the example project will fail.
set cmd "set_property -dict \[list CONFIG.NUM_INPUT_ARGS {2} CONFIG.ARG00_NAME {arg0} CONFIG.ARG01_NAME {arg1} CONFIG.NUM_M_AXI {2} CONFIG.M00_AXI_NUM_ARGS {1} CONFIG.M00_AXI_ARG00_NAME {gmem0} CONFIG.M01_AXI_NUM_ARGS {1} CONFIG.M01_AXI_ARG00_NAME {gmem1} CONFIG.KERNEL_NAME {$kernelName} CONFIG.KERNEL_VENDOR {$kernelVendor}] \[get_ips $kernelName]"
# Configure for correct OpenCL input arguments, including memory interfaces.
eval $cmd

set kernelXci $wizardDir/kernel_wizard.srcs/sources_1/ip/$kernelName/$kernelName.xci

# Generate kernel wizard IP core
generate_target {instantiation_template} [get_files $kernelXci]
set_property generate_synth_checkpoint false [get_files $kernelXci]
generate_target all [get_files $kernelXci]

# Reopen project to generate cache
close_project
open_project $wizardDir/kernel_wizard.xpr

# Export files (potentially a lot of things can be removed here)
export_ip_user_files -of_objects [get_files $kernelXci] -no_script -sync -force -quiet
export_simulation -of_objects [get_files $kernelXci] -directory $wizardDir/kernel_wizard.ip_user_files/sim_scripts -ip_user_files_dir $wizardDir/kernel_wizard.ip_user_files -ipstatic_source_dir $wizardDir/kernel_wizard.ip_user_files/ipstatic -lib_map_path [list {modelsim=$wizardDir/kernel_wizard.cache/compile_simlib/modelsim} {questa=$wizardDir/kernel_wizard.cache/compile_simlib/questa} {ies=$wizardDir/kernel_wizard.cache/compile_simlib/ies} {vcs=$wizardDir/kernel_wizard.cache/compile_simlib/vcs} {riviera=$wizardDir/kernel_wizard.cache/compile_simlib/riviera}] -use_ip_compiled_libs -force -quiet

# The IP will generate a script to generate the example project, which we now
# source. This implicitly closes the wizard project and opens the kernel
# project instead
open_example_project -force -dir $workspace [get_ips $kernelName]

# Close and clean up wizard project
close_project
file delete -force $wizardDir

View solution in original post

0 Kudos