From f4f129a75208ccf5d6a19b1cb81c56d4d95fd61f Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Mon, 30 Sep 2024 12:28:24 +1300 Subject: 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. --- src/lib.rs | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'src/lib.rs') 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, -} -- cgit v1.2.3-70-g09d2