From 162fca87e26d9ea3ba2c62c7552a2dcf9dbe2a93 Mon Sep 17 00:00:00 2001 From: thealmarty <“thealmartyblog@gmail.com”> Date: Tue, 9 Jan 2024 14:30:13 -0800 Subject: [PATCH] Allow imm b. --- alu_u32/src/lt/mod.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/alu_u32/src/lt/mod.rs b/alu_u32/src/lt/mod.rs index 3a2031a5..c493ba66 100644 --- a/alu_u32/src/lt/mod.rs +++ b/alu_u32/src/lt/mod.rs @@ -127,9 +127,15 @@ where let mut imm: Option> = 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);