diff options
| author | Alasdair Armstrong | 2018-05-02 14:16:45 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-05-03 20:08:20 +0100 |
| commit | eac018f577819c59b005d5f47fdab6b53e78d1e5 (patch) | |
| tree | 4bf7b9593c0f74be9358d0a556991f90fb498420 /riscv | |
| parent | 0e79825b9208a947a19b66b1221cdc890d425ec1 (diff) | |
Fix duopod with latest riscv prelude
Diffstat (limited to 'riscv')
| -rw-r--r-- | riscv/riscv_duopod.sail | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/riscv/riscv_duopod.sail b/riscv/riscv_duopod.sail index 687c7e64..ddb4f6e5 100644 --- a/riscv/riscv_duopod.sail +++ b/riscv/riscv_duopod.sail @@ -5,6 +5,9 @@ type xlen_t = bits(64) type regno ('n : Int), 0 <= 'n < 32 = atom('n) type regbits = bits(5) +val zeros : forall 'n. atom('n) -> bits('n) +function zeros n = replicate_bits(0b0, n) + val cast regbits_to_regno : bits(5) -> {'n, 0 <= 'n < 32. regno('n)} function regbits_to_regno b = let r as atom(_) = unsigned(b) in r @@ -33,7 +36,8 @@ overload X = {rX, wX} /* Accessors for memory */ val MEMr : forall 'n. (xlen_t, atom('n)) -> bits(8 * 'n) effect {rmem} -function MEMr (addr, width) = __RISCV_read(addr, width) +function MEMr (addr, width) = + match __RISCV_read(addr, width) { Some(v) => v, None() => zeros(8 * width) } /* Instruction decode and execute */ enum iop = {RISCV_ADDI, RISCV_SLTI, RISCV_SLTIU, RISCV_XORI, RISCV_ORI, RISCV_ANDI} /* immediate ops */ |
