Skip to content

Commit

Permalink
Merge pull request #152 from valida-xyz/ali/jalv
Browse files Browse the repository at this point in the history
Fix JALV operand c -- negative values allowed
  • Loading branch information
morganthomas authored Apr 17, 2024
2 parents 92b217a + a4bae8a commit 0a9ed96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion basic/src/bin/valida.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fn show_frame(args: ArgMatches, context: &mut Context) -> Result<Option<String>>
let offset = i * -4;
let read_addr = (fp + offset) as u32;
let string_val = context.machine_.mem().examine(read_addr);
let frameslot_addr = format!("{}(fp)", offset);
let frameslot_addr = format!("0x{:8} | {:3}(fp)", read_addr, offset);
let frameslot = format!("{:>7}", frameslot_addr);
let frame_str = format!("\n{} : {}", frameslot, string_val);
frame += &frame_str;
Expand Down
3 changes: 2 additions & 1 deletion cpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ where
.mem_mut()
.read(clk, read_addr, true, pc, opcode, 2, "")
.into();
state.cpu_mut().fp += cell;
let offset: i32 = cell as i32;
state.cpu_mut().fp = (state.cpu().fp as i32 + offset) as u32;
state.cpu_mut().push_op(Operation::Jalv, opcode, ops);
}
}
Expand Down

0 comments on commit 0a9ed96

Please sign in to comment.