Skip to content

Commit 2b3166a

Browse files
committed
Add FFLAG support in csr-relative instuctions
1 parent 87688d7 commit 2b3166a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

emulate.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,10 @@ static uint32_t csr_csrrw(struct riscv_t *rv, uint32_t csr, uint32_t val)
639639
if (!c)
640640
return 0;
641641

642-
const uint32_t out = *c;
642+
uint32_t out = *c;
643+
if (csr == CSR_FFLAGS)
644+
out &= FFLAG_MASK;
645+
643646
if (csr_is_writable(csr))
644647
*c = val;
645648

@@ -670,7 +673,10 @@ static uint32_t csr_csrrc(struct riscv_t *rv, uint32_t csr, uint32_t val)
670673
if (!c)
671674
return 0;
672675

673-
const uint32_t out = *c;
676+
uint32_t out = *c;
677+
if (csr == CSR_FFLAGS)
678+
out &= FFLAG_MASK;
679+
674680
if (csr_is_writable(csr))
675681
*c &= ~val;
676682
return out;

0 commit comments

Comments
 (0)