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

Fix incorrect handling of 64-bit CSR in 32-bit mode: no truncate when updating RegisterFile #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FrBrGeorge
Copy link

RARS loops forever when running the following code

        li      a1 3000
        csrr    t2 time
        add     t2 t2 a1
m.loop:
        csrr    t0 time
        # mv    t0 t0
        bgeu    t2 t0 m.loop
        li      a7 10
        ecall

But after uncommenting # mv t0 t0 the code runs as expected (sleeps for 3 seconds).

This happened, I believe, when calling RegisterBlock.updateRegister e. g. here without truncating 64-bit values of a CSR. As the result, t0 keeps value larger than 32-bit MAX_VALUE until any operation is performed on it.

Simplest way is to fix this near the root of the problem — when updating a register block (otherwise we have to check out all the 32/64 API mismatches though the code).

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

1 participant