-
Notifications
You must be signed in to change notification settings - Fork 22
cn0577_adaq2387x: Add testbench #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
StancaPop
wants to merge
10
commits into
main
Choose a base branch
from
add_cn0577_tb_s
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
095d4a5
cn0577_adaq2387x: Update tb to work for cn0577 & adaq2387x
StancaPop 7c25485
cn0577_adaq2387x: Update Makefile
StancaPop d4f683d
cn0577_adaq2387x: PR changes
StancaPop 0db5236
cn0577_adaq2387x: Generate ref_clk using VIP, update dco generation
StancaPop 621d181
cn0577: Fix cn0577 test program
StancaPop 263be7e
cn0577: PR changes - cleanup
StancaPop b95b0ae
cn0577_adaq2387x: Randomize data, fix indentation
StancaPop a71cff6
cn0577_adaq2387x: Specify delay units
StancaPop 62a74ef
cn0577_adaq2387x: Fix PR changes req
StancaPop 7e3b39d
cn0577_adaq2387x: Add param names and values
StancaPop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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> | ||
|
|
||
| #################################################################################### | ||
| #################################################################################### |
This file contains hidden or 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 | ||
|
|
6 changes: 6 additions & 0 deletions
6
testbenches/project/cn0577_adaq2387x/cfgs/cfg_adaq2387x_1lane_16b.tcl
This file contains hidden or 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,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 |
6 changes: 6 additions & 0 deletions
6
testbenches/project/cn0577_adaq2387x/cfgs/cfg_adaq2387x_1lane_18b.tcl
This file contains hidden or 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,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 |
6 changes: 6 additions & 0 deletions
6
testbenches/project/cn0577_adaq2387x/cfgs/cfg_adaq2387x_2lanes_16b.tcl
This file contains hidden or 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,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 |
6 changes: 6 additions & 0 deletions
6
testbenches/project/cn0577_adaq2387x/cfgs/cfg_adaq2387x_2lanes_18b.tcl
This file contains hidden or 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,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 |
6 changes: 6 additions & 0 deletions
6
testbenches/project/cn0577_adaq2387x/cfgs/cfg_cn0577_1lane.tcl
This file contains hidden or 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,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 |
6 changes: 6 additions & 0 deletions
6
testbenches/project/cn0577_adaq2387x/cfgs/cfg_cn0577_2lanes.tcl
This file contains hidden or 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,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 |
This file contains hidden or 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,93 @@ | ||
| # *************************************************************************** | ||
| # *************************************************************************** | ||
| # 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_ip_parameter axi_ltc2387 CONFIG.ADC_INIT_DELAY 0 | ||
|
|
||
| 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] | ||
|
|
||
IstvanZsSzekely marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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}]" | ||
This file contains hidden or 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,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 |
This file contains hidden or 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,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 | ||
IstvanZsSzekely marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| `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 | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.