fix(cpu): perform MUL with u64s, throw away upper 32 bits

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-02-01 16:15:08 -04:00
parent b07eb22b86
commit b27bf4a85c
1 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,8 @@ pub fn multiply(comptime A: bool, comptime S: bool) InstrFn {
const rs = opcode >> 8 & 0xF;
const rm = opcode & 0xF;
const result = cpu.r[rm] * cpu.r[rs] + if (A) cpu.r[rn] else 0;
const temp: u64 = @as(u64, cpu.r[rm]) * @as(u64, cpu.r[rs]) + if (A) cpu.r[rn] else 0;
const result = @truncate(u32, temp);
cpu.r[rd] = result;
if (S) {