From 08ed87bc9d1197f9c997c4d3ca686dec8f0bd033 Mon Sep 17 00:00:00 2001 From: QQeg <0909kfcmailo@gmail.com> Date: Fri, 26 Jan 2024 15:18:07 +0000 Subject: [PATCH] arch-riscv: Add template Vector1Vs1VdMaskDeclare This commit adds a new template, Vector1Vs1VdMaskDeclare, to replace the use of Vector1Vs1RdMaskDeclare in Vector1Vs1VdMaskFormat. The change addresses the issue with the number of indices in srcRegIdxArr. Only two indices are available in Vector1Vs1RdMaskDeclare, but instructions that use Vector1Vs1VdMaskFormat, like 'vmsbf', require three indices (for vs1, vs2(old_vd), and vm) to function correctly. Change-Id: I0c966e11289ce07efcc3b0cc56948311289530ad --- src/arch/riscv/isa/formats/vector_arith.isa | 2 +- src/arch/riscv/isa/templates/vector_arith.isa | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/arch/riscv/isa/formats/vector_arith.isa b/src/arch/riscv/isa/formats/vector_arith.isa index 1ddf323f04..7f87f1e163 100644 --- a/src/arch/riscv/isa/formats/vector_arith.isa +++ b/src/arch/riscv/isa/formats/vector_arith.isa @@ -1049,7 +1049,7 @@ def format Vector1Vs1VdMaskFormat(code, category, *flags){{ }, flags) - header_output = Vector1Vs1RdMaskDeclare.subst(iop) + header_output = Vector1Vs1VdMaskDeclare.subst(iop) decoder_output = Vector1Vs1VdMaskConstructor.subst(iop) exec_output = Vector1Vs1VdMaskExecute.subst(iop) decode_block = VectorMaskDecodeBlock.subst(iop) diff --git a/src/arch/riscv/isa/templates/vector_arith.isa b/src/arch/riscv/isa/templates/vector_arith.isa index 12eab95246..c808f08ee4 100644 --- a/src/arch/riscv/isa/templates/vector_arith.isa +++ b/src/arch/riscv/isa/templates/vector_arith.isa @@ -951,6 +951,21 @@ Fault }}; +def template Vector1Vs1VdMaskDeclare {{ + +template +class %(class_name)s : public %(base_class)s { +private: + RegId srcRegIdxArr[3]; + RegId destRegIdxArr[1]; + bool vm; +public: + %(class_name)s(ExtMachInst _machInst); + Fault execute(ExecContext* xc, trace::InstRecord* traceData)const override; + using %(base_class)s::generateDisassembly; +}; + +}}; def template Vector1Vs1VdMaskConstructor {{