Skip to content

[rtl,sw] Add capability tag reset logic for AXI SRAM - #812

Open
raylau1 wants to merge 5 commits into
lowRISC:mainfrom
raylau1:sram-tag-reset
Open

raylau1 wants to merge 5 commits into
lowRISC:mainfrom
raylau1:sram-tag-reset

Conversation

@raylau1

@raylau1 raylau1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Adds logic to clear all capability tag bits when the AXI SRAM is reset.

Closes #808.

@raylau1 raylau1 self-assigned this Nov 23, 2026
@raylau1

raylau1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Marking as draft as axi_sram_smoke tests in DV seem to get stuck when running from SRAM.

@raylau1
raylau1 marked this pull request as draft November 23, 2026 11:52
@raylau1
raylau1 force-pushed the sram-tag-reset branch 2 times, most recently from 0645f53 to 84ad284 Compare November 23, 2026 15:46
@raylau1

raylau1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

All chip_sim DV smoke tests passing, except rom_ctrl_smoke*, matching the nightly result.

@raylau1
raylau1 marked this pull request as ready for review November 23, 2026 16:03

@marnovandermaas marnovandermaas 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.

Nice work! Very important. I've left a few comments but nearly ready to go I believe.

// Get capability to storage in t0.
"lly t0, storage\n\t"
// Get capability to AXI SRAM in t0.
"auipc t0, 0\n\t"

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.

Since the PC is in DRAM, how does this have access to SRAM?

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.

Maybe instead of doing this we should add a function to the mocha.h HAL to get a capability to the SRAM like we have for DRAM:

void *mocha_system_dram(void);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The following yaddrw instruction sets the capability address to sram_base, provided via %16. The intention of doing this in assembly is to keep the accesses as rapid as possible, ideally back-to-back. Moving to C may change that.

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.

Agreed on the accesses, those should stay in assembly, but for getting the capability to SRAM, we could use a C function right? I think this would be more robust than deriving it from PCC.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After discussion with Marno, we decided to pass the SRAM base address to assembly via sram_base for now. Replacing these with calls to mocha_system_sram can be in a future PR.

Comment thread hw/top_chip/rtl/axi_sram.sv Resolved
Comment thread hw/top_chip/rtl/axi_sram.sv Resolved
Comment thread hw/top_chip/rtl/axi_sram.sv Resolved
Comment thread hw/top_chip/rtl/axi_sram.sv Resolved

@marnovandermaas marnovandermaas 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.

Some minor comments which would be good to resolve but otherwise I'm happy for this to go in.

Comment thread hw/top_chip/rtl/axi_sram.sv Resolved
Comment thread hw/top_chip/rtl/axi_sram.sv Resolved
Comment thread hw/top_chip/rtl/axi_sram.sv Resolved
Since the sw smoketests now run from DRAM, the storage area in
assembly is located in DRAM, causing the AXI SRAM tests to test
memory locations in DRAM.

This fix makes sure the tests are done on SRAM locations.

Signed-off-by: Ray Lau <ray.lau@lowrisc.org>
@raylau1
raylau1 force-pushed the sram-tag-reset branch 2 times, most recently from 646b209 to cd15da3 Compare November 27, 2026 17:05
Signed-off-by: Ray Lau <ray.lau@lowrisc.org>
Signed-off-by: Ray Lau <ray.lau@lowrisc.org>
Signed-off-by: Ray Lau <ray.lau@lowrisc.org>
Signed-off-by: Ray Lau <ray.lau@lowrisc.org>
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.

SRAM tag clearing at reset

2 participants