diff options
author | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-02-11 12:07:16 -0800 |
---|---|---|
committer | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-02-11 12:38:03 -0800 |
commit | 04431f38e310ff979aee6bd9b10966ffb11b5045 (patch) | |
tree | 6ca6245da59ead5bb8bb09b49c81d1011dfa6577 /model/prelude.sail | |
parent | 51403b862956f13a7a4fbbdd3adb72ee3518db12 (diff) | |
download | sail-riscv-04431f38e310ff979aee6bd9b10966ffb11b5045.zip sail-riscv-04431f38e310ff979aee6bd9b10966ffb11b5045.tar.gz sail-riscv-04431f38e310ff979aee6bd9b10966ffb11b5045.tar.bz2 |
More refactoring for RV32
- split out memory access definitions in prelude that depend on xlen
- make riscv_xlen now part of the prelude set, so that riscv_duopod can use the definition
- update xlen use in riscv_duopod so that it can now support rv32
Diffstat (limited to 'model/prelude.sail')
-rw-r--r-- | model/prelude.sail | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/model/prelude.sail b/model/prelude.sail index 6ed8554..33638aa 100644 --- a/model/prelude.sail +++ b/model/prelude.sail @@ -268,73 +268,6 @@ overload min = {min_nat, min_int} overload max = {max_nat, max_int} -val __WriteRAM = {lem: "MEMw", _: "write_ram"} : forall 'n 'm. - (atom('m), atom('n), bits('m), bits('m), bits(8 * 'n)) -> bool effect {wmv} - -val __WriteRAM_release = {lem: "MEMw_release", _: "write_ram"} : forall 'n 'm. - (atom('m), atom('n), bits('m), bits('m), bits(8 * 'n)) -> bool effect {wmv} - -val __WriteRAM_strong_release = {lem: "MEMw_strong_release", _: "write_ram"} : forall 'n 'm. - (atom('m), atom('n), bits('m), bits('m), bits(8 * 'n)) -> bool effect {wmv} - -val __WriteRAM_conditional = {lem: "MEMw_conditional", _: "write_ram"} : forall 'n 'm. - (atom('m), atom('n), bits('m), bits('m), bits(8 * 'n)) -> bool effect {wmv} - -val __WriteRAM_conditional_release = {lem: "MEMw_conditional_release", _: "write_ram"} : forall 'n 'm. - (atom('m), atom('n), bits('m), bits('m), bits(8 * 'n)) -> bool effect {wmv} - -val __WriteRAM_conditional_strong_release = {lem: "MEMw_conditional_strong_release", _: "write_ram"} : forall 'n 'm. - (atom('m), atom('n), bits('m), bits('m), bits(8 * 'n)) -> bool effect {wmv} - -val __RISCV_write : forall 'n. (bits(64), atom('n), bits(8 * 'n), bool, bool, bool) -> bool effect {wmv} -function __RISCV_write (addr, width, data, aq, rl, con) = - match (aq, rl, con) { - (false, false, false) => __WriteRAM(64, width, 0x0000_0000_0000_0000, addr, data), - (false, true, false) => __WriteRAM_release(64, width, 0x0000_0000_0000_0000, addr, data), - (false, false, true) => __WriteRAM_conditional(64, width, 0x0000_0000_0000_0000, addr, data), - (false, true, true) => __WriteRAM_conditional_release(64, width, 0x0000_0000_0000_0000, addr, data), - (true, true, false) => __WriteRAM_strong_release(64, width, 0x0000_0000_0000_0000, addr, data), - (true, true, true) => __WriteRAM_conditional_strong_release(64, width, 0x0000_0000_0000_0000, addr, data), - (true, false, false) => false, - (true, false, true) => false - } - -val __TraceMemoryWrite : forall 'n 'm. - (atom('n), bits('m), bits(8 * 'n)) -> unit - -val __ReadRAM = { lem: "MEMr", _ : "read_ram" } : forall 'n 'm, 'n >= 0. - (atom('m), atom('n), bits('m), bits('m)) -> bits(8 * 'n) effect {rmem} - -val __ReadRAM_acquire = { lem: "MEMr_acquire", _ : "read_ram" } : forall 'n 'm, 'n >= 0. - (atom('m), atom('n), bits('m), bits('m)) -> bits(8 * 'n) effect {rmem} - -val __ReadRAM_strong_acquire = { lem: "MEMr_strong_acquire", _ : "read_ram" } : forall 'n 'm, 'n >= 0. - (atom('m), atom('n), bits('m), bits('m)) -> bits(8 * 'n) effect {rmem} - -val __ReadRAM_reserved = { lem: "MEMr_reserved", _ : "read_ram" } : forall 'n 'm, 'n >= 0. - (atom('m), atom('n), bits('m), bits('m)) -> bits(8 * 'n) effect {rmem} - -val __ReadRAM_reserved_acquire = { lem: "MEMr_reserved_acquire", _ : "read_ram" } : forall 'n 'm, 'n >= 0. - (atom('m), atom('n), bits('m), bits('m)) -> bits(8 * 'n) effect {rmem} - -val __ReadRAM_reserved_strong_acquire = { lem: "MEMr_reserved_strong_acquire", _ : "read_ram" } : forall 'n 'm, 'n >= 0. - (atom('m), atom('n), bits('m), bits('m)) -> bits(8 * 'n) effect {rmem} - -val __RISCV_read : forall 'n, 'n >= 0. (bits(64), atom('n), bool, bool, bool) -> option(bits(8 * 'n)) effect {rmem} -function __RISCV_read (addr, width, aq, rl, res) = - match (aq, rl, res) { - (false, false, false) => Some(__ReadRAM(64, width, 0x0000_0000_0000_0000, addr)), - (true, false, false) => Some(__ReadRAM_acquire(64, width, 0x0000_0000_0000_0000, addr)), - (true, true, false) => Some(__ReadRAM_strong_acquire(64, width, 0x0000_0000_0000_0000, addr)), - (false, false, true) => Some(__ReadRAM_reserved(64, width, 0x0000_0000_0000_0000, addr)), - (true, false, true) => Some(__ReadRAM_reserved_acquire(64, width, 0x0000_0000_0000_0000, addr)), - (true, true, true) => Some(__ReadRAM_reserved_strong_acquire(64, width, 0x0000_0000_0000_0000, addr)), - (false, true, false) => None(), - (false, true, true) => None() - } - -val __TraceMemoryRead : forall 'n 'm. (atom('n), bits('m), bits(8 * 'n)) -> unit - val replicate_bits = "replicate_bits" : forall 'n 'm, 'm >= 0. (bits('n), atom('m)) -> bits('n * 'm) val cast ex_nat : nat -> {'n, 'n >= 0. atom('n)} |