From ac42b46f901736865fef15a30bf79b96010ba3fc Mon Sep 17 00:00:00 2001 From: KotorinMinami <98281165+KotorinMinami@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:27:05 +0800 Subject: [PATCH] Add extensionEnabled(Ext_V) guards for vector registers Add missing guards for the vector CSRs and move the Ext_V definition to ensure compilation succeeds. --- model/riscv_insts_vext_vset.sail | 2 -- model/riscv_vext_control.sail | 17 ++++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/model/riscv_insts_vext_vset.sail b/model/riscv_insts_vext_vset.sail index f7c8395cd..22c9d56f7 100644 --- a/model/riscv_insts_vext_vset.sail +++ b/model/riscv_insts_vext_vset.sail @@ -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, diff --git a/model/riscv_vext_control.sail b/model/riscv_vext_control.sail index 0113ad636..d2d2c184b 100755 --- a/model/riscv_vext_control.sail +++ b/model/riscv_vext_control.sail @@ -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" @@ -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])