Skip to content

Commit

Permalink
Merge pull request #92 from valida-xyz/thealmarty/issue/13lt
Browse files Browse the repository at this point in the history
Allow immediate b operand for LT instruction.
  • Loading branch information
thealmarty authored Jan 11, 2024
2 parents 7f83a73 + 162fca8 commit 413bb4c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions alu_u32/src/lt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ where
let mut imm: Option<Word<u8>> = None;
let read_addr_1 = (state.cpu().fp as i32 + ops.b()) as u32;
let write_addr = (state.cpu().fp as i32 + ops.a()) as u32;
let src1 = state
.mem_mut()
.read(clk, read_addr_1, true, pc, opcode, 0, "");
let src1 = if ops.d() == 1 {
let b = (ops.b() as u32).into();
imm = Some(b);
b
} else {
state
.mem_mut()
.read(clk, read_addr_1, true, pc, opcode, 0, "")
};
let src2 = if ops.is_imm() == 1 {
let c = (ops.c() as u32).into();
imm = Some(c);
Expand Down

0 comments on commit 413bb4c

Please sign in to comment.