pub struct SimulationControl { /* private fields */ }Expand description
A handle for running the simulation with some code after adding all modules and signals.
§Example
use system_rust::prelude::*;
use system_rust::standard_modules::SRAnd;
let (mut sim_control, sim) = SimulationControl::new();
let sig_a = sim.create_signal("A", L4::T);
let sig_b = sim.create_signal("B", L4::T);
let sig_r = sim.create_signal("R", L4::X);
sim.add_compute_module("And", |mut and: SRAnd| {
and.in_a.attach(&sig_a);
and.in_b.attach(&sig_b);
and.output.attach(&sig_r);
and
});
sim_control.simulate(|| {
sim.wait(SimDelay::NS(1));
println!("{}" ,sig_r.read());
});Implementations§
Source§impl SimulationControl
impl SimulationControl
pub fn new() -> (SimulationControl, SimulationContext)
pub fn simulate<F>(&mut self, simulation_instructions: F)where
F: FnOnce(),
Auto Trait Implementations§
impl Freeze for SimulationControl
impl !RefUnwindSafe for SimulationControl
impl Send for SimulationControl
impl !Sync for SimulationControl
impl Unpin for SimulationControl
impl !UnwindSafe for SimulationControl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more