#[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 {
value: Bitvector<8>,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Param {}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct State {
odd_position: Bitvector<1>,
value: Bitvector<8>,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct System {}
impl ::machine_check::Machine for System {
type Input = Input;
type State = State;
type Param = Param;
fn init(&self, _input: &Input, _param: &Param) -> State {
State {
odd_position: Bitvector::<1>::new(0),
value: Bitvector::<8>::new(0),
}
}
fn next(&self, state: &State, input: &Input, _param: &Param) -> State {
let currently_odd_position = state.odd_position + Bitvector::<1>::new(1);
let mut value = Bitvector::<8>::new(0);
if currently_odd_position == Bitvector::<1>::new(1) {
value = input.value;
}
State {
odd_position: currently_odd_position,
value,
}
}
}
}
fn main() {
let system = machine_module::System {};
machine_check::run(system);
}