From a50fad7afbbd63615d4e675838d7b5f531abd26c Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 6 Jan 2016 12:11:27 -0700 Subject: Correct s_imm calculation --- src/isa/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/isa') diff --git a/src/isa/mod.rs b/src/isa/mod.rs index cfdde50..9da1751 100644 --- a/src/isa/mod.rs +++ b/src/isa/mod.rs @@ -155,8 +155,8 @@ impl Instruction { pub fn s_imm(&self) -> SignedWord { let low = (self.word >> 7) & 0x1F; - let high = (((self.word as SignedWord) >> 25) & 0x7F) as Word; - ((high << 7) | low) as SignedWord + let high = ((self.word as SignedWord) >> 25) as Word; + ((high << 5) | low) as SignedWord } pub fn uj_imm(&self) -> SignedWord { -- cgit v1.2.3