Skip to content

Conversation

@qwe661234
Copy link
Collaborator

The issue occurs when the variable csr undergoes sign-extension. Specifically, the values of CSR_CYCLE and CSR_CYCLEH are assigned as 0xC00 and 0xC80 respectively. During the decoding immediate stage, these values are unintentionally sign-extended to 0xFFFFFC00 and 0xFFFFFC80. To mitigate this problem, a solution is only the last 12 bits of csr are considered, disregarding the sign extension.

Solve: #139

The issue occurs when the variable csr undergoes sign-extension. Specifically,
the values of CSR_CYCLE and CSR_CYCLEH are assigned as 0xC00 and 0xC80 respectively.
During the decoding immediate stage, these values are unintentionally sign-extended
to 0xFFFFFC00 and 0xFFFFFC80. To mitigate this problem, a solution is only
the last 12 bits of csr are considered, disregarding the sign extension.

Solve: sysprog21#139
@jserv jserv merged commit 206094b into sysprog21:master Jun 2, 2023
@qwe661234 qwe661234 deleted the FIx_perfcounter branch June 3, 2023 02:56
2011eric pushed a commit to 2011eric/rv32emu that referenced this pull request Jul 22, 2023
The issue occurs when the CSR undergoes sign-extension. Specifically, the values
of CSR_CYCLE and CSR_CYCLEH are assigned as 0xC00 and 0xC80 respectively.
During the decoding immediate stage, these values are unintentionally sign-extended
to 0xFFFFFC00 and 0xFFFFFC80. To mitigate this problem, a solution is only
the last 12 bits of CSR are considered, disregarding the sign extension.

Close sysprog21#139
vestata pushed a commit to vestata/rv32emu that referenced this pull request Jan 24, 2025
The issue occurs when the CSR undergoes sign-extension. Specifically, the values
of CSR_CYCLE and CSR_CYCLEH are assigned as 0xC00 and 0xC80 respectively.
During the decoding immediate stage, these values are unintentionally sign-extended
to 0xFFFFFC00 and 0xFFFFFC80. To mitigate this problem, a solution is only
the last 12 bits of CSR are considered, disregarding the sign extension.

Close sysprog21#139
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.

2 participants