aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/isa/mod.rs2
-rw-r--r--src/simulator.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/isa/mod.rs b/src/isa/mod.rs
index 8a6e65b..2c20d05 100644
--- a/src/isa/mod.rs
+++ b/src/isa/mod.rs
@@ -130,7 +130,7 @@ impl Instruction {
}
pub fn funct3(&self) -> u32 {
- (self.word >> 12) & 0x3
+ (self.word >> 12) & 0x7
}
pub fn funct7(&self) -> u32 {
diff --git a/src/simulator.rs b/src/simulator.rs
index 716c0e1..1c87d57 100644
--- a/src/simulator.rs
+++ b/src/simulator.rs
@@ -112,9 +112,9 @@ impl<'a> Core<'a> {
isa::funct3::BEQ => rs1 == rs2,
isa::funct3::BNE => rs1 != rs2,
isa::funct3::BLT => (rs1 as isa::SignedWord) < (rs2 as isa::SignedWord),
- isa::funct3::BGE => (rs1 as isa::SignedWord) > (rs2 as isa::SignedWord),
+ isa::funct3::BGE => (rs1 as isa::SignedWord) >= (rs2 as isa::SignedWord),
isa::funct3::BLTU => rs1 < rs2,
- isa::funct3::BGEU => rs1 > rs2,
+ isa::funct3::BGEU => rs1 >= rs2,
_ => {
self.trap(Trap::IllegalInstruction {
address: pc,