ad738x: Add system variables for configuration

- In system_bd define variable $adc_resolution, $adc_num_of_channels and
$adc_sampling_rate.
  - Add support for 12 and 14 bit resolution
main
Istvan Csomortani 2017-11-24 09:30:24 +00:00 committed by István Csomortáni
parent a7b98c397a
commit 11ece90435
3 changed files with 45 additions and 10 deletions

View File

@ -13,33 +13,53 @@ current_bd_instance /spi
create_bd_intf_pin -mode Master -vlnv xilinx.com:interface:axis_rtl:1.0 M_AXIS_SAMPLE
ad_ip_instance spi_engine_execution execution
ad_ip_parameter execution CONFIG.DATA_WIDTH 16
ad_ip_parameter execution CONFIG.DATA_WIDTH $adc_resolution
ad_ip_parameter execution CONFIG.NUM_OF_CS 1
ad_ip_parameter execution CONFIG.NUM_OF_SDI 2
ad_ip_parameter execution CONFIG.NUM_OF_SDI $adc_num_of_channels
ad_ip_instance axi_spi_engine axi
ad_ip_parameter axi CONFIG.DATA_WIDTH 16
ad_ip_parameter axi CONFIG.DATA_WIDTH $adc_resolution
ad_ip_parameter axi CONFIG.NUM_OF_SDI $adc_num_of_channels
ad_ip_parameter axi CONFIG.NUM_OFFLOAD 1
ad_ip_instance spi_engine_offload offload
ad_ip_parameter offload CONFIG.DATA_WIDTH 16
ad_ip_parameter offload CONFIG.DATA_WIDTH $adc_resolution
ad_ip_parameter offload CONFIG.NUM_OF_SDI $adc_num_of_channels
ad_ip_instance spi_engine_interconnect interconnect
ad_ip_parameter interconnect CONFIG.DATA_WIDTH 16
ad_ip_parameter interconnect CONFIG.DATA_WIDTH $adc_resolution
ad_ip_parameter interconnect CONFIG.NUM_OF_SDI $adc_num_of_channels
ad_ip_instance util_pulse_gen trigger_gen
## 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)
ad_ip_parameter trigger_gen CONFIG.PULSE_PERIOD 34
## fsys_cpu_clk is defined to 100 MHZ
set cycle_per_sec_100mhz 100000000
set sampling_cycle [expr int(ceil(double($cycle_per_sec_100mhz) / $adc_sampling_rate))]
ad_ip_parameter trigger_gen CONFIG.PULSE_PERIOD $sampling_cycle
ad_ip_parameter trigger_gen CONFIG.PULSE_WIDTH 1
ad_ip_parameter axi CONFIG.NUM_OFFLOAD 1
if {$adc_resolution < 16} {
ad_ip_instance util_axis_upscale axis_upscaler
ad_ip_parameter axis_upscaler CONFIG.NUM_OF_CHANNELS $adc_num_of_channels
ad_ip_parameter axis_upscaler CONFIG.DATA_WIDTH $adc_resolution
ad_ip_parameter axis_upscaler CONFIG.UDATA_WIDTH 16
ad_connect clk axis_upscaler/clk
ad_connect axi/spi_resetn axis_upscaler/resetn
ad_connect offload/offload_sdi axis_upscaler/s_axis
ad_connect axis_upscaler/m_axis M_AXIS_SAMPLE
ad_connect axis_upscaler/dfmt_enable GND
ad_connect axis_upscaler/dfmt_type GND
ad_connect axis_upscaler/dfmt_se GND
} else {
ad_connect offload/offload_sdi M_AXIS_SAMPLE
}
ad_connect axi/spi_engine_offload_ctrl0 offload/spi_engine_offload_ctrl
ad_connect offload/spi_engine_ctrl interconnect/s0_ctrl
ad_connect axi/spi_engine_ctrl interconnect/s1_ctrl
ad_connect interconnect/m_ctrl execution/ctrl
ad_connect offload/offload_sdi M_AXIS_SAMPLE
ad_connect execution/spi m_spi
@ -73,7 +93,7 @@ ad_ip_parameter axi_ad738x_dma CONFIG.SYNC_TRANSFER_START 0
ad_ip_parameter axi_ad738x_dma CONFIG.AXI_SLICE_SRC 0
ad_ip_parameter axi_ad738x_dma CONFIG.AXI_SLICE_DEST 1
ad_ip_parameter axi_ad738x_dma CONFIG.DMA_2D_TRANSFER 0
ad_ip_parameter axi_ad738x_dma CONFIG.DMA_DATA_WIDTH_SRC 16
ad_ip_parameter axi_ad738x_dma CONFIG.DMA_DATA_WIDTH_SRC [expr $adc_num_of_channels * 16]
ad_ip_parameter axi_ad738x_dma CONFIG.DMA_DATA_WIDTH_DEST 64
ad_connect sys_cpu_clk spi/clk

View File

@ -25,6 +25,7 @@ M_DEPS += ../../../library/spi_engine/axi_spi_engine/axi_spi_engine.xpr
M_DEPS += ../../../library/spi_engine/spi_engine_execution/spi_engine_execution.xpr
M_DEPS += ../../../library/spi_engine/spi_engine_interconnect/spi_engine_interconnect.xpr
M_DEPS += ../../../library/spi_engine/spi_engine_offload/spi_engine_offload.xpr
M_DEPS += ../../../library/util_axis_upscale/util_axis_upscale.xpr
M_DEPS += ../../../library/util_i2c_mixer/util_i2c_mixer.xpr
M_DEPS += ../../../library/util_pulse_gen/util_pulse_gen.xpr
@ -64,10 +65,10 @@ clean-all:clean
$(MAKE) -C ../../../library/spi_engine/spi_engine_execution clean
$(MAKE) -C ../../../library/spi_engine/spi_engine_interconnect clean
$(MAKE) -C ../../../library/spi_engine/spi_engine_offload clean
$(MAKE) -C ../../../library/util_axis_upscale clean
$(MAKE) -C ../../../library/util_i2c_mixer clean
$(MAKE) -C ../../../library/util_pulse_gen clean
ad738x_fmc_zed.sdk/system_top.hdf: $(M_DEPS)
-rm -rf $(M_FLIST)
$(M_VIVADO) system_project.tcl >> ad738x_fmc_zed_vivado.log 2>&1
@ -83,6 +84,7 @@ lib:
$(MAKE) -C ../../../library/spi_engine/spi_engine_execution
$(MAKE) -C ../../../library/spi_engine/spi_engine_interconnect
$(MAKE) -C ../../../library/spi_engine/spi_engine_offload
$(MAKE) -C ../../../library/util_axis_upscale
$(MAKE) -C ../../../library/util_i2c_mixer
$(MAKE) -C ../../../library/util_pulse_gen

View File

@ -1,4 +1,17 @@
source $ad_hdl_dir/projects/common/zed/zed_system_bd.tcl
# specify ADC resolution -- the design supports 16/14/12 bit resolutions
set adc_resolution 16
# specify the number of active channel -- 1 or 2 or 4
set adc_num_of_channels 2
# specify ADC sampling rate in sample/seconds -- default is 3 MSPS
set adc_sampling_rate 3000000
source ../common/ad738x_bd.tcl