Skip to content

Commit 704c56f

Browse files
committed
cn0577_adaq2387x: Update tb to work for cn0577 & adaq2387x
Signed-off-by: Stanca Pop <[email protected]>
1 parent 8744b4d commit 704c56f

File tree

13 files changed

+916
-0
lines changed

13 files changed

+916
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
####################################################################################
2+
####################################################################################
3+
## Copyright (C) 2025 Analog Devices, Inc.
4+
####################################################################################
5+
####################################################################################
6+
7+
# Makeincludes
8+
include ../../../scripts/make_tb_path.mk
9+
include $(TB_LIBRARY_PATH)/includes/Makeinclude_common.mk
10+
include $(TB_LIBRARY_PATH)/includes/Makeinclude_dmac.mk
11+
include $(TB_LIBRARY_PATH)/includes/Makeinclude_converter.mk
12+
13+
# Remaining test-bench dependencies except test programs
14+
15+
LIB_DEPS += axi_pwm_gen
16+
LIB_DEPS += axi_dmac
17+
LIB_DEPS += axi_ltc2387
18+
19+
# default test programs
20+
# Format is: <test name>
21+
TP := $(notdir $(basename $(wildcard tests/*.sv)))
22+
23+
# config files should have the following format
24+
# cfg_<param1>_<param2>.tcl
25+
CFG_FILES := $(notdir $(wildcard cfgs/cfg*.tcl))
26+
27+
# List of tests and configuration combinations that has to be run
28+
# Format is: <configuration>:<test name>
29+
TESTS := $(foreach cfg, $(basename $(CFG_FILES)), $(addprefix $(cfg):, $(TP)))
30+
31+
include $(ADI_TB_DIR)/scripts/project-sim.mk
32+
33+
# usage :
34+
#
35+
# run specific test on a specific configuration in gui mode
36+
# make CFG=cfg1 TST=test_program MODE=gui
37+
#
38+
# run all test from a configuration
39+
# make cfg1
40+
41+
####################################################################################
42+
####################################################################################
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Usage :
2+
3+
Run all tests in batch mode:
4+
5+
make
6+
7+
8+
Run all tests in GUI mode:
9+
10+
make MODE=gui
11+
12+
13+
Run specific test on a specific configuration in gui mode:
14+
15+
make CFG=<name of cfg> TST=<name of test> MODE=gui
16+
17+
18+
Run all test from a configuration:
19+
20+
make <name of cfg>
21+
22+
23+
Where:
24+
25+
* <name of cfg> is a file from the cfgs directory without the tcl extension of format cfg\*
26+
* <name of test> is a file from the tests directory without the tcl extension
27+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global ad_project_params
2+
3+
set ad_project_params(TWOLANES) 0
4+
set ad_project_params(ADC_RES) 16
5+
set ad_project_params(CN0577_ADAQ2387X_N) 0
6+
set ad_project_params(USE_MMCM) 0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global ad_project_params
2+
3+
set ad_project_params(TWOLANES) 0
4+
set ad_project_params(ADC_RES) 18
5+
set ad_project_params(CN0577_ADAQ2387X_N) 0
6+
set ad_project_params(USE_MMCM) 0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global ad_project_params
2+
3+
set ad_project_params(TWOLANES) 1
4+
set ad_project_params(ADC_RES) 16
5+
set ad_project_params(CN0577_ADAQ2387X_N) 0
6+
set ad_project_params(USE_MMCM) 0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global ad_project_params
2+
3+
set ad_project_params(TWOLANES) 1
4+
set ad_project_params(ADC_RES) 18
5+
set ad_project_params(CN0577_ADAQ2387X_N) 0
6+
set ad_project_params(USE_MMCM) 0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global ad_project_params
2+
3+
set ad_project_params(TWOLANES) 0
4+
set ad_project_params(ADC_RES) 18
5+
set ad_project_params(CN0577_ADAQ2387X_N) 1
6+
set ad_project_params(USE_MMCM) 0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global ad_project_params
2+
3+
set ad_project_params(TWOLANES) 1
4+
set ad_project_params(ADC_RES) 18
5+
set ad_project_params(CN0577_ADAQ2387X_N) 1
6+
set ad_project_params(USE_MMCM) 0
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# ***************************************************************************
2+
# ***************************************************************************
3+
# Copyright (C) 2025 Analog Devices, Inc. All rights reserved.
4+
#
5+
# In this HDL repository, there are many different and unique modules, consisting
6+
# of various HDL (Verilog or VHDL) components. The individual modules are
7+
# developed independently, and may be accompanied by separate and unique license
8+
# terms.
9+
#
10+
# The user should read each of these license terms, and understand the
11+
# freedoms and responsibilities that he or she has by using this source/core.
12+
#
13+
# This core is distributed in the hope that it will be useful, but WITHOUT ANY
14+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15+
# A PARTICULAR PURPOSE.
16+
#
17+
# Redistribution and use of source or resulting binaries, with or without modification
18+
# of this file, are permitted under one of the following two license terms:
19+
#
20+
# 1. The GNU General Public License version 2 as published by the
21+
# Free Software Foundation, which can be found in the top level directory
22+
# of this repository (LICENSE_GPL2), and also online at:
23+
# <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
24+
#
25+
# OR
26+
#
27+
# 2. An ADI specific BSD license, which can be found in the top level directory
28+
# of this repository (LICENSE_ADIBSD), and also on-line at:
29+
# https://github.com/analogdevicesinc/hdl/blob/main/LICENSE_ADIBSD
30+
# This will allow to generate bit files and not release the source code,
31+
# as long as it attaches to an ADI device.
32+
#
33+
# ***************************************************************************
34+
# ***************************************************************************
35+
36+
global ad_project_params
37+
38+
# system level parameters
39+
set TWOLANES $ad_project_params(TWOLANES)
40+
set ADC_RES $ad_project_params(ADC_RES)
41+
set CN0577_ADAQ2387X_N $ad_project_params(CN0577_ADAQ2387X_N)
42+
set USE_MMCM $ad_project_params(USE_MMCM)
43+
44+
adi_project_files [list \
45+
"$ad_hdl_dir/library/common/ad_iobuf.v" \
46+
]
47+
48+
#
49+
# Block design under test
50+
#
51+
52+
if {$CN0577_ADAQ2387X_N == 1} {
53+
source $ad_hdl_dir/projects/cn0577/common/cn0577_bd.tcl
54+
} else {
55+
source $ad_hdl_dir/projects/adaq2387x/common/adaq2387x_bd.tcl
56+
}
57+
58+
set BA_AXI_LTC2387 0x44A00000
59+
set_property offset $BA_AXI_LTC2387 [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ltc2387}]
60+
adi_sim_add_define "AXI_LTC2387_BA=[format "%d" ${BA_AXI_LTC2387}]"
61+
62+
set BA_DMA 0x44A30000
63+
set_property offset $BA_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ltc2387_dma}]
64+
adi_sim_add_define "AXI_LTC2387_DMA_BA=[format "%d" ${BA_DMA}]"
65+
66+
set BA_PWM 0x44A60000
67+
set_property offset $BA_PWM [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_pwm_gen}]
68+
adi_sim_add_define "AXI_PWM_GEN_BA=[format "%d" ${BA_PWM}]"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
source ../../../scripts/adi_sim.tcl
2+
3+
if {$argc < 1} {
4+
puts "Expecting at least one argument that specifies the test configuration"
5+
exit 1
6+
} else {
7+
set cfg_file [lindex $argv 0]
8+
}
9+
10+
# Read common config file
11+
source "cfgs/${cfg_file}"
12+
13+
# Set the project name
14+
set project_name [file rootname $cfg_file]
15+
16+
# Set project params
17+
global ad_project_params
18+
19+
set TWOLANES $ad_project_params(TWOLANES)
20+
set ADC_RES $ad_project_params(ADC_RES)
21+
set CN0577_ADAQ2387X_N $ad_project_params(CN0577_ADAQ2387X_N)
22+
set USE_MMCM $ad_project_params(USE_MMCM)
23+
24+
# Set to use SmartConnect or AXI Interconnect
25+
set use_smartconnect 1
26+
27+
# Create the project
28+
adi_sim_project_xilinx $project_name "xc7z007sclg400-1"
29+
30+
source $ad_tb_dir/library/includes/sp_include_dmac.tcl
31+
source $ad_tb_dir/library/includes/sp_include_pwm_gen.tcl
32+
source $ad_tb_dir/library/includes/sp_include_converter.tcl
33+
34+
# Add test files to the project
35+
adi_sim_project_files [list \
36+
"tests/test_program.sv"
37+
]
38+
39+
#set a default test program
40+
adi_sim_add_define "TEST_PROGRAM=test_program"
41+
42+
adi_sim_generate $project_name

0 commit comments

Comments
 (0)