Skip to content

Commit

Permalink
Check for mstatus.FS when performing half-precision loads/stores
Browse files Browse the repository at this point in the history
Half-precision loads/stores should not be allowed if mstatus.FS is set to
0 to match single/double-precision ones.
  • Loading branch information
arichardson committed Apr 10, 2023
1 parent 72b2516 commit 729df27
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions model/riscv_sys_regs.sail
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ function haveZbb() -> bool = true
function haveZbc() -> bool = true
function haveZbs() -> bool = true

/* Zfh (half-precision) extension */
function haveZfh() -> bool = true

/* Scalar Cryptography extensions support. */
function haveZbkb() -> bool = true
function haveZbkc() -> bool = true
Expand Down Expand Up @@ -350,6 +347,8 @@ function in32BitMode() -> bool = {
/* F and D extensions have to enabled both via misa.{FD} as well as mstatus.FS */
function haveFExt() -> bool = (misa.F() == 0b1) & (mstatus.FS() != 0b00)
function haveDExt() -> bool = (misa.D() == 0b1) & (mstatus.FS() != 0b00)
/* Zfh (half-precision) extension depends on misa.F and mstatus.FS */
function haveZfh() -> bool = (misa.F() == 0b1) & (mstatus.FS() != 0b00)

/* Zhinx, Zfinx and Zdinx extensions (TODO: gate FCSR access on [mhs]stateen0 bit 1 when implemented) */
function haveZhinx() -> bool = sys_enable_zfinx()
Expand Down

0 comments on commit 729df27

Please sign in to comment.