summaryrefslogtreecommitdiff
path: root/website-emu/src/state.rs
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-09-25 22:39:01 -0500
committerNathan Lee <me@nwlee.tech>2026-09-25 22:39:01 -0500
commit6858c9e7c97f772eb357e3eee0c1fcfb8adcb699 (patch)
tree691b3591fa0fc817b88f3a587fa0d613f9d475c1 /website-emu/src/state.rs
scaffold emulator from wrv32em
Diffstat (limited to 'website-emu/src/state.rs')
-rw-r--r--website-emu/src/state.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/website-emu/src/state.rs b/website-emu/src/state.rs
new file mode 100644
index 0000000..f26167f
--- /dev/null
+++ b/website-emu/src/state.rs
@@ -0,0 +1,19 @@
+use crate::mem::CpuMemory;
+
+pub struct CpuState {
+ pub memory: CpuMemory,
+ pub registers: [u32; 32],
+ pub csr: [u32; 4096],
+ pub pc: u32,
+}
+
+impl CpuState {
+ pub fn new(memory: CpuMemory) -> CpuState {
+ CpuState {
+ memory,
+ registers: [0u32; 32],
+ csr: [0u32; 4096],
+ pc: 0
+ }
+ }
+}