From 2a740d0c2b3abe3fd12b4681047d6a82282c5f7c Mon Sep 17 00:00:00 2001 From: Stanca Pop Date: Fri, 29 Oct 2021 18:26:52 +0300 Subject: [PATCH] ad7616_sdz: Add make env argument for interface Update system_project.tcl --- projects/ad7616_sdz/common/ad7616_bd.tcl | 9 ++- projects/ad7616_sdz/zc706/system_project.tcl | 56 ++++++++++-------- projects/ad7616_sdz/zed/system_project.tcl | 62 ++++++++++++-------- 3 files changed, 75 insertions(+), 52 deletions(-) diff --git a/projects/ad7616_sdz/common/ad7616_bd.tcl b/projects/ad7616_sdz/common/ad7616_bd.tcl index f51448186..f49745ac2 100644 --- a/projects/ad7616_sdz/common/ad7616_bd.tcl +++ b/projects/ad7616_sdz/common/ad7616_bd.tcl @@ -1,5 +1,8 @@ -global ad7616_if +# system level parameters +set SI_OR_PI $ad_project_params(SI_OR_PI) + +puts "build parameters: SI_OR_PI: $SI_OR_PI" # data interfaces @@ -22,7 +25,7 @@ create_bd_port -dir I rx_busy # instantiation ad_ip_instance axi_ad7616 axi_ad7616 -ad_ip_parameter axi_ad7616 CONFIG.IF_TYPE $ad7616_if +ad_ip_parameter axi_ad7616 CONFIG.IF_TYPE $SI_OR_PI ad_ip_instance axi_dmac axi_ad7616_dma ad_ip_parameter axi_ad7616_dma CONFIG.DMA_TYPE_SRC 2 @@ -33,7 +36,7 @@ ad_ip_parameter axi_ad7616_dma CONFIG.DMA_DATA_WIDTH_SRC 16 ad_ip_parameter axi_ad7616_dma CONFIG.DMA_DATA_WIDTH_DEST 64 # interface connections -if {$ad7616_if == 0} { +if {$SI_OR_PI == 0} { ad_connect rx_sclk axi_ad7616/rx_sclk ad_connect rx_sdo axi_ad7616/rx_sdo diff --git a/projects/ad7616_sdz/zc706/system_project.tcl b/projects/ad7616_sdz/zc706/system_project.tcl index e548e4ed8..55ae7a467 100644 --- a/projects/ad7616_sdz/zc706/system_project.tcl +++ b/projects/ad7616_sdz/zc706/system_project.tcl @@ -6,7 +6,15 @@ source $ad_hdl_dir/projects/scripts/adi_board.tcl ##-------------------------------------------------------------- # IMPORTANT: Set AD7616 operation and interface mode # -# ad7616_if - Defines the interface type (serial OR parallel) +# The get_env_param procedure retrieves parameter value from the environment if exists, +# other case returns the default value specified in its second parameter field. +# +# How to use over-writable parameters from the environment: +# +# e.g. +# make SI_OR_PI=0 +# +# SI_OR_PI - Defines the interface type (serial OR parallel) # # LEGEND: Serial - 0 # Parallel - 1 @@ -16,31 +24,33 @@ source $ad_hdl_dir/projects/scripts/adi_board.tcl # ##-------------------------------------------------------------- -set ad7616_if 0 +if {[info exists ::env(SI_OR_PI)]} { + set S_SI_OR_PI [get_env_param SI_OR_PI 0] +} elseif {![info exists SI_OR_PI]} { + set S_SI_OR_PI 0 +} -adi_project ad7616_sdz_zc706 +adi_project ad7616_sdz_zc706 0 [list \ + SI_OR_PI $S_SI_OR_PI \ +] -if { $ad7616_if == 0 } { - - adi_project_files ad7616_sdz_zc706 [list \ - "$ad_hdl_dir/library/common/ad_iobuf.v" \ - "system_top_si.v" \ - "serial_if_constr.xdc" \ - "$ad_hdl_dir/projects/common/zc706/zc706_system_constr.xdc"] - -} elseif { $ad7616_if == 1 } { - - adi_project_files ad7616_sdz_zc706 [list \ - "$ad_hdl_dir/library/common/ad_iobuf.v" \ - "system_top_pi.v" \ - "parallel_if_constr.xdc" \ - "$ad_hdl_dir/projects/common/zc706/zc706_system_constr.xdc"] - -} else { - - return -code error [format "ERROR: Invalid interface type! Define as \'serial\' or \'parallel\' ..."] +adi_project_files ad7616_sdz_zc706 [list \ + "$ad_hdl_dir/library/common/ad_iobuf.v" \ + "$ad_hdl_dir/projects/common/zc706/zc706_system_constr.xdc"] +switch $S_SI_OR_PI { + 0 { + adi_project_files ad7616_sdz_zc706 [list \ + "system_top_si.v" \ + "serial_if_constr.xdc" + ] + } + 1 { + adi_project_files ad7616_sdz_zc706 [list \ + "system_top_pi.v" \ + "parallel_if_constr.xdc" + ] + } } adi_project_run ad7616_sdz_zc706 - diff --git a/projects/ad7616_sdz/zed/system_project.tcl b/projects/ad7616_sdz/zed/system_project.tcl index db124d690..a7c357677 100644 --- a/projects/ad7616_sdz/zed/system_project.tcl +++ b/projects/ad7616_sdz/zed/system_project.tcl @@ -6,7 +6,15 @@ source $ad_hdl_dir/projects/scripts/adi_board.tcl ##-------------------------------------------------------------- # IMPORTANT: Set AD7616 operation and interface mode # -# ad7616_if - Defines the interface type (serial OR parallel) +# The get_env_param procedure retrieves parameter value from the environment if exists, +# other case returns the default value specified in its second parameter field. +# +# How to use over-writable parameters from the environment: +# +# e.g. +# make SI_OR_PI=0 +# +# SI_OR_PI - Defines the interface type (serial OR parallel) # # LEGEND: Serial - 0 # Parallel - 1 @@ -16,31 +24,33 @@ source $ad_hdl_dir/projects/scripts/adi_board.tcl # ##-------------------------------------------------------------- -set ad7616_if 0 - -adi_project ad7616_sdz_zed - -if { $ad7616_if == 0 } { - - adi_project_files ad7616_sdz_zed [list \ - "$ad_hdl_dir/library/common/ad_iobuf.v" \ - "system_top_si.v" \ - "serial_if_constr.xdc" \ - "$ad_hdl_dir/projects/common/zed/zed_system_constr.xdc"] - -} elseif { $ad7616_if == 1 } { - - adi_project_files ad7616_sdz_zed [list \ - "$ad_hdl_dir/library/common/ad_iobuf.v" \ - "system_top_pi.v" \ - "parallel_if_constr.xdc" \ - "$ad_hdl_dir/projects/common/zed/zed_system_constr.xdc"] - -} else { - - return -code error [format "ERROR: Invalid interface type! Define as \'serial\' or \'parallel\' ..."] - +if {[info exists ::env(SI_OR_PI)]} { + set S_SI_OR_PI [get_env_param SI_OR_PI 0] +} elseif {![info exists SI_OR_PI]} { + set S_SI_OR_PI 0 } -adi_project_run ad7616_sdz_zed +adi_project ad7616_sdz_zed 0 [list \ + SI_OR_PI $S_SI_OR_PI \ +] +adi_project_files ad7616_sdz_zed [list \ + "$ad_hdl_dir/library/common/ad_iobuf.v" \ + "$ad_hdl_dir/projects/common/zed/zed_system_constr.xdc"] + +switch $S_SI_OR_PI { + 0 { + adi_project_files ad7616_sdz_zed [list \ + "system_top_si.v" \ + "serial_if_constr.xdc" + ] + } + 1 { + adi_project_files ad7616_sdz_zed [list \ + "system_top_pi.v" \ + "parallel_if_constr.xdc" + ] + } +} + +adi_project_run ad7616_sdz_zed