Skip to content

Commit 40e1598

Browse files
committed
axi_tdd: Add testbench for the Generic TDD engine
1 parent c8d1a2a commit 40e1598

File tree

8 files changed

+1052
-0
lines changed

8 files changed

+1052
-0
lines changed

axi_tdd/Makefile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
####################################################################################
2+
####################################################################################
3+
## Copyright 2022(c) Analog Devices, Inc.
4+
####################################################################################
5+
####################################################################################
6+
7+
# All test-bench dependencies except test programs
8+
SV_DEPS += ../common/sv/utils.svh
9+
SV_DEPS += ../common/sv/logger_pkg.sv
10+
SV_DEPS += ../common/sv/reg_accessor.sv
11+
SV_DEPS += ../common/sv/m_axis_sequencer.sv
12+
SV_DEPS += ../common/sv/s_axis_sequencer.sv
13+
SV_DEPS += ../common/sv/m_axi_sequencer.sv
14+
SV_DEPS += ../common/sv/s_axi_sequencer.sv
15+
SV_DEPS += ../common/sv/adi_regmap_pkg.sv
16+
SV_DEPS += ../common/sv/adi_regmap_tdd_gen_pkg.sv
17+
SV_DEPS += ../common/sv/test_harness_env.sv
18+
SV_DEPS += system_tb.sv
19+
20+
ENV_DEPS += system_project.tcl
21+
ENV_DEPS += system_bd.tcl
22+
ENV_DEPS +=../scripts/adi_sim.tcl
23+
ENV_DEPS +=../scripts/run_sim.tcl
24+
25+
LIB_DEPS += axi_tdd
26+
27+
# default test program
28+
TP := test_program
29+
30+
# config files should have the following format
31+
# cfg_<param1>_<param2>.tcl
32+
CFG_FILES := $(notdir $(wildcard cfgs/cfg*.tcl))
33+
#$(warning $(CFG_FILES))
34+
35+
# List of tests and configuration combinations that has to be run
36+
# Format is: <configuration>:<test name>
37+
TESTS := $(foreach cfg, $(basename $(CFG_FILES)), $(cfg):$(TP))
38+
#TESTS += cfg1_mm2mm_default:directed_test
39+
#TESTS += cfg1:test_program
40+
#TESTS += cfg2_fsync:test_program
41+
#TESTS += cfg2_fsync:test_frame_delay
42+
43+
include ../scripts/project-sim.mk
44+
45+
# usage :
46+
#
47+
# run specific test on a specific configuration in gui mode
48+
# make CFG=cfg2_fsync TST=test_frame_delay MODE=gui
49+
#
50+
# run all test from a configuration
51+
# make cfg1_mm2mm_default
52+
53+
####################################################################################
54+
####################################################################################

axi_tdd/README.md

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+

axi_tdd/cfgs/cfg1.tcl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
global ad_project_params
2+
3+
set tdd_cfg [list \
4+
ID 0 \
5+
CHANNEL_COUNT 8 \
6+
REGISTER_WIDTH 32 \
7+
BURST_COUNT_WIDTH 32 \
8+
SYNC_EXTERNAL 1 \
9+
SYNC_INTERNAL 1 \
10+
SYNC_EXTERNAL_CDC 1 \
11+
SYNC_COUNT_WIDTH 64 \
12+
]
13+

axi_tdd/system_bd.tcl

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ***************************************************************************
2+
# ***************************************************************************
3+
# Copyright 2022 (c) 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/master/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+
source ../../scripts/adi_env.tcl
37+
38+
# Device clk
39+
ad_ip_instance clk_vip device_clk_vip [ list \
40+
INTERFACE_MODE {MASTER} \
41+
FREQ_HZ 250000000 \
42+
]
43+
adi_sim_add_define "DEVICE_CLK=device_clk_vip"
44+
45+
set device_clk device_clk_vip/clk_out
46+
47+
# ------------------
48+
#
49+
# Blocks under test
50+
#
51+
# ------------------
52+
53+
global tdd_cfg
54+
ad_ip_instance axi_tdd dut_tdd $tdd_cfg
55+
56+
ad_connect $device_clk dut_tdd/clk
57+
ad_connect $sys_cpu_resetn dut_tdd/resetn
58+
59+
create_bd_port -dir I sync_in
60+
create_bd_port -dir O sync_out
61+
ad_connect sync_in dut_tdd/sync_in
62+
ad_connect sync_out dut_tdd/sync_out
63+
64+
set num_ch [lindex $tdd_cfg 3]
65+
create_bd_port -from 0 -to [expr $num_ch-1] -dir O tdd_channel
66+
ad_connect tdd_channel dut_tdd/tdd_channel
67+
68+
ad_cpu_interconnect 0x7c420000 dut_tdd
69+

axi_tdd/system_project.tcl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
source ../scripts/adi_sim.tcl
2+
source ../../scripts/adi_env.tcl
3+
source $ad_hdl_dir/projects/scripts/adi_board.tcl
4+
5+
if {$argc < 1} {
6+
puts "Expecting at least one argument that specifies the test configuration"
7+
exit 1
8+
} else {
9+
set cfg_file [lindex $argv 0]
10+
}
11+
12+
# Read config file
13+
source "cfgs/${cfg_file}"
14+
15+
# Set the project name
16+
set project_name [file rootname $cfg_file]
17+
18+
# Create the project
19+
adi_sim_project_xilinx $project_name "xcvu9p-flga2104-2L-e"
20+
21+
# Add test files to the project
22+
adi_sim_project_files [list \
23+
"../common/sv/utils.svh" \
24+
"../common/sv/logger_pkg.sv" \
25+
"../common/sv/reg_accessor.sv" \
26+
"../common/sv/m_axis_sequencer.sv" \
27+
"../common/sv/s_axis_sequencer.sv" \
28+
"../common/sv/m_axi_sequencer.sv" \
29+
"../common/sv/s_axi_sequencer.sv" \
30+
"../common/sv/adi_regmap_pkg.sv" \
31+
"../common/sv/adi_regmap_tdd_gen_pkg.sv" \
32+
"../common/sv/test_harness_env.sv" \
33+
"tests/test_program.sv" \
34+
"system_tb.sv" \
35+
]
36+
37+
#set a default test program
38+
adi_sim_add_define "TEST_PROGRAM=test_program"
39+
40+
adi_sim_generate $project_name

axi_tdd/system_tb.sv

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// ***************************************************************************
2+
// ***************************************************************************
3+
// Copyright 2014 - 2022 (c) 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 responsabilities 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/master/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+
`timescale 1ns/1ps
37+
38+
`include "utils.svh"
39+
40+
module system_tb();
41+
42+
logic sync_in = 1'b0;
43+
logic [31:0] tdd_channel;
44+
45+
`TEST_PROGRAM test();
46+
47+
test_harness `TH (
48+
49+
.sync_in (sync_in), //-dir I
50+
.sync_out (sync_out), //-dir O
51+
52+
.tdd_channel (tdd_channel)
53+
54+
);
55+
56+
endmodule

0 commit comments

Comments
 (0)