From 8f461b63b41224e23d1da031e5b6533f99aeecac Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Tue, 21 Mar 2023 21:54:04 +0000 Subject: [PATCH] Fix mvsa01/mva01s in rvcpp --- test/sim/rvcpp/Makefile | 2 +- test/sim/rvcpp/rv.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sim/rvcpp/Makefile b/test/sim/rvcpp/Makefile index 76b4e3c..535922d 100644 --- a/test/sim/rvcpp/Makefile +++ b/test/sim/rvcpp/Makefile @@ -8,4 +8,4 @@ all: g++ -std=c++17 -O3 -Wall -Wno-parentheses $(SRCS) -o $(EXECUTABLE) clean: - rm -f (EXECUTABLE) + rm -f $(EXECUTABLE) diff --git a/test/sim/rvcpp/rv.cpp b/test/sim/rvcpp/rv.cpp index b694d1d..823ebd3 100644 --- a/test/sim/rvcpp/rv.cpp +++ b/test/sim/rvcpp/rv.cpp @@ -134,7 +134,7 @@ static inline uint32_t zcmp_reg_mask(uint32_t instr) { } static inline uint zcmp_s_mapping(uint s_raw) { - return s_raw + 8 + 8 * ((s_raw & 0x6) == 0); + return s_raw + 8 + 8 * ((s_raw & 0x6) != 0); } struct RVCSR { @@ -568,10 +568,10 @@ struct RVCore { regnum_rd = 2; rd_wdata = regs[2] + zcmp_stack_adj(instr); } else if (RVOPC_MATCH(instr, CM_MVSA01)) { - regs[zcmp_s_mapping(GETBITS(instr, 9, 8))] = regs[10]; + regs[zcmp_s_mapping(GETBITS(instr, 9, 7))] = regs[10]; regs[zcmp_s_mapping(GETBITS(instr, 4, 2))] = regs[11]; } else if (RVOPC_MATCH(instr, CM_MVA01S)) { - regs[10] = regs[zcmp_s_mapping(GETBITS(instr, 9, 8))]; + regs[10] = regs[zcmp_s_mapping(GETBITS(instr, 9, 7))]; regs[11] = regs[zcmp_s_mapping(GETBITS(instr, 4, 2))]; } else { instr_invalid = true;