From 39ce6b062b6d36495098e39dfd813212757ac4f3 Mon Sep 17 00:00:00 2001 From: David Li Date: Sun, 20 Dec 2015 23:16:56 -0500 Subject: Fix immediate calculation in JAL --- 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 6519a34..49fad10 100644 --- a/src/isa/mod.rs +++ b/src/isa/mod.rs @@ -146,7 +146,7 @@ impl Instruction { let low11 = (self.word >> 20) & 0x1; let low12 = (self.word >> 12) & 0xFF; // Want sign-extension - let low20 = (((self.word as SignedWord) >> 30) & 0x1) as Word; + let low20 = ((self.word as SignedWord) >> 30) as Word; ((low20 << 20) | (low12 << 12) | (low11 << 11) | (low1 << 1)) as SignedWord } @@ -154,7 +154,7 @@ impl Instruction { let low1 = (self.word >> 8) & 0xF; let low5 = (self.word >> 25) & 0x3F; let low11 = (self.word >> 7) & 0x1; - let low12 = (((self.word as SignedWord) >> 31) & 0x1) as Word; + let low12 = ((self.word as SignedWord) >> 31) as Word; ((low12 << 12) | (low11 << 11) | (low5 << 5) | (low1 << 1)) as SignedWord } } -- cgit v1.2.3