Skip to content
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

CSR dump #38

Merged
merged 14 commits into from
Sep 4, 2023
Merged

CSR dump #38

merged 14 commits into from
Sep 4, 2023

Conversation

viv-eth
Copy link
Contributor

@viv-eth viv-eth commented Aug 22, 2023

This utility was inspired by MemPool to enable single cycle printf in RTL simulation.
This will not work on the actual hardware, but aids debugging.

You have the option to interpret the register values as either 32-bit float values or 32-bit unsigned integers. Depending on what kind of data you want to display, use the dump_float or dump_uint utility, respectively.

As an example, define dump_float(<name>, <csr_reg_ID> at the beginning of the file you want to debug. Afterward, you can dump the values to the output of the RTL simulation by calling dump_<name>(<value>).

You have to be careful when selecting the csr_reg_ID as it must not be an invalid register ID.

@viv-eth viv-eth enabled auto-merge (squash) August 22, 2023 18:39
@fischeti
Copy link
Contributor

fischeti commented Sep 4, 2023

Otherwise LGTM. Thanks!

hw/snitch/src/snitch.sv Outdated Show resolved Hide resolved
hw/snitch/src/snitch.sv Outdated Show resolved Hide resolved
@colluca
Copy link
Collaborator

colluca commented Sep 4, 2023

I think before we merge this we should discuss the purpose of it. I don't see a reason why we need this or why we should prefer this over the existing printf implementation.

@fischeti
Copy link
Contributor

fischeti commented Sep 4, 2023

I think before we merge this we should discuss the purpose of it. I don't see a reason why we need this or why we should prefer this over the existing printf implementation.

I kind of like the feature. Mostly because it speeds up debugging of RTL simulations. A single printf takes 100x of cycles and normally takes much longer than the actual computation, which is why I avoided it most of the time. The alternative is to look at the traces, but this is always more cumbersome to debug. So I think this feature would be quite handy imo

@viv-eth viv-eth merged commit 0e0e19d into main Sep 4, 2023
22 of 24 checks passed
@viv-eth viv-eth deleted the csr_dump branch September 4, 2023 12:12
viv-eth added a commit that referenced this pull request Sep 4, 2023
This reverts commit 0e0e19d.
@viv-eth viv-eth mentioned this pull request Sep 4, 2023
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.

None yet

3 participants