From: Jacob Lifshay Date: Thu, 28 May 2020 06:29:54 +0000 (-0700) Subject: working on instruction models X-Git-Tag: v0.2.0~49 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d486204ae806c28a539eb3f3be8e7d8764d9dde0;p=power-instruction-analyzer.git working on instruction models --- diff --git a/src/instr_models.rs b/src/instr_models.rs index 092f359..0890f45 100644 --- a/src/instr_models.rs +++ b/src/instr_models.rs @@ -124,8 +124,8 @@ pub fn divweo(inputs: TestDivInput) -> TestDivResult { } pub fn divweuo(inputs: TestDivInput) -> TestDivResult { - let dividend = u64::from(inputs.dividend) << 32; - let divisor = u64::from(inputs.divisor); + let dividend = u64::from(inputs.dividend as u32) << 32; + let divisor = u64::from(inputs.divisor as u32); let overflow; let result; if divisor == 0 { @@ -228,7 +228,7 @@ pub fn modsw(inputs: TestDivInput) -> TestDivResult { if divisor == 0 || (divisor == -1 && dividend == i32::min_value()) { result = 0; } else { - result = (dividend % divisor) as u32 as u64; + result = (dividend % divisor) as u64; } TestDivResult { result,