From fec4137046df999d7b00aa0dc950ce639a4b9f5a Mon Sep 17 00:00:00 2001 From: Iacob_Liviu Date: Mon, 30 Aug 2021 16:14:12 +0300 Subject: [PATCH] ad400xx_fmc: Parametrize board select, sampling rate and adc resolution fix comments --- projects/ad40xx_fmc/common/ad40xx_bd.tcl | 8 ++++---- projects/ad40xx_fmc/zed/system_bd.tcl | 9 ++++++--- projects/ad40xx_fmc/zed/system_project.tcl | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/projects/ad40xx_fmc/common/ad40xx_bd.tcl b/projects/ad40xx_fmc/common/ad40xx_bd.tcl index d90913786..51d339e0f 100644 --- a/projects/ad40xx_fmc/common/ad40xx_bd.tcl +++ b/projects/ad40xx_fmc/common/ad40xx_bd.tcl @@ -19,10 +19,10 @@ current_bd_instance /spi_ad40xx create_bd_intf_pin -mode Master -vlnv analog.com:interface:spi_master_rtl:1.0 m_spi create_bd_intf_pin -mode Master -vlnv xilinx.com:interface:axis_rtl:1.0 M_AXIS_SAMPLE - if {$adc_resolution <= 32} { - set data_width 32 + if {$ADC_RESOLUTION <= 16} { + set data_width 16 } else { - set data_width 64 + set data_width 32 }; ad_ip_instance spi_engine_execution execution @@ -48,7 +48,7 @@ current_bd_instance /spi_ad40xx ## to setup the sample rate of the system change the PULSE_PERIOD value ## the acutal sample rate will be PULSE_PERIOD * (1/sys_cpu_clk) - set sampling_cycle [expr int(ceil(double($spi_clk_ref_frequency * 1000000) / $adc_sampling_rate))] + set sampling_cycle [expr int(ceil(double($spi_clk_ref_frequency * 1000000) / $ADC_SAMPLING_RATE))] ad_ip_parameter trigger_gen CONFIG.PULSE_PERIOD $sampling_cycle ad_ip_parameter trigger_gen CONFIG.PULSE_WIDTH 1 diff --git a/projects/ad40xx_fmc/zed/system_bd.tcl b/projects/ad40xx_fmc/zed/system_bd.tcl index ab5f1f661..e6e952ee6 100644 --- a/projects/ad40xx_fmc/zed/system_bd.tcl +++ b/projects/ad40xx_fmc/zed/system_bd.tcl @@ -6,13 +6,14 @@ source $ad_hdl_dir/projects/scripts/adi_pd.tcl set spi_clk_ref_frequency 166 # specify ADC resolution -- supported resolutions 16/18/20 bits -set adc_resolution 20 +set ADC_RESOLUTION [get_env_param ADC_RESOLUTION 20] # specify ADC sampling rate in samples/seconds # NOTE: This rate can be set just in turbo mode -- if turbo mode is not used # the max rate should be 1.6 MSPS -set adc_sampling_rate 1800000 +# supported sampling rates: 2/1.8/1/0.5 MSPS depending on the board +set ADC_SAMPLING_RATE [get_env_param ADC_SAMPLING_RATE 1800000] source ../common/ad40xx_bd.tcl @@ -21,5 +22,7 @@ ad_ip_parameter axi_sysid_0 CONFIG.ROM_ADDR_BITS 9 ad_ip_parameter rom_sys_0 CONFIG.PATH_TO_FILE "[pwd]/mem_init_sys.txt" ad_ip_parameter rom_sys_0 CONFIG.ROM_ADDR_BITS 9 -sysid_gen_sys_init_file +set AD40XX_ADAQ400X_N [get_env_param AD40XX_ADAQ400X_N 1] +set sys_cstring "ad40xx: $AD40XX_ADAQ400X_N - adc_sampling_rate: $ADC_SAMPLING_RATE - adc_resolution: $ADC_RESOLUTION" +sysid_gen_sys_init_file $sys_cstring diff --git a/projects/ad40xx_fmc/zed/system_project.tcl b/projects/ad40xx_fmc/zed/system_project.tcl index 9705e3432..2a0335599 100644 --- a/projects/ad40xx_fmc/zed/system_project.tcl +++ b/projects/ad40xx_fmc/zed/system_project.tcl @@ -19,17 +19,17 @@ source $ad_hdl_dir/projects/scripts/adi_board.tcl ## 1 - EVAL-AD40XX-FMCZ ## 0 - EVAL-ADAQ400x ## -set ad40xx_adaq400x_n 1 +set AD40XX_ADAQ400X_N [get_env_param AD40XX_ADAQ400X_N 1] adi_project ad40xx_fmc_zed -if {$ad40xx_adaq400x_n == 1} { +if {$AD40XX_ADAQ400X_N == 1} { adi_project_files ad40xx_fmc_zed [list \ "$ad_hdl_dir/library/common/ad_iobuf.v" \ "system_top_ad40xx.v" \ "system_constr_ad40xx.xdc" \ "$ad_hdl_dir/projects/common/zed/zed_system_constr.xdc"] -} elseif {$ad40xx_adaq400x_n == 0} { +} elseif {$AD40XX_ADAQ400X_N == 0} { adi_project_files ad40xx_fmc_zed [list \ "$ad_hdl_dir/library/common/ad_iobuf.v" \ "system_top_adaq400x.v" \