Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions testbenches/project/ada4355/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
####################################################################################
####################################################################################
## Copyright 2025 (c) Analog Devices, Inc.
####################################################################################
####################################################################################

# Makeincludes
include ../../../scripts/make_tb_path.mk
include $(ADI_TB_DIR)/library/includes/Makeinclude_common.mk
include $(ADI_TB_DIR)/library/includes/Makeinclude_dmac.mk
include $(ADI_TB_DIR)/library/includes/Makeinclude_converter.mk

LIB_DEPS += axi_ada4355
LIB_DEPS += axi_dmac
LIB_DEPS += axi_sysid
LIB_DEPS += sysid_rom

# default test programs
# Format is: <test name>
TP := $(notdir $(basename $(wildcard tests/*.sv)))

# config files should have the following format
# cfg_<param1>_<param2>.tcl
CFG_FILES := $(notdir $(wildcard cfgs/cfg*.tcl))

# List of tests and configuration combinations that has to be run
# Format is: <configuration>:<test name>
TESTS := $(foreach cfg, $(basename $(CFG_FILES)), $(addprefix $(cfg):, $(TP)))

include $(ADI_TB_DIR)/scripts/project-sim.mk

# usage :
#
# run specific test on a specific configuration in gui mode
# make CFG=<configuration_name> TST=<test_name> MODE=gui
#
# run all test from a configuration
# make <configuration_name>

####################################################################################
####################################################################################
26 changes: 26 additions & 0 deletions testbenches/project/ada4355/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
3 changes: 3 additions & 0 deletions testbenches/project/ada4355/cfgs/cfg1.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global ad_project_params

set ad_project_params(BUFMRCE_EN) 1
3 changes: 3 additions & 0 deletions testbenches/project/ada4355/cfgs/cfg2.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global ad_project_params

set ad_project_params(BUFMRCE_EN) 0
8 changes: 8 additions & 0 deletions testbenches/project/ada4355/cfgs/cfg_shift0.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global ad_project_params

# ADA4356 configuration (no BUFMRCE)
set ad_project_params(BUFMRCE_EN) 0

# Frame timing: aligned (shift_cnt=0)
# FSM should detect frame_shifted=0xF0 without correction
set ad_project_params(FRAME_SHIFT_CNT) 0
9 changes: 9 additions & 0 deletions testbenches/project/ada4355/cfgs/cfg_shift3.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
global ad_project_params

# ADA4356 configuration (no BUFMRCE)
set ad_project_params(BUFMRCE_EN) 0

# Frame timing: misaligned by 3 DDR edges (shift_cnt=3)
# FSM should detect misalignment and apply shift_cnt=3 correction
# frame >> 3 and data >> 6 to align
set ad_project_params(FRAME_SHIFT_CNT) 3
71 changes: 71 additions & 0 deletions testbenches/project/ada4355/system_bd.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ***************************************************************************
# ***************************************************************************
# Copyright 2025 (c) 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

# system level parameters
set BUFMRCE_EN $ad_project_params(BUFMRCE_EN)

# FRAME_SHIFT_CNT for testbench - controls frame timing offset
# Default to 0 if not specified in config
if {[info exists ad_project_params(FRAME_SHIFT_CNT)]} {
set FRAME_SHIFT_CNT $ad_project_params(FRAME_SHIFT_CNT)
} else {
set FRAME_SHIFT_CNT 0
}

global ad_project_params

#
# Block design under test
#
#
source $ad_hdl_dir/projects/ada4355_fmc/common/ada4355_fmc_bd.tcl

# Define and verify base addresses from the block design
set BA_ADA4355_ADC 0x44A00000
set_property offset $BA_ADA4355_ADC [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ada4355_adc}]
adi_sim_add_define "ADA4355_ADC_BA=[format "%d" ${BA_ADA4355_ADC}]"

set BA_ADA4355_DMA 0x44A30000
set_property offset $BA_ADA4355_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ada4355_dma}]
adi_sim_add_define "ADA4355_DMA_BA=[format "%d" ${BA_ADA4355_DMA}]"

set BA_DDR 0x80000000
set_property offset $BA_DDR [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_mng_ddr_cntlr}]
adi_sim_add_define "DDR_BA=[format "%d" ${BA_DDR}]"

# Testbench configuration for frame timing offset
adi_sim_add_define "FRAME_SHIFT_CNT=${FRAME_SHIFT_CNT}"
35 changes: 35 additions & 0 deletions testbenches/project/ada4355/system_project.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 common config file
source "cfgs/${cfg_file}"

# Set the project name
set project_name [file rootname $cfg_file]

#set a default test program
adi_sim_add_define "TEST_PROGRAM=test_program"

# Create the project
adi_sim_project_xilinx $project_name "xc7z020clg484-1" ;

# Source the include files for package dependencies
source $ad_tb_dir/library/includes/sp_include_common.tcl
source $ad_tb_dir/library/includes/sp_include_dmac.tcl
source $ad_tb_dir/library/includes/sp_include_converter.tcl

# Add test files to the project
adi_sim_project_files [list \
"tests/test_program.sv" \
"system_tb.sv" \
]

adi_sim_generate $project_name
Loading