summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-09-30 12:28:24 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2024-09-30 15:00:01 +1300
commitf4f129a75208ccf5d6a19b1cb81c56d4d95fd61f (patch)
treeb3b95f78edeb2cc48ccf207069631468b2705d55 /src/lib.rs
parentf5986d0a37dd8c2526432e5e5e3af7083840447d (diff)
downloadbedrock-core-f4f129a75208ccf5d6a19b1cb81c56d4d95fd61f.zip
Make Bedrock parametric over devices
The core Bedrock struct is now parametric over individual Device structs, rather than over a single DeviceBus. This change was made so that devices can be implemented separately to one another. The implementation of the evaluate method has also been changed to make it potentially slightly more efficient, by replacing pop-then-push combinations with get operations.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9161ba3..131078d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,26 +1,12 @@
+mod bedrock;
mod device_bus;
-mod memory;
mod processor;
+mod program_memory;
mod stack;
-pub use device_bus::*;
-pub use memory::*;
-pub use processor::*;
-pub use stack::*;
+pub use bedrock::Bedrock;
+pub use device_bus::{Device, DeviceBus};
+pub use processor::Signal;
+pub use program_memory::ProgramMemory;
+pub use stack::Stack;
-#[derive(Copy, Clone, Debug)]
-pub enum Signal {
- Debug(DebugVariant),
- Sleep,
- Halt,
-}
-
-#[derive(Copy, Clone, Debug)]
-pub enum DebugVariant {
- DB1,
- DB2,
- DB3,
- DB4,
- DB5,
- DB6,
-}