adrv9371x: Parameterize JESD204 configuration values

main
Filip Gherman 2022-01-11 14:06:45 +02:00 committed by Filip Gherman
parent d8a418d8d0
commit 6a92bd5925
4 changed files with 134 additions and 38 deletions

View File

@ -1,31 +1,44 @@
#
# Parameter description:
# [TX/RX/RX_OS]_JESD_M : Number of converters per link
# [TX/RX/RX_OS]_JESD_L : Number of lanes per link
# [TX/RX/RX_OS]_JESD_S : Number of samples per frame
# [TX/RX/RX_OS]_JESD_NP : Number of bits per sample
#
set MAX_TX_NUM_OF_LANES 4
set MAX_RX_NUM_OF_LANES 2
set MAX_RX_OS_NUM_OF_LANES 2
# TX parameters
set TX_NUM_OF_LANES 4 ; # L
set TX_NUM_OF_CONVERTERS 4 ; # M
set TX_SAMPLES_PER_FRAME 1 ; # S
set TX_SAMPLE_WIDTH 16 ; # N/NP
set TX_NUM_OF_LANES $ad_project_params(TX_JESD_L) ; # L
set TX_NUM_OF_CONVERTERS $ad_project_params(TX_JESD_M) ; # M
set TX_SAMPLES_PER_FRAME $ad_project_params(TX_JESD_S) ; # S
set TX_SAMPLE_WIDTH 16 ; # N/NP
set TX_SAMPLES_PER_CHANNEL 2 ; # L * 32 / (M * N)
set TX_SAMPLES_PER_CHANNEL [expr $TX_NUM_OF_LANES * 32 / \
($TX_NUM_OF_CONVERTERS * $TX_SAMPLE_WIDTH)] ; # L * 32 / (M * N)
# RX parameters
set RX_NUM_OF_LANES 2 ; # L
set RX_NUM_OF_CONVERTERS 4 ; # M
set RX_SAMPLES_PER_FRAME 1 ; # S
set RX_SAMPLE_WIDTH 16 ; # N/NP
set RX_NUM_OF_LANES $ad_project_params(RX_JESD_L) ; # L
set RX_NUM_OF_CONVERTERS $ad_project_params(RX_JESD_M) ; # M
set RX_SAMPLES_PER_FRAME $ad_project_params(RX_JESD_S) ; # S
set RX_SAMPLE_WIDTH 16 ; # N/NP
set RX_SAMPLES_PER_CHANNEL 1 ; # L * 32 / (M * N)
set RX_SAMPLES_PER_CHANNEL [expr $RX_NUM_OF_LANES * 32 / \
($RX_NUM_OF_CONVERTERS * $RX_SAMPLE_WIDTH)] ; # L * 32 / (M * N)
# RX Observation parameters
set RX_OS_NUM_OF_LANES 2 ; # L
set RX_OS_NUM_OF_CONVERTERS 2 ; # M
set RX_OS_SAMPLES_PER_FRAME 1 ; # S
set RX_OS_SAMPLE_WIDTH 16 ; # N/NP
set RX_OS_NUM_OF_LANES $ad_project_params(RX_OS_JESD_L) ; # L
set RX_OS_NUM_OF_CONVERTERS $ad_project_params(RX_OS_JESD_M) ; # M
set RX_OS_SAMPLES_PER_FRAME $ad_project_params(RX_OS_JESD_S) ; # S
set RX_OS_SAMPLE_WIDTH 16 ; # N/NP
set RX_OS_SAMPLES_PER_CHANNEL 2 ; # L * 32 / (M * N)
set RX_OS_SAMPLES_PER_CHANNEL [expr $RX_OS_NUM_OF_LANES * 32 / \
($RX_OS_NUM_OF_CONVERTERS * $RX_OS_SAMPLE_WIDTH)] ; # L * 32 / (M * N)
set dac_fifo_name axi_ad9371_dacfifo
set dac_data_width [expr 32*$TX_NUM_OF_LANES]
set dac_dma_data_width 128
set dac_data_width [expr $TX_SAMPLE_WIDTH * $TX_NUM_OF_CONVERTERS * $TX_SAMPLES_PER_CHANNEL]
set dac_dma_data_width [expr $TX_SAMPLE_WIDTH * $TX_NUM_OF_CONVERTERS * $TX_SAMPLES_PER_CHANNEL]
source $ad_hdl_dir/library/jesd204/scripts/jesd204.tcl
source $ad_hdl_dir/projects/common/xilinx/adi_fir_filter_bd.tcl
@ -125,7 +138,9 @@ ad_ip_parameter axi_ad9371_rx_dma CONFIG.ASYNC_CLK_DEST_REQ 1
ad_ip_parameter axi_ad9371_rx_dma CONFIG.ASYNC_CLK_SRC_DEST 1
ad_ip_parameter axi_ad9371_rx_dma CONFIG.ASYNC_CLK_REQ_SRC 1
ad_ip_parameter axi_ad9371_rx_dma CONFIG.DMA_2D_TRANSFER 0
ad_ip_parameter axi_ad9371_rx_dma CONFIG.DMA_DATA_WIDTH_SRC [expr 32*$RX_NUM_OF_LANES]
ad_ip_parameter axi_ad9371_rx_dma CONFIG.DMA_DATA_WIDTH_SRC [expr $RX_SAMPLE_WIDTH * \
$RX_NUM_OF_CONVERTERS * \
$RX_SAMPLES_PER_CHANNEL]
ad_add_decimation_filter "rx_fir_decimator" 8 $RX_NUM_OF_CONVERTERS 1 {122.88} {122.88} \
"$ad_hdl_dir/library/util_fir_int/coefile_int.coe"
@ -172,14 +187,16 @@ ad_ip_parameter axi_ad9371_rx_os_dma CONFIG.ASYNC_CLK_DEST_REQ 1
ad_ip_parameter axi_ad9371_rx_os_dma CONFIG.ASYNC_CLK_SRC_DEST 1
ad_ip_parameter axi_ad9371_rx_os_dma CONFIG.ASYNC_CLK_REQ_SRC 1
ad_ip_parameter axi_ad9371_rx_os_dma CONFIG.DMA_2D_TRANSFER 0
ad_ip_parameter axi_ad9371_rx_os_dma CONFIG.DMA_DATA_WIDTH_SRC [expr 32*$RX_NUM_OF_LANES]
ad_ip_parameter axi_ad9371_rx_os_dma CONFIG.DMA_DATA_WIDTH_SRC [expr $RX_OS_SAMPLE_WIDTH * \
$RX_OS_NUM_OF_CONVERTERS * \
$RX_OS_SAMPLES_PER_CHANNEL]
# common cores
ad_ip_instance util_adxcvr util_ad9371_xcvr
ad_ip_parameter util_ad9371_xcvr CONFIG.RX_NUM_OF_LANES [expr $RX_NUM_OF_LANES+$RX_OS_NUM_OF_LANES]
ad_ip_parameter util_ad9371_xcvr CONFIG.TX_NUM_OF_LANES $TX_NUM_OF_LANES
ad_ip_parameter util_ad9371_xcvr CONFIG.RX_NUM_OF_LANES [expr $MAX_RX_NUM_OF_LANES+$MAX_RX_OS_NUM_OF_LANES]
ad_ip_parameter util_ad9371_xcvr CONFIG.TX_NUM_OF_LANES $MAX_TX_NUM_OF_LANES
ad_ip_parameter util_ad9371_xcvr CONFIG.TX_OUT_DIV 2
ad_ip_parameter util_ad9371_xcvr CONFIG.CPLL_FBDIV 4
ad_ip_parameter util_ad9371_xcvr CONFIG.RX_CLK25_DIV 5
@ -192,7 +209,7 @@ ad_ip_parameter util_ad9371_xcvr CONFIG.QPLL_FBDIV 0x120
set tx_ref_clk tx_ref_clk_0
set rx_ref_clk rx_ref_clk_0
set rx_obs_ref_clk rx_ref_clk_$RX_NUM_OF_LANES
set rx_obs_ref_clk rx_ref_clk_$MAX_RX_NUM_OF_LANES
create_bd_port -dir I $tx_ref_clk
create_bd_port -dir I $rx_ref_clk
@ -202,16 +219,16 @@ ad_connect $sys_cpu_clk util_ad9371_xcvr/up_clk
# Tx
ad_connect ad9371_tx_device_clk axi_ad9371_tx_clkgen/clk_0
ad_xcvrcon util_ad9371_xcvr axi_ad9371_tx_xcvr axi_ad9371_tx_jesd {1 2 3 0} ad9371_tx_device_clk
ad_xcvrcon util_ad9371_xcvr axi_ad9371_tx_xcvr axi_ad9371_tx_jesd {1 2 3 0} ad9371_tx_device_clk {} $MAX_TX_NUM_OF_LANES
ad_connect util_ad9371_xcvr/tx_out_clk_0 axi_ad9371_tx_clkgen/clk
ad_xcvrpll $tx_ref_clk util_ad9371_xcvr/qpll_ref_clk_0
ad_xcvrpll axi_ad9371_tx_xcvr/up_pll_rst util_ad9371_xcvr/up_qpll_rst_0
# Rx
ad_connect ad9371_rx_device_clk axi_ad9371_rx_clkgen/clk_0
ad_xcvrcon util_ad9371_xcvr axi_ad9371_rx_xcvr axi_ad9371_rx_jesd {} ad9371_rx_device_clk
ad_xcvrcon util_ad9371_xcvr axi_ad9371_rx_xcvr axi_ad9371_rx_jesd {} ad9371_rx_device_clk {} $MAX_RX_NUM_OF_LANES
ad_connect util_ad9371_xcvr/rx_out_clk_0 axi_ad9371_rx_clkgen/clk
for {set i 0} {$i < $RX_NUM_OF_LANES} {incr i} {
for {set i 0} {$i < $MAX_RX_NUM_OF_LANES} {incr i} {
set ch [expr $i]
ad_xcvrpll $rx_ref_clk util_ad9371_xcvr/cpll_ref_clk_$ch
ad_xcvrpll axi_ad9371_rx_xcvr/up_pll_rst util_ad9371_xcvr/up_cpll_rst_$ch
@ -219,11 +236,11 @@ for {set i 0} {$i < $RX_NUM_OF_LANES} {incr i} {
# Rx - OBS
ad_connect ad9371_rx_os_device_clk axi_ad9371_rx_os_clkgen/clk_0
ad_xcvrcon util_ad9371_xcvr axi_ad9371_rx_os_xcvr axi_ad9371_rx_os_jesd {} ad9371_rx_os_device_clk
ad_connect util_ad9371_xcvr/rx_out_clk_$RX_NUM_OF_LANES axi_ad9371_rx_os_clkgen/clk
for {set i 0} {$i < $RX_OS_NUM_OF_LANES} {incr i} {
ad_xcvrcon util_ad9371_xcvr axi_ad9371_rx_os_xcvr axi_ad9371_rx_os_jesd {} ad9371_rx_os_device_clk {} $MAX_RX_OS_NUM_OF_LANES
ad_connect util_ad9371_xcvr/rx_out_clk_$MAX_RX_NUM_OF_LANES axi_ad9371_rx_os_clkgen/clk
for {set i 0} {$i < $MAX_RX_OS_NUM_OF_LANES} {incr i} {
# channel indexing starts from the last RX
set ch [expr $RX_NUM_OF_LANES + $i]
set ch [expr $MAX_RX_NUM_OF_LANES + $i]
ad_xcvrpll $rx_obs_ref_clk util_ad9371_xcvr/cpll_ref_clk_$ch
ad_xcvrpll axi_ad9371_rx_os_xcvr/up_pll_rst util_ad9371_xcvr/up_cpll_rst_$ch
}
@ -255,13 +272,17 @@ for {set i 0} {$i < $TX_NUM_OF_CONVERTERS} {incr i} {
ad_connect tx_fir_interpolator/data_out_${i} tx_ad9371_tpl_core/dac_data_$i
}
ad_ip_instance util_vector_logic logic_or [list \
C_OPERATION {or} \
C_SIZE 1]
if {$TX_NUM_OF_CONVERTERS <= 2} {
ad_connect tx_fir_interpolator/valid_out_0 util_ad9371_tx_upack/fifo_rd_en
} else {
ad_ip_instance util_vector_logic logic_or [list \
C_OPERATION {or} \
C_SIZE 1]
ad_connect logic_or/Op1 tx_fir_interpolator/valid_out_0
ad_connect logic_or/Op2 tx_fir_interpolator/valid_out_2
ad_connect logic_or/Res util_ad9371_tx_upack/fifo_rd_en
ad_connect logic_or/Op1 tx_fir_interpolator/valid_out_0
ad_connect logic_or/Op2 tx_fir_interpolator/valid_out_2
ad_connect logic_or/Res util_ad9371_tx_upack/fifo_rd_en
}
ad_connect tx_fir_interpolator/active dac_fir_filter_active

View File

@ -3,7 +3,32 @@ source ../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
adi_project adrv9371x_kcu105
# get_env_param retrieves parameter value from the environment if exists,
# other case use the default value
#
# Use over-writable parameters from the environment.
#
# e.g.
# make RX_JESD_L=4 RX_JESD_M=2 TX_JESD_L=4 TX_JESD_M=2
# Parameter description:
# [TX/RX/RX_OS]_JESD_M : Number of converters per link
# [TX/RX/RX_OS]_JESD_L : Number of lanes per link
# [TX/RX/RX_OS]_JESD_S : Number of samples per frame
# [TX/RX/RX_OS]_JESD_NP : Number of bits per sample
adi_project adrv9371x_kcu105 0 [list \
TX_JESD_M [get_env_param TX_JESD_M 4 ] \
TX_JESD_L [get_env_param TX_JESD_L 4 ] \
TX_JESD_S [get_env_param TX_JESD_S 1 ] \
RX_JESD_M [get_env_param RX_JESD_M 4 ] \
RX_JESD_L [get_env_param RX_JESD_L 2 ] \
RX_JESD_S [get_env_param RX_JESD_S 1 ] \
RX_OS_JESD_M [get_env_param RX_OS_JESD_M 2 ] \
RX_OS_JESD_L [get_env_param RX_OS_JESD_L 2 ] \
RX_OS_JESD_S [get_env_param RX_OS_JESD_S 1 ] \
]
adi_project_files adrv9371x_kcu105 [list \
"system_top.v" \
"system_constr.xdc"\

View File

@ -5,7 +5,32 @@ source ../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
adi_project adrv9371x_zc706
# get_env_param retrieves parameter value from the environment if exists,
# other case use the default value
#
# Use over-writable parameters from the environment.
#
# e.g.
# make RX_JESD_L=4 RX_JESD_M=2 TX_JESD_L=4 TX_JESD_M=2
# Parameter description:
# [TX/RX/RX_OS]_JESD_M : Number of converters per link
# [TX/RX/RX_OS]_JESD_L : Number of lanes per link
# [TX/RX/RX_OS]_JESD_S : Number of samples per frame
# [TX/RX/RX_OS]_JESD_NP : Number of bits per sample
adi_project adrv9371x_zc706 0 [list \
TX_JESD_M [get_env_param TX_JESD_M 4 ] \
TX_JESD_L [get_env_param TX_JESD_L 4 ] \
TX_JESD_S [get_env_param TX_JESD_S 1 ] \
RX_JESD_M [get_env_param RX_JESD_M 4 ] \
RX_JESD_L [get_env_param RX_JESD_L 2 ] \
RX_JESD_S [get_env_param RX_JESD_S 1 ] \
RX_OS_JESD_M [get_env_param RX_OS_JESD_M 2 ] \
RX_OS_JESD_L [get_env_param RX_OS_JESD_L 2 ] \
RX_OS_JESD_S [get_env_param RX_OS_JESD_S 1 ] \
]
adi_project_files adrv9371x_zc706 [list \
"system_top.v" \
"system_constr.xdc"\

View File

@ -3,7 +3,32 @@ source ../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
adi_project adrv9371x_zcu102
# get_env_param retrieves parameter value from the environment if exists,
# other case use the default value
#
# Use over-writable parameters from the environment.
#
# e.g.
# make RX_JESD_L=4 RX_JESD_M=2 TX_JESD_L=4 TX_JESD_M=2
# Parameter description:
# [TX/RX/RX_OS]_JESD_M : Number of converters per link
# [TX/RX/RX_OS]_JESD_L : Number of lanes per link
# [TX/RX/RX_OS]_JESD_S : Number of samples per frame
# [TX/RX/RX_OS]_JESD_NP : Number of bits per sample
adi_project adrv9371x_zcu102 0 [list \
TX_JESD_M [get_env_param TX_JESD_M 4 ] \
TX_JESD_L [get_env_param TX_JESD_L 4 ] \
TX_JESD_S [get_env_param TX_JESD_S 1 ] \
RX_JESD_M [get_env_param RX_JESD_M 4 ] \
RX_JESD_L [get_env_param RX_JESD_L 2 ] \
RX_JESD_S [get_env_param RX_JESD_S 1 ] \
RX_OS_JESD_M [get_env_param RX_OS_JESD_M 2 ] \
RX_OS_JESD_L [get_env_param RX_OS_JESD_L 2 ] \
RX_OS_JESD_S [get_env_param RX_OS_JESD_S 1 ] \
]
adi_project_files adrv9371x_zcu102 [list \
"system_top.v" \
"system_constr.xdc"\