From b1a327cccf674dbb173b4c1fa57d240f90e05ffe Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Thu, 19 Oct 2023 13:29:10 +0200 Subject: [PATCH] Added FIXME messages for mulh --- src/cpu/rv32cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpu/rv32cpu.c b/src/cpu/rv32cpu.c index 2dd03d8..9d7feec 100644 --- a/src/cpu/rv32cpu.c +++ b/src/cpu/rv32cpu.c @@ -371,6 +371,7 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) break; case FUNC7_MULH: // MULtiplication High (32 high bits) (signed * signed) + // FIXME: This is wrong, we should sign extend the int64_t i guess uint64_t mulh_result = (uint64_t) (((int64_t) cpu->regs.x[instruction->rs1]) * ((int64_t) cpu->regs.x[instruction->rs2])); cpu->regs.x[instruction->rd] = (uint32_t) (mulh_result >> 32); break; @@ -392,6 +393,7 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) break; case FUNC7_MULHSU: // MULtiplication High (32 high bits) (signed * unsigned) + // FIXME: This is wrong, we should sign extend the int64_t i guess uint64_t mulhsu_result = (uint64_t) (((int64_t) cpu->regs.x[instruction->rs1]) * ((uint64_t) cpu->regs.x[instruction->rs2])); cpu->regs.x[instruction->rd] = (uint32_t) (mulhsu_result >> 32); break;