|
|
|
@ -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; |
|
|
|
|