Skip to content

Commit

Permalink
adding read-only csr mconfigptr
Browse files Browse the repository at this point in the history
mconfigptr is used by the unified discovery task group  https://github.com/riscv/configuration-structure
  • Loading branch information
dansmathers authored Aug 16, 2023
1 parent 58cac61 commit fbb7edc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions model/riscv_csr_map.sail
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ mapping clause csr_name_map = 0xF11 <-> "mvendorid"
mapping clause csr_name_map = 0xF12 <-> "marchid"
mapping clause csr_name_map = 0xF13 <-> "mimpid"
mapping clause csr_name_map = 0xF14 <-> "mhartid"
mapping clause csr_name_map = 0xF15 <-> "mconfigptr"
/* machine trap setup */
mapping clause csr_name_map = 0x300 <-> "mstatus"
mapping clause csr_name_map = 0x301 <-> "misa"
Expand Down
1 change: 1 addition & 0 deletions model/riscv_insts_zicsr.sail
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function readCSR csr : csreg -> xlenbits = {
(0xF12, _) => marchid,
(0xF13, _) => mimpid,
(0xF14, _) => mhartid,
(0xF15, _) => mconfigptr,
(0x300, _) => mstatus.bits(),
(0x301, _) => misa.bits(),
(0x302, _) => medeleg.bits(),
Expand Down
2 changes: 2 additions & 0 deletions model/riscv_sys_control.sail
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ function is_CSR_defined (csr : csreg, p : Privilege) -> bool =
0xf12 => p == Machine, // marchdid
0xf13 => p == Machine, // mimpid
0xf14 => p == Machine, // mhartid
0xf15 => p == Machine, // mconfigptr
/* machine mode: trap setup */
0x300 => p == Machine, // mstatus
0x301 => p == Machine, // misa
Expand Down Expand Up @@ -552,6 +553,7 @@ function init_sys() -> unit = {
cur_privilege = Machine;

mhartid = zero_extend(0b0);
mconfigptr = zero_extend(0b0);

misa->MXL() = arch_to_bits(if sizeof(xlen) == 32 then RV32 else RV64);
misa->A() = 0b1; /* atomics */
Expand Down
1 change: 1 addition & 0 deletions model/riscv_sys_regs.sail
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ register mimpid : xlenbits
register marchid : xlenbits
/* TODO: this should be readonly, and always 0 for now */
register mhartid : xlenbits
register mconfigptr : xlenbits

/* S-mode registers */

Expand Down

0 comments on commit fbb7edc

Please sign in to comment.