From 0368e431e7bacfc00c29812db2921e4b2842e5f4 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 8 Jul 2020 22:14:31 -0700 Subject: [PATCH] working on instruction model --- src/instr_models.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/instr_models.rs b/src/instr_models.rs index c23e659..c58806e 100644 --- a/src/instr_models.rs +++ b/src/instr_models.rs @@ -313,8 +313,9 @@ create_instr_variants_cr!(mulhw, mulhw_, i32); pub fn mulhw(inputs: InstructionInput) -> InstructionResult { let ra = inputs.ra as i32 as i64; let rb = inputs.rb as i32 as i64; - let result = ((ra * rb) >> 32) as i32; - let result = result as u64; + let result = (ra * rb) >> 32; + let mut result = result as u32 as u64; + result |= result << 32; InstructionResult { rt: Some(result), ..InstructionResult::default() @@ -326,8 +327,9 @@ create_instr_variants_cr!(mulhwu, mulhwu_, i32); pub fn mulhwu(inputs: InstructionInput) -> InstructionResult { let ra = inputs.ra as u32 as u64; let rb = inputs.rb as u32 as u64; - let result = ((ra * rb) >> 32) as u32; - let result = result as u64; + let result = (ra * rb) >> 32; + let mut result = result as u32 as u64; + result |= result << 32; InstructionResult { rt: Some(result), ..InstructionResult::default() -- 2.30.2