-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dma_sg: Add testbench for the Scatter-Gather feature
Signed-off-by: Ionut Podgoreanu <ionut.podgoreanu@analog.com>
- Loading branch information
Showing
12 changed files
with
1,565 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#################################################################################### | ||
## Copyright (C) 2024 Analog Devices, Inc. | ||
#################################################################################### | ||
|
||
# All test-bench dependencies except test programs | ||
SV_DEPS += ../common/sv/utils.svh | ||
SV_DEPS += ../common/sv/logger_pkg.sv | ||
SV_DEPS += ../common/sv/reg_accessor.sv | ||
SV_DEPS += ../common/sv/m_axis_sequencer.sv | ||
SV_DEPS += ../common/sv/s_axis_sequencer.sv | ||
SV_DEPS += ../common/sv/m_axi_sequencer.sv | ||
SV_DEPS += ../common/sv/s_axi_sequencer.sv | ||
SV_DEPS += ../common/sv/dmac_api.sv | ||
SV_DEPS += ../common/sv/adi_regmap_pkg.sv | ||
SV_DEPS += ../common/sv/adi_regmap_dmac_pkg.sv | ||
SV_DEPS += ../common/sv/dma_trans.sv | ||
SV_DEPS += ../common/sv/test_harness_env.sv | ||
SV_DEPS += system_tb.sv | ||
|
||
ENV_DEPS += system_project.tcl | ||
ENV_DEPS += system_bd.tcl | ||
ENV_DEPS +=../scripts/adi_sim.tcl | ||
ENV_DEPS +=../scripts/run_sim.tcl | ||
|
||
LIB_DEPS += axi_dmac | ||
|
||
# default test program | ||
TP := test_program_1d | ||
|
||
# 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_1d | ||
TESTS += cfg2:test_program_2d | ||
TESTS += cfg1:test_program_tr_queue | ||
|
||
include ../scripts/project-sim.mk | ||
|
||
# usage : | ||
# | ||
# run specific test on a specific configuration in gui mode | ||
# make CFG=cfg2 TST=test_program_2d MODE=gui | ||
# | ||
# run all test from a configuration | ||
# make cfg2 | ||
|
||
#################################################################################### | ||
#################################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
global ad_project_params | ||
|
||
set rx_dma_cfg [list \ | ||
DMA_TYPE_SRC 1 \ | ||
DMA_TYPE_DEST 0 \ | ||
ID 0 \ | ||
AXI_SLICE_SRC 1 \ | ||
AXI_SLICE_DEST 1 \ | ||
SYNC_TRANSFER_START 0 \ | ||
DMA_LENGTH_WIDTH 24 \ | ||
DMA_2D_TRANSFER 0 \ | ||
DMA_SG_TRANSFER 1 \ | ||
MAX_BYTES_PER_BURST 4096 \ | ||
CYCLIC 0 \ | ||
DMA_DATA_WIDTH_SRC 64 \ | ||
DMA_DATA_WIDTH_DEST 64 \ | ||
DMA_DATA_WIDTH_SG 64 \ | ||
] | ||
|
||
set tx_dma_cfg [list \ | ||
DMA_TYPE_SRC 0 \ | ||
DMA_TYPE_DEST 1 \ | ||
ID 0 \ | ||
AXI_SLICE_SRC 1 \ | ||
AXI_SLICE_DEST 1 \ | ||
SYNC_TRANSFER_START 0 \ | ||
DMA_LENGTH_WIDTH 24 \ | ||
DMA_2D_TRANSFER 0 \ | ||
DMA_SG_TRANSFER 1 \ | ||
CYCLIC 1 \ | ||
DMA_DATA_WIDTH_SRC 64 \ | ||
DMA_DATA_WIDTH_DEST 64 \ | ||
DMA_DATA_WIDTH_SG 64 \ | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
global ad_project_params | ||
|
||
set rx_dma_cfg [list \ | ||
DMA_TYPE_SRC 1 \ | ||
DMA_TYPE_DEST 0 \ | ||
ID 0 \ | ||
AXI_SLICE_SRC 1 \ | ||
AXI_SLICE_DEST 1 \ | ||
SYNC_TRANSFER_START 0 \ | ||
DMA_LENGTH_WIDTH 24 \ | ||
DMA_2D_TRANSFER 1 \ | ||
DMA_SG_TRANSFER 1 \ | ||
MAX_BYTES_PER_BURST 4096 \ | ||
CYCLIC 0 \ | ||
DMA_DATA_WIDTH_SRC 64 \ | ||
DMA_DATA_WIDTH_DEST 64 \ | ||
DMA_DATA_WIDTH_SG 64 \ | ||
] | ||
|
||
set tx_dma_cfg [list \ | ||
DMA_TYPE_SRC 0 \ | ||
DMA_TYPE_DEST 1 \ | ||
ID 0 \ | ||
AXI_SLICE_SRC 1 \ | ||
AXI_SLICE_DEST 1 \ | ||
SYNC_TRANSFER_START 0 \ | ||
DMA_LENGTH_WIDTH 24 \ | ||
DMA_2D_TRANSFER 1 \ | ||
DMA_SG_TRANSFER 1 \ | ||
CYCLIC 1 \ | ||
DMA_DATA_WIDTH_SRC 64 \ | ||
DMA_DATA_WIDTH_DEST 64 \ | ||
DMA_DATA_WIDTH_SG 64 \ | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# *************************************************************************** | ||
# *************************************************************************** | ||
# Copyright (C) 2024 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/master/LICENSE_ADIBSD | ||
# This will allow to generate bit files and not release the source code, | ||
# as long as it attaches to an ADI device. | ||
# | ||
# *************************************************************************** | ||
# *************************************************************************** | ||
|
||
source ../../scripts/adi_env.tcl | ||
|
||
# Device clk | ||
ad_ip_instance clk_vip device_clk_vip [ list \ | ||
INTERFACE_MODE {MASTER} \ | ||
FREQ_HZ 62500000 \ | ||
] | ||
adi_sim_add_define "DEVICE_CLK=device_clk_vip" | ||
|
||
set device_clk device_clk_vip/clk_out | ||
|
||
# ------------------ | ||
# | ||
# Blocks under test | ||
# | ||
# ------------------ | ||
|
||
global rx_dma_cfg | ||
global tx_dma_cfg | ||
|
||
ad_ip_instance axi_dmac dut_rx_dma $rx_dma_cfg | ||
ad_ip_instance axi_dmac dut_tx_dma $tx_dma_cfg | ||
|
||
ad_connect $device_clk dut_rx_dma/s_axis_aclk | ||
ad_connect $device_clk dut_tx_dma/m_axis_aclk | ||
|
||
# connect resets | ||
ad_connect $sys_cpu_resetn dut_rx_dma/m_dest_axi_aresetn | ||
ad_connect $sys_cpu_resetn dut_tx_dma/m_src_axi_aresetn | ||
|
||
ad_connect $sys_cpu_resetn dut_rx_dma/m_sg_axi_aresetn | ||
ad_connect $sys_cpu_resetn dut_tx_dma/m_sg_axi_aresetn | ||
|
||
# create loopback | ||
ad_connect dut_tx_dma/m_axis dut_rx_dma/s_axis | ||
|
||
ad_cpu_interconnect 0x7c420000 dut_rx_dma | ||
ad_cpu_interconnect 0x7c430000 dut_tx_dma | ||
|
||
ad_mem_hp0_interconnect $sys_cpu_clk dut_rx_dma/m_dest_axi | ||
ad_mem_hp0_interconnect $sys_cpu_clk dut_tx_dma/m_src_axi | ||
|
||
ad_mem_hp0_interconnect $sys_cpu_clk dut_rx_dma/m_sg_axi | ||
ad_mem_hp0_interconnect $sys_cpu_clk dut_tx_dma/m_sg_axi | ||
|
||
ad_cpu_interrupt ps-13 mb-12 dut_rx_dma/irq | ||
ad_cpu_interrupt ps-12 mb-13 dut_tx_dma/irq | ||
|
||
set RX_DMA 0x7C420000 | ||
set_property offset $RX_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_dut_rx_dma}] | ||
adi_sim_add_define "RX_DMA_BA=[format "%d" ${RX_DMA}]" | ||
|
||
set TX_DMA 0x7C430000 | ||
set_property offset $TX_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_dut_tx_dma}] | ||
adi_sim_add_define "TX_DMA_BA=[format "%d" ${TX_DMA}]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
source ../scripts/adi_sim.tcl | ||
source ../../scripts/adi_env.tcl | ||
source $ad_hdl_dir/projects/scripts/adi_board.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 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" | ||
|
||
# Add test files to the project | ||
adi_sim_project_files [list \ | ||
"../common/sv/utils.svh" \ | ||
"../common/sv/logger_pkg.sv" \ | ||
"../common/sv/reg_accessor.sv" \ | ||
"../common/sv/m_axis_sequencer.sv" \ | ||
"../common/sv/s_axis_sequencer.sv" \ | ||
"../common/sv/m_axi_sequencer.sv" \ | ||
"../common/sv/s_axi_sequencer.sv" \ | ||
"../common/sv/dmac_api.sv" \ | ||
"../common/sv/adi_regmap_pkg.sv" \ | ||
"../common/sv/adi_regmap_dmac_pkg.sv" \ | ||
"../common/sv/dma_trans.sv" \ | ||
"../common/sv/adi_peripheral_pkg.sv" \ | ||
"../common/sv/test_harness_env.sv" \ | ||
"tests/test_program_1d.sv" \ | ||
"tests/test_program_2d.sv" \ | ||
"tests/test_program_tr_queue.sv" \ | ||
"system_tb.sv" \ | ||
] | ||
|
||
#set a default test program | ||
adi_sim_add_define "TEST_PROGRAM=test_program_1d" | ||
|
||
adi_sim_generate $project_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// *************************************************************************** | ||
// *************************************************************************** | ||
// Copyright (C) 2024 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 responsabilities 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/master/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 (); | ||
|
||
endmodule |
Oops, something went wrong.