Skip to content

AXI4 VIP development and integration - #688

Open
tchilikov-semify wants to merge 25 commits into
lowRISC:mainfrom
tchilikov-semify:axi_driver_pr_new
Open

AXI4 VIP development and integration#688
tchilikov-semify wants to merge 25 commits into
lowRISC:mainfrom
tchilikov-semify:axi_driver_pr_new

Conversation

@tchilikov-semify

@tchilikov-semify tchilikov-semify commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

This PR does a few things:

  1. Pulls @rswarbrick's AXI driver from his Caliptra repository as a local copy and expands on its functionality with multi-beat support
  2. Merges it with Csaba's AXI monitor from Axi4 passive vip #391, creating one unified agent for Active (manager) and Passive (monitor) modes
  3. Applies various bug and compilation fixes to the agent
  4. Integrates the agent in the top TB as a monitor on each port of the crossbar
  5. creates an environment level scoreboard

This was tested with the top level CVA6-based test cases.

Will close issue #168

@rswarbrick rswarbrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you very much for doing this (and getting my completely untested code working...)

Do you think you could cherry-pick the various fixes in "axi agent compilation fixes" to the commits that made the mistakes? Since we don't use squash merge in Mocha, this is a way to avoid putting Rupert's silly mistakes into the history :-)

@tchilikov-semify

Copy link
Copy Markdown
Collaborator Author

Thank you very much for doing this (and getting my completely untested code working...)

Do you think you could cherry-pick the various fixes in "axi agent compilation fixes" to the commits that made the mistakes? Since we don't use squash merge in Mocha, this is a way to avoid putting Rupert's silly mistakes into the history :-)

Hey Rupert,

Sure, I can merge the patches into your commits. This would also encompass the handshaking bugfix commit, for a total of two commits :)

rswarbrick and others added 8 commits July 22, 2026 14:40
This is the first step towards a simple AXI agent. It will only have
to handle the subset of AXI that is in use in the blocks in
question (which work by translating to TLUL, so they aren't doing
anything particularly exciting).

In this commit, we're just defining interfaces for the five
channels (which are AW, W, B, AR and R).

Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
The axi_read_request_item and axi_read_data_item classes are intended
to be randomised (when a sequence wishes to send either read requests
or data responses). The axi_read_item class can be used by a monitor
that sees a read request and then one or more responses.

Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
When the agent is representing an AXI Manager, this will be useful for
the B and R channels.

Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
These drive write requests (AW) and write data (W) and also drive the
write response channel (B).

Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
For an example use-case, suppose you are reading with AR / R
transfers. You send an AR transfer with some ARID that will have a
burst with k beats. Now you want consume read data with that many (k)
R transfers using the some ID.

To do so:

  - Run k axi_mgr_read_data_seq sequences, calling on_response() after
    each finishes.

  - (In parallel) call wait_for_response() k times.

The trick is that these sequences might respond with different IDs,
but that doesn't matter: the sequences are just actings as tokens to
allow *something* to come back.
Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_write_response_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_read_burst_vseq.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_agent_cfg.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_agent.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_agent.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_agent.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mon_item.svh Outdated
@tchilikov-semify

Copy link
Copy Markdown
Collaborator Author

Hey @rswarbrick,
Thanks a lot for the in-depth review! I'll go through all of the comments and address them.

In the meanwhile, I've folded the old compilation bugfixes commit into the respective commits that you made, so the commit history should be clear of bugs now.

@tchilikov-semify
tchilikov-semify force-pushed the axi_driver_pr_new branch 9 times, most recently from a5c0dab to 6550b3a Compare July 23, 2026 09:27
@tchilikov-semify

Copy link
Copy Markdown
Collaborator Author

The AXI driver has been ran past the ARM axi4 protocol assertions using the axi_sram.sv of mocha as a DUT as a preliminary validity check. The driver exercised the majority of the testcases from #667 and the assertions did not fire or indicate incorrect behavior, suggesting correct functionality thus far.

To do so, we add a (pretty trivial) reg_adapter and a sequencer in a
layered vseq that runs the resulting translated items.

Co-authored-by: tchilikov-semify <christian.tchilikov@semify-eda.com>
@tchilikov-semify
tchilikov-semify force-pushed the axi_driver_pr_new branch 4 times, most recently from c90d65e to b5b685e Compare August 17, 2026 15:12

@rswarbrick rswarbrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here are some notes about the "fix axi handshaking" and "multi-beat transaction support" commits.

These both look really good: I like the code, and it's just some nitty notes about comments.

Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_write_response_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_write_response_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_read_burst_vseq.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_read_burst_vseq.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_read_burst_vseq.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_read_burst_vseq.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_read_burst_vseq.svh Outdated

@rswarbrick rswarbrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Two more minor notes about "add multi-beat transaction support"

Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_write_listed_data_seq.svh Outdated
Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_write_listed_data_seq.svh Outdated

@rswarbrick rswarbrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A minor note about error messages in "add clk_rst_if to axi interfaces". (I really like this change though!)

Comment thread hw/ip/dv/axi_agent/axi_mgr_read_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_read_request_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_write_data_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_write_request_driver.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mgr_write_response_driver.svh Outdated

@rswarbrick rswarbrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some notes about the (excellent!) change that adds axi_widths_pkg. They're all about alignment: sorry - very boring.

Comment thread hw/ip/dv/axi_agent/seq_lib/axi_mgr_txn_request_seq.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_fixed_read_req_item.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_fixed_write_req_item.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_read_data_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_read_data_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_write_request_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_write_request_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_write_response_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_write_response_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_write_response_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_monitor.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mon_item.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mon_item.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_mon_read_item.svh
Comment thread hw/ip/dv/axi_agent/axi_mon_read_item.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_monitor.svh
Comment thread hw/ip/dv/axi_agent/axi_monitor.svh
Comment thread hw/ip/dv/axi_agent/axi_monitor.svh
Comment thread hw/ip/dv/axi_agent/axi_monitor.svh Outdated
Comment thread hw/ip/dv/axi_agent/axi_monitor.svh Outdated

@rswarbrick rswarbrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One specific question: Is there a good reason to use dv_base_agent for the IP? It's designed to a very specific OpenTitan shape, as chosen by the DV lead at the time.

It's also actively against my design for this agent. If someone more important than me mandates that we use the class, I guess we have to. If not, I'd prefer we didn't.

parameter int UserWidth = 1,
parameter uvm_pkg::uvm_active_passive_enum IsActive = uvm_pkg::UVM_ACTIVE,
parameter string InstId = "axi_mgr", // names the published axi_agent_cfg
parameter string CfgScope = "*" // config_db publish scope glob

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this design following a pattern for which you have a reference? I'm slightly surprised that you don't set things in the config db from the testbench, rather than the interface that gets instantiated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes! The intent of this file is perhaps quite unclear from the perspective of this PR... Its purpose is to take the shape of the AXI peripherals used in mocha. In our agent, the AXI bus is represented by 5 interfaces, which map to the channels. In mocha, the AXI devices have ports which are represented by 2 interfaces, basically inputs and outputs (req and resp). This interface bridges the two.

Comment thread hw/ip/dv/axi_agent/axi_vip/axi_vip_if.sv Outdated
Comment thread hw/ip/dv/axi_agent/axi_vip/axi_vip_if.sv
// clear, the payload is randomised instead: still meaningless, but defined.
//
// Defaults set, so an idle channel drives X.
bit drive_x_when_idle = 1'b1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm repeating myself here, but I think this should be set by calling a setter on the agent, which calls a setter on each of the drivers.

Note that you wrote earlier that the agent config just contained a list of virtual interfaces. I wasn't convinced. I'm still not :-)

@tchilikov-semify tchilikov-semify Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes perhaps an agent wide config permeated into the configs... You were right in this regard. 😉

For my understanding, are you proposing that the agent reads this config and then calls the setters of the drivers, rather than passing the config directly to the drivers? This value is a genuine agent-wide knob, so I think it should live in the config. Is this what you had in mind?

@tchilikov-semify

tchilikov-semify commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

One specific question: Is there a good reason to use dv_base_agent for the IP? It's designed to a very specific OpenTitan shape, as chosen by the DV lead at the time.

It's also actively against my design for this agent. If someone more important than me mandates that we use the class, I guess we have to. If not, I'd prefer we didn't.

Honestly - its not strictly needed. This was a suggestion from an internal review that Martin did with Claude, which he told me to implement if it seems fitting. I thought it was fitting, since I saw that other mocha TBs use the dv base classes, but honestly I don't have a strong opinion on this (and honestly, I think the less dependencies an independent agent has, the better).

Shall I remove it?

Merge per-channel reset monitors into a unified reset monitor
by introducing a shared clock and reset interface to the agent.
Add AXI transaction monitor which snoops the 5 channels and rebuilds
AXI transactions, then broadcasts them. Monitor is built
unconditionally.
@tchilikov-semify

Copy link
Copy Markdown
Collaborator Author

Hey @rswarbrick - thanks for the in depth review again! It seems this PR is starting to come together 😄 I think I've addressed most of your comments. There's still 1 or 2 open questions, but I've re-triggered another review. Thanks!

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.

AXI crossbar DV - Top-level AXI monitor to feed the scoreboard

2 participants