#[machine_check::machine_description]
mod machine_module {
use ::machine_check::Bitvector;
use ::std::{
clone::Clone,
cmp::{Eq, PartialEq},
fmt::Debug,
hash::Hash,
};
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Input {
increment_value: Bitvector<1>,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Param {}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct State {
value: Bitvector<4>,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct System {}
impl ::machine_check::Machine for System {
type Input = Input;
type Param = Param;
type State = State;
fn init(&self, _input: &Input, _param: &Param) -> State {
State {
value: Bitvector::<4>::new(0),
}
}
fn next(&self, state: &State, input: &Input, _param: &Param) -> State {
let mut next_value = state.value;
if input.increment_value == Bitvector::<1>::new(1) {
next_value = next_value + Bitvector::<4>::new(1);
}
State { value: next_value }
}
}
}
fn main() {
let system = machine_module::System {};
machine_check::run(system);
}