summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index a3571c7..3d8008d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -19,7 +19,10 @@ fn main() {
let mut state = CpuState::new(memory);
- state.memory.write_multiple_bytes(RO_TARGET as usize, f_dat.as_slice(), 99).unwrap();
+ state
+ .memory
+ .write_multiple_bytes(RO_TARGET as usize, f_dat.as_slice(), 99)
+ .unwrap();
state.memory.write(UART_ADDR as usize, 99, 0).unwrap();
state.pc = RO_TARGET;
@@ -134,18 +137,9 @@ fn handle_instruction(state: &mut CpuState) {
let addr = (state.registers[rs1] + imm) as usize;
match f3 {
- 0 => {
- sb(state, rs1, rs2, imm);
- state.release_reservations(&[addr]);
- }
- 1 => {
- sh(state, rs1, rs2, imm);
- state.release_reservations(&[addr, addr + 1]);
- }
- 2 => {
- sw(state, rs1, rs2, imm);
- state.release_reservations(&[addr, addr + 1, addr + 2, addr + 3]);
- }
+ 0 => sb(state, rs1, rs2, imm),
+ 1 => sh(state, rs1, rs2, imm),
+ 2 => sw(state, rs1, rs2, imm),
_ => panic!("Illegal instruction: {:x}", word),
};
}