Skip to content

Commit

Permalink
Move ILLEGAL/C_ILLEGAL ast declaration to riscv_insts_begin.sail (ris…
Browse files Browse the repository at this point in the history
…cv#223)

This is useful for the sail-cheri-riscv model, where we would like to
reuse C_ILLEGAL, but can't right now since it is current defined too late.

It is needed for CTSRD-CHERI/sail-cheri-riscv#69
  • Loading branch information
arichardson authored Mar 14, 2023
1 parent ad13bf2 commit 6df1e78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 9 additions & 0 deletions model/riscv_insts_begin.sail
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,12 @@ scattered mapping encdec

val encdec_compressed : ast <-> bits(16) effect {rreg}
scattered mapping encdec_compressed

/*
* We declare the ILLEGAL/C_ILLEGAL ast clauses here instead of in
* riscv_insts_end, so that model extensions can make use of them.
* However, the encdec mapping must come last to ensure that all
* unmatched encodings decode to an illegal instruction.
*/
union clause ast = ILLEGAL : word
union clause ast = C_ILLEGAL : half
4 changes: 0 additions & 4 deletions model/riscv_insts_end.sail
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@

/* ****************************************************************** */

union clause ast = ILLEGAL : word

mapping clause encdec = ILLEGAL(s) <-> s

function clause execute (ILLEGAL(s)) = { handle_illegal(); RETIRE_FAIL }
Expand All @@ -80,8 +78,6 @@ mapping clause assembly = ILLEGAL(s) <-> "illegal" ^ spc() ^ hex_bits_32(s)

/* ****************************************************************** */

union clause ast = C_ILLEGAL : half

mapping clause encdec_compressed = C_ILLEGAL(s) <-> s

function clause execute C_ILLEGAL(s) = { handle_illegal(); RETIRE_FAIL }
Expand Down

0 comments on commit 6df1e78

Please sign in to comment.