summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..6fae7c0
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,30 @@
+mod rv32_cpu;
+use rv32_cpu::rv32_cpu::Rv32Cpu;
+mod instruction;
+mod rv32i;
+use rv32i::rv32i::Rv32i;
+mod rv32m;
+use rv32m::rv32m::Rv32m;
+mod extension;
+use std::error::Error;
+use std::thread;
+
+const HART_CNT: usize = 4;
+
+fn main() -> Result<(), Box<dyn Error>> {
+ let mut handles = vec![];
+
+ for i in 0..HART_CNT {
+ let handle = thread::spawn(move || {
+ let mut cpu: Rv32Cpu = Rv32Cpu::new(i as u32).add_extension::<Rv32i>().add_extension::<Rv32m>();
+ cpu.execute(0b00000000000000000001000000010011).unwrap();
+ });
+ handles.push(handle);
+ }
+
+ for handle in handles {
+ handle.join().unwrap();
+ }
+
+ Ok(())
+} \ No newline at end of file