aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/simulator.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/simulator.rs b/src/simulator.rs
index d5f7a5c..d30ae7c 100644
--- a/src/simulator.rs
+++ b/src/simulator.rs
@@ -69,7 +69,7 @@ impl Simulator {
pub fn run(&mut self) {
let base_core = Core {
- pc: 0x10000,
+ pc: 0x1002C,
registers: RegisterFile::new(),
running: true,
};
@@ -302,11 +302,18 @@ impl Simulator {
panic!("Invalid store funct3code: 0x{:x}", inst.funct3());
}
},
- isa::opcodes::SYSTEM => {
-
+ isa::opcodes::SYSTEM => match inst.i_imm() {
+ 0x0 => {
+ // System call
+ println!("System call {}:", core.registers.read_word(isa::Register::X10));
+ println!("Argument {:X}:", core.registers.read_word(isa::Register::X11));
+ }
+ _ => {
+
+ }
},
_ => {
- panic!("Invalid opcode: 0x{:02X}", inst.opcode());
+ panic!("Invalid opcode: 0x{:02X} at PC 0x{:X}", inst.opcode(), pc);
}
}
}