Skip to content

Commit

Permalink
Add extensionEnabled(Ext_V) guards for vector registers
Browse files Browse the repository at this point in the history
Add missing guards for the vector CSRs and move the Ext_V definition to ensure compilation succeeds.
  • Loading branch information
KotorinMinami authored Nov 29, 2024
1 parent e3e79d2 commit ac42b46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 0 additions & 2 deletions model/riscv_insts_vext_vset.sail
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
/* Chapter 6: Configuration-Setting Instructions */
/* ******************************************************************************* */

enum clause extension = Ext_V
function clause extensionEnabled(Ext_V) = (misa[V] == 0b1) & (mstatus[VS] != 0b00)

mapping sew_flag : string <-> bits(3) = {
"e8" <-> 0b000,
Expand Down
17 changes: 10 additions & 7 deletions model/riscv_vext_control.sail
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*=======================================================================================*/

enum clause extension = Ext_V
function clause extensionEnabled(Ext_V) = (misa[V] == 0b1) & (mstatus[VS] != 0b00)

mapping clause csr_name_map = 0x008 <-> "vstart"
mapping clause csr_name_map = 0x009 <-> "vxsat"
mapping clause csr_name_map = 0x00A <-> "vxrm"
Expand All @@ -14,13 +17,13 @@ mapping clause csr_name_map = 0xC20 <-> "vl"
mapping clause csr_name_map = 0xC21 <-> "vtype"
mapping clause csr_name_map = 0xC22 <-> "vlenb"

function clause is_CSR_defined (0x008) = true
function clause is_CSR_defined (0x009) = true
function clause is_CSR_defined (0x00A) = true
function clause is_CSR_defined (0x00F) = true
function clause is_CSR_defined (0xC20) = true
function clause is_CSR_defined (0xC21) = true
function clause is_CSR_defined (0xC22) = true
function clause is_CSR_defined (0x008) = extensionEnabled(Ext_V) // vstart
function clause is_CSR_defined (0x009) = extensionEnabled(Ext_V) // vxsat
function clause is_CSR_defined (0x00A) = extensionEnabled(Ext_V) // vxrm
function clause is_CSR_defined (0x00F) = extensionEnabled(Ext_V) // vcsr
function clause is_CSR_defined (0xC20) = extensionEnabled(Ext_V) // vl
function clause is_CSR_defined (0xC21) = extensionEnabled(Ext_V) // vtype
function clause is_CSR_defined (0xC22) = extensionEnabled(Ext_V) // vlenb

function clause read_CSR(0x008) = zero_extend(vstart)
function clause read_CSR(0x009) = zero_extend(vcsr[vxsat])
Expand Down

0 comments on commit ac42b46

Please sign in to comment.