diff options
Diffstat (limited to 'model/riscv_csr_ext.sail')
-rw-r--r-- | model/riscv_csr_ext.sail | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/model/riscv_csr_ext.sail b/model/riscv_csr_ext.sail new file mode 100644 index 0000000..ea4f065 --- /dev/null +++ b/model/riscv_csr_ext.sail @@ -0,0 +1,20 @@ +/* Extensions may want to add additional CSR registers to the CSR address map. + * These functions support access to such registers. + * + * The default implementation provides access to the CSRs added by the 'N' + * extension. + */ + +/* returns whether a CSR is defined and accessible at a given address + * and privilege + */ +function ext_is_CSR_defined(csr : csreg, p : Privilege) -> bool = + is_NExt_CSR_defined(csr, p) // 'N' extension + +/* returns the value of the CSR if it is defined */ +function ext_read_CSR(csr : csreg) -> option(xlenbits) = + read_NExt_CSR(csr) + +/* returns false if the CSR is not defined or if the write is unsuccessful */ +function ext_write_CSR(csr : csreg, value : xlenbits) -> bool = + write_NExt_CSR(csr, value) |