Skip to content

Commit bd77c7b

Browse files
authored
Merge 0016dd4 into dc6f8fb
2 parents dc6f8fb + 0016dd4 commit bd77c7b

File tree

13 files changed

+890
-0
lines changed

13 files changed

+890
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
# list of test programs
20+
TP := $(notdir $(basename $(wildcard tests/*.sv)))
21+
22+
# config files should have the following format
23+
# cfg_<param1>_<param2>.tcl
24+
CFG_FILES := $(notdir $(wildcard cfgs/cfg*.tcl))
25+
26+
# List of tests and configuration combinations that has to be run
27+
# Format is: <configuration>:<test name>
28+
TESTS := $(foreach cfg, $(basename $(CFG_FILES)), $(cfg):$(TP))
29+
30+
include $(ADI_TB_DIR)/scripts/project-sim.mk
31+
32+
# usage :
33+
#
34+
# run specific test on a specific configuration in gui mode
35+
# make CFG=<configuration_name> TST=<test_name> MODE=gui
36+
#
37+
# run all test from a configuration
38+
# make <configuration_name>
39+
40+
####################################################################################
41+
####################################################################################
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: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
#
45+
# Block design under test
46+
#
47+
48+
if {$CN0577_ADAQ2387X_N == 1} {
49+
source $ad_hdl_dir/projects/cn0577/common/cn0577_bd.tcl
50+
} else {
51+
source $ad_hdl_dir/projects/adaq2387x/common/adaq2387x_bd.tcl
52+
}
53+
54+
ad_disconnect sys_200m_clk axi_ltc2387/delay_clk
55+
ad_connect sys_dma_clk axi_ltc2387/delay_clk
56+
57+
delete_bd_objs [get_bd_nets ref_clk_1]
58+
59+
if {$CN0577_ADAQ2387X_N == 1} {
60+
# 120MHz ref_clk for cn0577
61+
set ref_freq 120000000
62+
} else {
63+
# 100Mhz ref_clk for adaq2387x
64+
set ref_freq 100000000
65+
}
66+
67+
ad_ip_instance clk_vip ref_clk_vip [ list \
68+
INTERFACE_MODE {MASTER} \
69+
FREQ_HZ $ref_freq \
70+
]
71+
72+
adi_sim_add_define "REF_CLK=ref_clk_vip"
73+
74+
create_bd_port -dir O ref_clk_out
75+
ad_connect ref_clk_out ref_clk_vip/clk_out
76+
ad_connect axi_ltc2387/ref_clk ref_clk_vip/clk_out
77+
ad_connect axi_ltc2387_dma/fifo_wr_clk ref_clk_vip/clk_out
78+
ad_connect axi_pwm_gen/ext_clk ref_clk_vip/clk_out
79+
80+
set BA_AXI_LTC2387 0x44A00000
81+
set_property offset $BA_AXI_LTC2387 [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ltc2387}]
82+
adi_sim_add_define "AXI_LTC2387_BA=[format "%d" ${BA_AXI_LTC2387}]"
83+
84+
set BA_DMA 0x44A30000
85+
set_property offset $BA_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ltc2387_dma}]
86+
adi_sim_add_define "AXI_LTC2387_DMA_BA=[format "%d" ${BA_DMA}]"
87+
88+
set BA_PWM 0x44A60000
89+
set_property offset $BA_PWM [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_pwm_gen}]
90+
adi_sim_add_define "AXI_PWM_GEN_BA=[format "%d" ${BA_PWM}]"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 to use SmartConnect or AXI Interconnect
20+
set use_smartconnect 1
21+
22+
# Create the project
23+
adi_sim_project_xilinx $project_name "xc7z007sclg400-1"
24+
25+
source $ad_tb_dir/library/includes/sp_include_dmac.tcl
26+
source $ad_tb_dir/library/includes/sp_include_pwm_gen.tcl
27+
source $ad_tb_dir/library/includes/sp_include_converter.tcl
28+
29+
# Add test files to the project
30+
adi_sim_project_files [list \
31+
"tests/test_program.sv"
32+
]
33+
34+
#set a default test program
35+
adi_sim_add_define "TEST_PROGRAM=test_program"
36+
37+
adi_sim_generate $project_name

0 commit comments

Comments
 (0)