Struct moa_core::system::System

source ·
pub struct System {
    pub clock: Instant,
    pub devices: HashMap<String, Device>,
    pub event_queue: Vec<NextStep>,
    pub debuggables: Vec<Device>,
    pub bus: Rc<RefCell<Bus>>,
    pub buses: HashMap<String, Rc<RefCell<Bus>>>,
    pub interrupt_controller: RefCell<InterruptController>,
}

Fields§

§clock: Instant§devices: HashMap<String, Device>§event_queue: Vec<NextStep>§debuggables: Vec<Device>§bus: Rc<RefCell<Bus>>§buses: HashMap<String, Rc<RefCell<Bus>>>§interrupt_controller: RefCell<InterruptController>

Implementations§

source§

impl System

source

pub fn get_bus(&self) -> RefMut<'_, Bus>

source

pub fn get_interrupt_controller(&self) -> RefMut<'_, InterruptController>

source

pub fn get_device(&self, name: &str) -> Result<Device, Error>

source

pub fn add_device(&mut self, name: &str, device: Device) -> Result<(), Error>

source

pub fn add_addressable_device( &mut self, addr: Address, device: Device ) -> Result<(), Error>

source

pub fn add_peripheral( &mut self, name: &str, addr: Address, device: Device ) -> Result<(), Error>

source

pub fn add_interruptable_device( &mut self, name: &str, device: Device ) -> Result<(), Error>

source

fn process_one_event(&mut self) -> Result<(), Error>

source

pub fn step(&mut self) -> Result<(), Error>

Step the simulation one event exactly

source

pub fn step_until_device(&mut self, device: Device) -> Result<(), Error>

Step through the simulation until the next event is for the given device

source

pub fn step_until_debuggable(&mut self) -> Result<(), Error>

Step through the simulation until the next event scheduled is for a debuggable device

source

pub fn run_until_clock(&mut self, clock: Instant) -> Result<(), Error>

Run the simulation until the given simulation clock time has been reached

source

pub fn run_for_duration(&mut self, elapsed: Duration) -> Result<(), Error>

Run the simulation for elapsed amount of simulation time

source

pub fn run_forever(&mut self) -> Result<(), Error>

Run the simulation forever, or until there is an error

source

pub fn exit_error(&mut self)

source

pub fn get_next_event_device(&self) -> Device

source

pub fn get_next_debuggable_device(&self) -> Option<Device>

source

fn try_add_debuggable(&mut self, device: Device)

source

fn try_queue_device(&mut self, device: Device)

source

fn queue_device(&mut self, device_step: NextStep)

Trait Implementations§

source§

impl Default for System

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for System

§

impl !RefUnwindSafe for System

§

impl !Send for System

§

impl !Sync for System

§

impl Unpin for System

§

impl !UnwindSafe for System

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, S> IntoAddress<T> for S
where T: FromAddress<S>,

source§

fn into_address(self) -> T

Translate the given address into an address of type T
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.