Skip to content

testbenches/ip/spi_engine: Upgrade spi_engine testbench for SDO extension - #240

Merged
caosjr merged 10 commits into
mainfrom
spi_n_lanes
Jun 10, 2026
Merged

testbenches/ip/spi_engine: Upgrade spi_engine testbench for SDO extension#240
caosjr merged 10 commits into
mainfrom
spi_n_lanes

Conversation

@caosjr

@caosjr caosjr commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

It changes spi_vip and spi_engine driver so it can support the new testbench for the SPI Engine. Several tasks and functions were changed due to this modification.
This modification requires this spi engine version: analogdevicesinc/hdl#1808

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • New test (change that adds new test program and/or testbench)
  • Breaking change (has dependencies in other repositories/testbenches)
  • Documentation (change that adds or modifies documentation)

PR Checklist

  • I have followed the code style guidelines
  • I have performed a self-review of changes
  • I have ran all testbenches affected by this PR
  • I have commented my code, at least hard-to-understand parts
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe files, Copyright etc)
  • I have not introduced new Warnings/Errors on compilation/elaboration/simulation
  • I have set the verbosity level to none for the test program

@caosjr
caosjr marked this pull request as ready for review August 7, 2025 19:19
@caosjr
caosjr requested review from a team as code owners August 7, 2025 19:19

@IstvanZsSzekely IstvanZsSzekely left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review.
The projects that have updated documentation: AD463x, AD738x, AD7606 have broken testbenches. It seems that the HDL block design is out of date.

Comment thread docs/testbenches/project_based/ad463x/index.rst Outdated
Comment thread library/drivers/spi_engine/spi_engine_api_pkg.sv
Comment thread testbenches/ip/spi_engine/tests/test_lanes.sv Outdated
Comment thread testbenches/ip/spi_engine/tests/test_slowdata.sv Outdated
Comment thread testbenches/ip/spi_engine/tests/test_lanes.sv Outdated
Comment thread testbenches/ip/spi_engine/cfgs/cfg00.tcl Outdated
Comment thread library/vip/adi/spi_vip/adi_spi_vip.sv Outdated
Comment thread testbenches/ip/spi_engine/cfgs/cfg_num_sdi.tcl Outdated
Comment thread testbenches/ip/spi_engine/cfgs/cfg_sdo_streaming.tcl Outdated
Comment thread testbenches/ip/spi_engine/cfgs/cfg00.tcl Outdated
Comment thread library/vip/adi/spi_vip/adi_spi_vip.sv Outdated
Comment thread library/vip/adi/spi_vip/adi_spi_vip_if_base_pkg.sv Outdated

@IstvanZsSzekely IstvanZsSzekely left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triggered another CI run to check the current status of the PR with the changes from HDL and TB PRs. The AD463x, AD7606x, AD7616 (parallel mode) projects have build issues in the testbenches, while AD57xx has issues when compiling the simulation files.

github-actions Bot added a commit that referenced this pull request Sep 23, 2025
github-actions Bot added a commit that referenced this pull request Sep 23, 2025
@IstvanZsSzekely

Copy link
Copy Markdown
Collaborator

Please rebase the branch on the current main to solve the conflicts.

Comment thread library/vip/adi/spi_vip/adi_spi_vip_pkg.sv Outdated
Comment thread library/vip/adi/spi_vip/adi_spi_vip_pkg.sv Outdated
LBFFilho
LBFFilho previously approved these changes Jun 3, 2026
@IstvanZsSzekely

IstvanZsSzekely commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

From what I gathered looking at the code, the MOSI and MISO_LANE_MASK are calculated based on the NUM_OF_MOSI and MISO. These values are not needed for anything other than the simulation VIPs, which already know of the NUM_OF_x values, and hence the x_LANE_MASK parameters become redundant. If this is the case, then please remove the redundant parts of the code.

The MISO_LANE_MASK and MOSI_LANE_MASK parameters are not redundant. While the current config files compute them as (1 << NUM_OF_x) - 1 (contiguous lanes), the masks provide flexibility that NUM_OF_x alone cannot:

  1. Non-contiguous lane selection - A mask can enable specific lanes (e.g., MISO_LANE_MASK = 0x05 enables lanes 0 and 2, skipping lane 1), whereas NUM_OF_MISO only indicates the total count.
  2. Decoupled concerns - NUM_OF_MISO/MOSI defines the physical bus width (how many lanes exist), while x_LANE_MASK defines which of those lanes are active in a given test scenario.
  3. The VIP uses the mask directly - In adi_spi_vip_pkg.sv:164, $countones(vif.get_param_MISO_LANE_MASK) determines how many lanes to drive. This allows testing configurations where not all physical lanes are used.

The current configs happen to always enable all lanes (mask = 2^N - 1), but the parameters should remain to preserve the ability to test partial/non-contiguous lane configurations in the future.

Thank you for the explanation! Now if someone will have the same question at any point, the reference for the answer will be here.

Comment thread testbenches/project/ad738x/Makefile Outdated
Comment thread testbenches/ip/spi_engine/tests/test_program.sv Outdated
Comment thread testbenches/ip/spi_engine/tests/test_program.sv
Comment thread testbenches/project/ad57xx/tests/test_program.sv Outdated
Comment thread testbenches/project/ad57xx/tests/test_program.sv Outdated
Comment thread testbenches/project/ad7606x/tests/test_program_4ch.sv
Comment thread testbenches/project/ad7606x/tests/test_program_si.sv Outdated
Comment thread testbenches/project/ad7606x/tests/test_program_si.sv Outdated
Comment thread testbenches/project/ad7616/tests/test_program_si.sv Outdated
Comment thread testbenches/project/ad7616/tests/test_program_si.sv Outdated
@caosjr
caosjr force-pushed the spi_n_lanes branch 2 times, most recently from 7bbd948 to 0ef69b4 Compare June 5, 2026 13:10
caosjr added 2 commits June 5, 2026 10:10
Updates SPI VIP, Driver, and regmaps to support n lanes.
In this new SPI Engine Version, it is possible to mask
up to 8 serial lanes.

* Update to support n lanes for the SDI and SDO;
* Insert SDI lane mask instruction;
* Insert SDO lane mask instruction;
* Update major version to SPI Engine 2.0. It is not
  backwards compatible;
* Update NUM_OF_SDI parameter to NUM_OF_SDIO.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Updated from NUM_OF_SDI to NUM_OF_SDIO parameter in the documentation
of the following projects:
* ad463x;
* ad738x;
* ad7606;
* pulsar_adc.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
caosjr added 8 commits June 5, 2026 10:45
Several changes to support more than one lane for SDI and
SDO. Fixed and updated all methods to work with the latest
framework:
  * Update config files. All config files have 4 lanes now;
  * Insert a new test for lane mask.
  * Possible to use different lane mask for offload as
    long as it is changed before executing it;

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Testbench was updated to use the new features
related to the spi lane mask.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Fixes sdo_data type.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Fixes sdo_data type.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Using the latest framework for the tests.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Using the latest framework for the tests.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Update to the latest multilane SPI Engine, using the latest framework.
Removed the manual axi reads/writes and using the current APIs.
Inserted a SPI VIP for the test_program_si.sv.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
Update to the latest multilane SPI Engine, using the latest framework.
Removed the manual axi reads/writes and using the current APIs.
Inserted a SPI VIP for the test_program_si.sv.

Signed-off-by: Carlos Souza <carlos.souza@analog.com>
@caosjr
caosjr requested a review from LBFFilho June 5, 2026 13:48

@IstvanZsSzekely IstvanZsSzekely left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testbench and the documentation looks good from the standard point of view.
A CI build has been started to check for any issues.
Please ask for a review from someone who knows more about the projects to review the testbench process itself.

@IstvanZsSzekely IstvanZsSzekely left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI finished the simulations, everything is green.
Please ask for a review from someone who knows more about the projects to review the testbench process itself.

@PIoandan
PIoandan self-requested a review June 9, 2026 12:26
@sarpadi
sarpadi self-requested a review June 10, 2026 06:17
@caosjr
caosjr merged commit 748614f into main Jun 10, 2026
4 checks passed
@caosjr
caosjr deleted the spi_n_lanes branch June 10, 2026 11:29
github-actions Bot added a commit that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants