diff options
author | David Li <li.davidm96@gmail.com> | 2015-12-20 23:16:56 -0500 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2015-12-20 23:16:56 -0500 |
commit | 39ce6b062b6d36495098e39dfd813212757ac4f3 (patch) | |
tree | 1bb6a13b5934409793528bfb054d5243e52c9538 /src/isa/mod.rs | |
parent | 600fcc814e27e7f38969726e1263a36592bbde58 (diff) |
Fix immediate calculation in JAL
Diffstat (limited to 'src/isa/mod.rs')
-rw-r--r-- | src/isa/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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 } } |