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

Bug report: minstret counts with an offset #637

Open
flaviens opened this issue May 7, 2023 · 0 comments
Open

Bug report: minstret counts with an offset #637

flaviens opened this issue May 7, 2023 · 0 comments

Comments

@flaviens
Copy link
Contributor

flaviens commented May 7, 2023

Hi there!

I discovered a little bug in BOOM.
The riscv 1.12 privileged spec states:

Any CSR write takes effect after the writing instruction has otherwise completed.

However, this seems not to be respected by BOOM.

Example snippet

The stored value of t0 should be 0, however with BOOM it is 1. Spike, CVA6 and Rocket count without the offset that we observe on BOOM.

  .section ".text.init","ax",@progbits
  .globl _start
  .align 2
_start:

  li a0, 0x60000010

  csrrw zero, minstret, zero
  csrrw t0, minstret, zero

  sw t0, (a0)
  sw zero, (zero)

infinite_loop0:
  j infinite_loop0

RTL implications
Minor RTL modification.

What is the use case for changing the behavior?
RISC-V compliant instruction counting.

I'm using Chipyard 1.8.1.

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

No branches or pull requests

1 participant