Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions testbenches/project/adrv9026/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
####################################################################################
####################################################################################
## Copyright (C) 2025 Analog Devices, Inc.
####################################################################################
####################################################################################

# Makeincludes
include ../../../scripts/make_tb_path.mk
include $(TB_LIBRARY_PATH)/includes/Makeinclude_common.mk
include $(TB_LIBRARY_PATH)/includes/Makeinclude_data_offload.mk
include $(TB_LIBRARY_PATH)/includes/Makeinclude_dmac.mk
include $(TB_LIBRARY_PATH)/includes/Makeinclude_jesd.mk
include $(TB_LIBRARY_PATH)/includes/Makeinclude_xcvr.mk

# Remaining test-bench dependencies except test programs
SV_DEPS += $(TB_LIBRARY_PATH)/regmaps/adi_regmap_dac_pkg.sv
SV_DEPS += $(TB_LIBRARY_PATH)/regmaps/adi_regmap_common_pkg.sv
SV_DEPS += $(TB_LIBRARY_PATH)/regmaps/adi_regmap_adc_pkg.sv

LIB_DEPS += axi_dmac
LIB_DEPS += data_offload
LIB_DEPS += jesd204/ad_ip_jesd204_tpl_dac
LIB_DEPS += jesd204/axi_jesd204_tx
LIB_DEPS += jesd204/jesd204_tx
LIB_DEPS += jesd204/ad_ip_jesd204_tpl_adc
LIB_DEPS += jesd204/axi_jesd204_rx
LIB_DEPS += jesd204/jesd204_rx
LIB_DEPS += xilinx/axi_adxcvr
LIB_DEPS += xilinx/util_adxcvr
LIB_DEPS += util_do_ram
LIB_DEPS += util_hbm
LIB_DEPS += util_pack/util_upack2
LIB_DEPS += util_pack/util_cpack2
LIB_DEPS += xilinx/axi_adxcvr
LIB_DEPS += xilinx/util_adxcvr

# default test program
TP := test_program

# config files should have the following format
# cfg_<param1>_<param2>.tcl
CFG_FILES := $(notdir $(wildcard cfgs/cfg*.tcl))
#$(warning $(CFG_FILES))

# List of tests and configuration combinations that has to be run
# Format is: <configuration>:<test name>
TESTS := $(foreach cfg, $(basename $(CFG_FILES)), $(cfg):$(TP))
#TESTS += cfg1:test_program

include $(ADI_TB_DIR)/scripts/project-sim.mk

# usage :
#
# run specific test on a specific configuration in gui mode
# make CFG=cfg2_fsync TST=test_frame_delay MODE=gui
#
# run all test from a configuration
# make cfg1_mm2mm_default

####################################################################################
####################################################################################
27 changes: 27 additions & 0 deletions testbenches/project/adrv9026/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Usage :

Run all tests in batch mode:

make


Run all tests in GUI mode:

make MODE=gui


Run specific test on a specific configuration in gui mode:

make CFG=<name of cfg> TST=<name of test> MODE=gui


Run all test from a configuration:

make <name of cfg>


Where:

* <name of cfg> is a file from the cfgs directory without the tcl extension of format cfg\*
* <name of test> is a file from the tests directory without the tcl extension

27 changes: 27 additions & 0 deletions testbenches/project/adrv9026/cfgs/cfg1.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
global ad_project_params

set ad_project_params(JESD_MODE) 8B10B

set ad_project_params(REF_CLK_RATE) 500
set ad_project_params(RX_LANE_RATE) 10
set ad_project_params(TX_LANE_RATE) 10

set ad_project_params(RX_NUM_LINKS) 1
set ad_project_params(TX_NUM_LINKS) 1

set ad_project_params(DAC_OFFLOAD_TYPE) 0
set ad_project_params(DAC_OFFLOAD_SIZE) [expr 2*1024*1024]

set ad_project_params(RX_JESD_M) 8
set ad_project_params(RX_JESD_L) 4
set ad_project_params(RX_JESD_S) 1
set ad_project_params(RX_JESD_NP) 16
set ad_project_params(RX_JESD_F) 4
set ad_project_params(RX_JESD_K) 32

set ad_project_params(TX_JESD_M) 8
set ad_project_params(TX_JESD_L) 4
set ad_project_params(TX_JESD_S) 1
set ad_project_params(TX_JESD_NP) 16
set ad_project_params(TX_JESD_F) 4
set ad_project_params(TX_JESD_K) 32
108 changes: 108 additions & 0 deletions testbenches/project/adrv9026/system_bd.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# ***************************************************************************
# ***************************************************************************
# Copyright (C) 2025 Analog Devices, Inc. All rights reserved.
#
# In this HDL repository, there are many different and unique modules, consisting
# of various HDL (Verilog or VHDL) components. The individual modules are
# developed independently, and may be accompanied by separate and unique license
# terms.
#
# The user should read each of these license terms, and understand the
# freedoms and responsibilities that he or she has by using this source/core.
#
# This core is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.
#
# Redistribution and use of source or resulting binaries, with or without modification
# of this file, are permitted under one of the following two license terms:
#
# 1. The GNU General Public License version 2 as published by the
# Free Software Foundation, which can be found in the top level directory
# of this repository (LICENSE_GPL2), and also online at:
# <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
#
# OR
#
# 2. An ADI specific BSD license, which can be found in the top level directory
# of this repository (LICENSE_ADIBSD), and also on-line at:
# https://github.com/analogdevicesinc/hdl/blob/main/LICENSE_ADIBSD
# This will allow to generate bit files and not release the source code,
# as long as it attaches to an ADI device.
#
# ***************************************************************************
# ***************************************************************************

global ad_project_params

set dac_offload_type $ad_project_params(DAC_OFFLOAD_TYPE)
set dac_offload_size $ad_project_params(DAC_OFFLOAD_SIZE)

# Ref clk
ad_ip_instance clk_vip ref_clk_vip [ list \
INTERFACE_MODE {MASTER} \
FREQ_HZ 250000000 \
]
adi_sim_add_define "REF_CLK=ref_clk_vip"
create_bd_port -dir O ref_clk_out
ad_connect ref_clk_out ref_clk_vip/clk_out

# Device clk
ad_ip_instance clk_vip device_clk_vip [ list \
INTERFACE_MODE {MASTER} \
FREQ_HZ 250000000 \
]
adi_sim_add_define "DEVICE_CLK=device_clk_vip"
create_bd_port -dir O device_clk_out
ad_connect device_clk_out device_clk_vip/clk_out

# SYSREF clk
ad_ip_instance clk_vip sysref_clk_vip [ list \
INTERFACE_MODE {MASTER} \
FREQ_HZ 5000000 \
]
adi_sim_add_define "SYSREF_CLK=sysref_clk_vip"
create_bd_port -dir O sysref_clk_out
ad_connect sysref_clk_out sysref_clk_vip/clk_out

#
# Block design under test
#

source $ad_hdl_dir/projects/adrv9026/common/adrv9026_bd.tcl

set RX_DMA 0x7C400000
set_property offset $RX_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_adrv9026_rx_dma}]
adi_sim_add_define "RX_DMA_BA=[format "%d" ${RX_DMA}]"

set RX_XCVR 0x44A60000
set_property offset $RX_XCVR [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_adrv9026_rx_xcvr}]
adi_sim_add_define "RX_XCVR_BA=[format "%d" ${RX_XCVR}]"

set TX_DMA 0x7C420000
set_property offset $TX_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_adrv9026_tx_dma}]
adi_sim_add_define "TX_DMA_BA=[format "%d" ${TX_DMA}]"

set TX_XCVR 0x44A80000
set_property offset $TX_XCVR [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_adrv9026_tx_xcvr}]
adi_sim_add_define "TX_XCVR_BA=[format "%d" ${TX_XCVR}]"

set AXI_JESD_RX 0x44AA0000
set_property offset $AXI_JESD_RX [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_adrv9026_rx_jesd}]
adi_sim_add_define "AXI_JESD_RX_BA=[format "%d" ${AXI_JESD_RX}]"

set ADC_TPL 0x44A00000
set_property offset $ADC_TPL [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_rx_adrv9026_tpl_core}]
adi_sim_add_define "ADC_TPL_BA=[format "%d" ${ADC_TPL}]"

set DAC_TPL 0x44A04000
set_property offset $DAC_TPL [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_tx_adrv9026_tpl_core}]
adi_sim_add_define "DAC_TPL_BA=[format "%d" ${DAC_TPL}]"

set AXI_JESD_TX 0x44A90000
set_property offset $AXI_JESD_TX [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_adrv9026_tx_jesd}]
adi_sim_add_define "AXI_JESD_TX_BA=[format "%d" ${AXI_JESD_TX}]"

set TX_OFFLOAD 0x7C430000
set_property offset $TX_OFFLOAD [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_adrv9026_data_offload}]
adi_sim_add_define "TX_OFFLOAD_BA=[format "%d" ${TX_OFFLOAD}]"
35 changes: 35 additions & 0 deletions testbenches/project/adrv9026/system_project.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
source ../../../scripts/adi_sim.tcl

if {$argc < 1} {
puts "Expecting at least one argument that specifies the test configuration"
exit 1
} else {
set cfg_file [lindex $argv 0]
}

# Read common config file
source "cfgs/${cfg_file}"

# Set the project name
set project_name [file rootname $cfg_file]

# Create the project
adi_sim_project_xilinx $project_name "xcvu9p-flga2104-2L-e"

source $ad_tb_dir/library/includes/sp_include_data_offload.tcl
source $ad_tb_dir/library/includes/sp_include_dmac.tcl
source $ad_tb_dir/library/includes/sp_include_jesd.tcl
source $ad_tb_dir/library/includes/sp_include_xcvr.tcl

# Add test files to the project
adi_sim_project_files [list \
"$ad_tb_dir/library/regmaps/adi_regmap_dac_pkg.sv" \
"$ad_tb_dir/library/regmaps/adi_regmap_common_pkg.sv" \
"$ad_tb_dir/library/regmaps/adi_regmap_adc_pkg.sv" \
"tests/test_program.sv" \
]

#set a default test program
adi_sim_add_define "TEST_PROGRAM=test_program"

adi_sim_generate $project_name
74 changes: 74 additions & 0 deletions testbenches/project/adrv9026/system_tb.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ***************************************************************************
// ***************************************************************************
// Copyright (C) 2025 Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of various HDL (Verilog or VHDL) components. The individual modules are
// developed independently, and may be accompanied by separate and unique license
// terms.
//
// The user should read each of these license terms, and understand the
// freedoms and responsibilities that he or she has by using this source/core.
//
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
// A PARTICULAR PURPOSE.
//
// Redistribution and use of source or resulting binaries, with or without modification
// of this file, are permitted under one of the following two license terms:
//
// 1. The GNU General Public License version 2 as published by the
// Free Software Foundation, which can be found in the top level directory
// of this repository (LICENSE_GPL2), and also online at:
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
//
// OR
//
// 2. An ADI specific BSD license, which can be found in the top level directory
// of this repository (LICENSE_ADIBSD), and also on-line at:
// https://github.com/analogdevicesinc/hdl/blob/main/LICENSE_ADIBSD
// This will allow to generate bit files and not release the source code,
// as long as it attaches to an ADI device.
//
// ***************************************************************************
// ***************************************************************************

`timescale 1ns/1ps

`include "utils.svh"

module system_tb();

`TEST_PROGRAM test();

test_harness `TH (
.ref_clk_out (ref_clk),
.device_clk_out (device_clk),
.sysref_clk_out (sysref),

.core_clk (device_clk), //-dir I
.rx_data_0_n (~data_0_n), //-dir I
.rx_data_0_p (~data_0_p), //-dir I
.rx_data_1_n (data_1_n), //-dir I
.rx_data_1_p (data_1_p), //-dir I
.rx_data_2_n (~data_2_n), //-dir I
.rx_data_2_p (~data_2_p), //-dir I
.rx_data_3_n (data_3_n), //-dir I
.rx_data_3_p (data_3_p), //-dir I
.tx_data_0_n (data_2_n), //-dir O
.tx_data_0_p (data_2_p), //-dir O
.tx_data_1_n (data_3_n), //-dir O
.tx_data_1_p (data_3_p), //-dir O
.tx_data_2_n (data_1_n), //-dir O
.tx_data_2_p (data_1_p), //-dir O
.tx_data_3_n (data_0_n), //-dir O
.tx_data_3_p (data_0_p), //-dir O
.rx_sync_0 (rx_sync_0), //-dir O
.tx_sync_0 (rx_sync_0), //-dir I
.rx_sysref_0 (sysref), //-dir I
.tx_sysref_0 (sysref), //-dir I
.rx_ref_clk_0 (ref_clk), //-dir I
.tx_ref_clk_0 (ref_clk) //-dir I
);

endmodule
Loading