Skip to content
Open
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/cn0577_adaq2387x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
####################################################################################
####################################################################################
## Copyright (C) 2025 Analog Devices, Inc.
####################################################################################
####################################################################################

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

# Remaining test-bench dependencies except test programs

LIB_DEPS += axi_pwm_gen
LIB_DEPS += axi_dmac
LIB_DEPS += axi_ltc2387

# list of test programs
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)), $(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>

####################################################################################
####################################################################################
27 changes: 27 additions & 0 deletions testbenches/project/cn0577_adaq2387x/README.md
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

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global ad_project_params

set ad_project_params(TWOLANES) 0
set ad_project_params(ADC_RES) 16
set ad_project_params(CN0577_ADAQ2387X_N) 0
set ad_project_params(USE_MMCM) 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global ad_project_params

set ad_project_params(TWOLANES) 0
set ad_project_params(ADC_RES) 18
set ad_project_params(CN0577_ADAQ2387X_N) 0
set ad_project_params(USE_MMCM) 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global ad_project_params

set ad_project_params(TWOLANES) 1
set ad_project_params(ADC_RES) 16
set ad_project_params(CN0577_ADAQ2387X_N) 0
set ad_project_params(USE_MMCM) 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global ad_project_params

set ad_project_params(TWOLANES) 1
set ad_project_params(ADC_RES) 18
set ad_project_params(CN0577_ADAQ2387X_N) 0
set ad_project_params(USE_MMCM) 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global ad_project_params

set ad_project_params(TWOLANES) 0
set ad_project_params(ADC_RES) 18
set ad_project_params(CN0577_ADAQ2387X_N) 1
set ad_project_params(USE_MMCM) 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global ad_project_params

set ad_project_params(TWOLANES) 1
set ad_project_params(ADC_RES) 18
set ad_project_params(CN0577_ADAQ2387X_N) 1
set ad_project_params(USE_MMCM) 0
90 changes: 90 additions & 0 deletions testbenches/project/cn0577_adaq2387x/system_bd.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ***************************************************************************
# ***************************************************************************
# Copyright (C) 2025 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/main/LICENSE_ADIBSD
# This will allow to generate bit files and not release the source code,
# as long as it attaches to an ADI device.
#
# ***************************************************************************
# ***************************************************************************

global ad_project_params

# system level parameters
set TWOLANES $ad_project_params(TWOLANES)
set ADC_RES $ad_project_params(ADC_RES)
set CN0577_ADAQ2387X_N $ad_project_params(CN0577_ADAQ2387X_N)
set USE_MMCM $ad_project_params(USE_MMCM)

#
# Block design under test
#

if {$CN0577_ADAQ2387X_N == 1} {
source $ad_hdl_dir/projects/cn0577/common/cn0577_bd.tcl
} else {
source $ad_hdl_dir/projects/adaq2387x/common/adaq2387x_bd.tcl
}

ad_disconnect sys_200m_clk axi_ltc2387/delay_clk
ad_connect sys_dma_clk axi_ltc2387/delay_clk

delete_bd_objs [get_bd_nets ref_clk_1]

if {$CN0577_ADAQ2387X_N == 1} {
# 120MHz ref_clk for cn0577
set ref_freq 120000000
} else {
# 100Mhz ref_clk for adaq2387x
set ref_freq 100000000
}

ad_ip_instance clk_vip ref_clk_vip [ list \
INTERFACE_MODE {MASTER} \
FREQ_HZ $ref_freq \
]

adi_sim_add_define "REF_CLK=ref_clk_vip"

create_bd_port -dir O ref_clk_out
ad_connect ref_clk_out ref_clk_vip/clk_out
ad_connect axi_ltc2387/ref_clk ref_clk_vip/clk_out
ad_connect axi_ltc2387_dma/fifo_wr_clk ref_clk_vip/clk_out
ad_connect axi_pwm_gen/ext_clk ref_clk_vip/clk_out

set BA_AXI_LTC2387 0x44A00000
set_property offset $BA_AXI_LTC2387 [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ltc2387}]
adi_sim_add_define "AXI_LTC2387_BA=[format "%d" ${BA_AXI_LTC2387}]"

set BA_DMA 0x44A30000
set_property offset $BA_DMA [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_ltc2387_dma}]
adi_sim_add_define "AXI_LTC2387_DMA_BA=[format "%d" ${BA_DMA}]"

set BA_PWM 0x44A60000
set_property offset $BA_PWM [get_bd_addr_segs {mng_axi_vip/Master_AXI/SEG_data_axi_pwm_gen}]
adi_sim_add_define "AXI_PWM_GEN_BA=[format "%d" ${BA_PWM}]"
37 changes: 37 additions & 0 deletions testbenches/project/cn0577_adaq2387x/system_project.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
source ../../../scripts/adi_sim.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 project params
global ad_project_params

# Set to use SmartConnect or AXI Interconnect
set use_smartconnect 1

# Create the project
adi_sim_project_xilinx $project_name "xc7z007sclg400-1"

source $ad_tb_dir/library/includes/sp_include_dmac.tcl
source $ad_tb_dir/library/includes/sp_include_pwm_gen.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"
]

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

adi_sim_generate $project_name
77 changes: 77 additions & 0 deletions testbenches/project/cn0577_adaq2387x/system_tb.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// ***************************************************************************
// ***************************************************************************
// Copyright (C) 2025 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/main/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();

wire ref_clk_out;
wire clk_gate;
wire da_p;
wire da_n;
wire db_p;
wire db_n;
wire dco_p;
wire dco_n;
wire cnv;

// test bench variables

`TEST_PROGRAM test(
.ref_clk_out (ref_clk_out),
.clk_gate (clk_gate),
.dco_p (dco_p),
.dco_n (dco_n),
.da_p (da_p),
.da_n (da_n),
.db_p (db_p),
.db_n (db_n),
.cnv (cnv));

test_harness `TH (
.ref_clk_out (ref_clk_out),
.cnv (cnv),
.da_n (da_n),
.da_p (da_p),
.db_n (db_n),
.db_p (db_p),
.dco_p (dco_p),
.dco_n(dco_n),
.clk_gate (clk_gate));

endmodule

Loading