Skip to content

DRAM loading in Verilator#392

Open
ziuziakowska wants to merge 4 commits intolowRISC:mainfrom
ziuziakowska:verilator-dram
Open

DRAM loading in Verilator#392
ziuziakowska wants to merge 4 commits intolowRISC:mainfrom
ziuziakowska:verilator-dram

Conversation

@ziuziakowska
Copy link
Copy Markdown
Contributor

@ziuziakowska ziuziakowska commented Mar 31, 2026

Adds the DRAM as a memory area that can be loaded on the command line, so that we can skip the bootloader in Verilator in the future.

The memory can be loaded into using multiple -E flags to load binaries into the corresponding memory areas, or using the -r and -m flags to explicitly load into ROM/SRAM or DRAM.

We currently don't use this functionality as we still need a Verilator bypass in the boot ROM before we can run all tests from DRAM on all environments.

Added a test now, needed quite a bit of machinery to get it going (needed the ability to load multiple ELF's with the test runner, compile and link for DRAM which we do not do yet) but that should be cleaned up once we can load all our tests into DRAM in addition to just SRAM.

Closes #377.

@ziuziakowska ziuziakowska force-pushed the verilator-dram branch 2 times, most recently from 1b61868 to 67fb035 Compare March 31, 2026 09:22
@ziuziakowska ziuziakowska marked this pull request as ready for review March 31, 2026 09:25
Copy link
Copy Markdown
Collaborator

@engdoreis engdoreis left a comment

Choose a reason for hiding this comment

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

LGTM, but I think that Marno is the best to review this.
Can you please add a verilator DRAM smoketest to make sure this will not break in follow up PRs.

Copy link
Copy Markdown
Collaborator

@marnovandermaas marnovandermaas left a comment

Choose a reason for hiding this comment

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

It would be good to have a test in CI for making sure that this works. Is that something you can add before we merge this PR?

@marnovandermaas
Copy link
Copy Markdown
Collaborator

I was also thinking if we can map things using the -E command then maybe we shouldn't create the patch for the -r -m commands at all. This minimises the amount of patches we need to maintain.

@ziuziakowska ziuziakowska force-pushed the verilator-dram branch 2 times, most recently from 5d00653 to 34aabd0 Compare March 31, 2026 13:14
@ziuziakowska
Copy link
Copy Markdown
Contributor Author

I was also thinking if we can map things using the -E command then maybe we shouldn't create the patch for the -r -m commands at all. This minimises the amount of patches we need to maintain.

Yeah I was unsure about that one. Multiple -Es works fine so we should just use that.

Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
Copy link
Copy Markdown
Collaborator

@marnovandermaas marnovandermaas left a comment

Choose a reason for hiding this comment

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

This is great, is there a way we can test this change before merging? Preferably in CI. That's the only thing stopping me from approving this PR right now.

@ziuziakowska ziuziakowska force-pushed the verilator-dram branch 7 times, most recently from 804884d to b0b2e41 Compare April 2, 2026 12:04
@ziuziakowska ziuziakowska mentioned this pull request Apr 2, 2026
6 tasks
Copy link
Copy Markdown
Collaborator

@engdoreis engdoreis left a comment

Choose a reason for hiding this comment

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

I'm sorry for not being clear when I asked for a test. I had in mind a test similar in structure to this one. The one you implemented in this PR is not wrong, but since it is basically the bootroom in the near feature, so it won't add extra coverage.

Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
This is needed for building executables to run in DRAM which starts at 2
GiB, the `medlow` code model can only address the first and last 2 GiB
in RV64 so DRAM is just out of its range.

Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@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.

DRAM in Verilator simulation

3 participants