Skip to content

Commit d182f54

Browse files
committed
pluto: Add testbench for Pluto
Signed-off-by: Ionut Podgoreanu <ionut.podgoreanu@analog.com>
1 parent 51bae95 commit d182f54

File tree

8 files changed

+1235
-0
lines changed

8 files changed

+1235
-0
lines changed

pluto/Makefile

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

pluto/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+

pluto/cfgs/cfg1.tcl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
global ad_project_params
2+
3+
4+
# Put project configs here
5+
# e.g.
6+
# set ad_project_params(CMOS_LVDS_N) 1
7+

pluto/system_bd.tcl

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# ***************************************************************************
2+
# ***************************************************************************
3+
# Copyright (C) 2024 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+
global ad_project_params
39+
40+
# Device clk
41+
ad_ip_instance clk_vip ssi_clk_vip [ list \
42+
INTERFACE_MODE {MASTER} \
43+
FREQ_HZ 250000000 \
44+
]
45+
adi_sim_add_define "SSI_CLK=ssi_clk_vip"
46+
create_bd_port -dir O ssi_clk_out
47+
ad_connect ssi_clk_out ssi_clk_vip/clk_out
48+
49+
# Remove duplicated objects
50+
delete_bd_objs \
51+
[get_bd_cells sys_concat_intc] \
52+
[get_bd_cells sys_rstgen]
53+
54+
ad_disconnect [get_bd_pins sys_clk_vip/clk_out] sys_cpu_clk
55+
56+
# Block design under test
57+
source $ad_hdl_dir/projects/pluto/system_bd.tcl
58+
59+
# Remove unnecessary objects
60+
delete_bd_objs \
61+
[get_bd_intf_nets axi_ad9361_adc_dma_m_dest_axi] \
62+
[get_bd_intf_nets axi_ad9361_dac_dma_m_src_axi] \
63+
[get_bd_intf_nets S00_AXI_1] \
64+
[get_bd_intf_nets sys_ps7_DDR] \
65+
[get_bd_intf_nets sys_ps7_FIXED_IO] \
66+
[get_bd_nets gpio_i_1] \
67+
[get_bd_nets spi0_clk_i_1] \
68+
[get_bd_nets spi0_csn_i_1] \
69+
[get_bd_nets spi0_sdi_i_1] \
70+
[get_bd_nets spi0_sdo_i_1] \
71+
[get_bd_nets sys_200m_clk] \
72+
[get_bd_nets sys_concat_intc_dout] \
73+
[get_bd_nets sys_ps7_FCLK_RESET0_N] \
74+
[get_bd_nets sys_ps7_GPIO_O] \
75+
[get_bd_nets sys_ps7_GPIO_T] \
76+
[get_bd_nets sys_ps7_SPI0_MOSI_O] \
77+
[get_bd_nets sys_ps7_SPI0_SCLK_O] \
78+
[get_bd_nets sys_ps7_SPI0_SS_O] \
79+
[get_bd_nets sys_ps7_SPI0_SS1_O] \
80+
[get_bd_nets sys_ps7_SPI0_SS2_O] \
81+
[get_bd_cells sys_ps7]
82+
83+
ad_connect sys_cpu_clk sys_clk_vip/clk_out
84+
ad_connect sys_cpu_clk mng_axi_vip/aclk
85+
ad_connect sys_cpu_clk axi_intc/s_axi_aclk
86+
ad_connect sys_cpu_clk axi_axi_interconnect/aclk
87+
ad_connect sys_cpu_clk axi_mem_interconnect/aclk1
88+
ad_connect sys_rst_vip/rst_out sys_rstgen/ext_reset_in
89+
ad_connect axi_intc/intr sys_concat_intc/dout
90+
ad_connect $sys_iodelay_clk axi_ad9361/delay_clk
91+
92+
ad_mem_hp1_interconnect sys_cpu_clk axi_ad9361_adc_dma/m_dest_axi
93+
ad_mem_hp2_interconnect sys_cpu_clk axi_ad9361_dac_dma/m_src_axi
94+
95+
ad_ip_parameter axi_ad9361 CONFIG.DELAY_REFCLK_FREQUENCY 400
96+
97+
set RX_DMA 0x7C400000
98+
set_property offset $RX_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ad9361_adc_dma}]
99+
adi_sim_add_define "RX_DMA_BA=[format "%d" ${RX_DMA}]"
100+
101+
set TX_DMA 0x7C420000
102+
set_property offset $TX_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ad9361_dac_dma}]
103+
adi_sim_add_define "TX_DMA_BA=[format "%d" ${TX_DMA}]"
104+
105+
set TDDN 0x7C440000
106+
set_property offset $TDDN [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_tdd_0}]
107+
adi_sim_add_define "TDDN_BA=[format "%d" ${TDDN}]"
108+
109+
set AXI_AD9361 0x79020000
110+
set_property offset $AXI_AD9361 [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ad9361}]
111+
adi_sim_add_define "AXI_AD9361_BA=[format "%d" ${AXI_AD9361}]"

pluto/system_project.tcl

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 common 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 "xc7z010clg400-1"
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_dmac_pkg.sv" \
32+
"../common/sv/adi_regmap_dac_pkg.sv" \
33+
"../common/sv/adi_regmap_adc_pkg.sv" \
34+
"../common/sv/adi_regmap_common_pkg.sv" \
35+
"../common/sv/adi_regmap_tdd_gen_pkg.sv" \
36+
"../common/sv/dmac_api.sv" \
37+
"../common/sv/dma_trans.sv" \
38+
"../common/sv/test_harness_env.sv" \
39+
"tests/test_program.sv" \
40+
"system_tb.sv" \
41+
]
42+
43+
#set a default test program
44+
adi_sim_add_define "TEST_PROGRAM=test_program"
45+
46+
adi_sim_generate $project_name

pluto/system_tb.sv

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// ***************************************************************************
2+
// ***************************************************************************
3+
// Copyright (C) 2024 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 burst = 1'b0;
43+
logic txdata;
44+
logic [11:0] tx_data_out;
45+
46+
`TEST_PROGRAM test();
47+
48+
test_harness `TH (
49+
.ssi_clk_out (ssi_clk),
50+
51+
.enable (enable),
52+
53+
.rx_clk_in (rx_clk_in),
54+
.rx_data_in (tx_data_out),
55+
.rx_frame_in (tx_frame_out),
56+
57+
.tx_clk_out (tx_clk_out),
58+
.tx_data_out (tx_data_out),
59+
.tx_frame_out (tx_frame_out),
60+
.txnrx (txnrx),
61+
.up_enable (1'b1),
62+
.up_txnrx (1'b1),
63+
64+
.tdd_ext_sync(burst),
65+
.txdata_o(txdata)
66+
);
67+
68+
assign rx_clk_in = ssi_clk;
69+
70+
endmodule

0 commit comments

Comments
 (0)