Function machine_check::run
source · pub fn run<M>(system: M)where
M: FullMachine,Expand description
Runs machine-check with the given constructed system.
The system must implement Machine. The system structures and Input, State, and Machine
implementations must be enclosed within the machine_description macro, which processes them to enable
fast and efficient formal verification.
The behaviour of machine-check is controlled by command-line arguments.
Examples found in repository?
More examples
examples/simple_risc.rs (line 145)
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
fn main() {
let toy_program = [
// (0) set r0 to zero
Bitvector::new(0b0100_0000_0000),
// (1) set r1 to one
Bitvector::new(0b0101_0000_0001),
// (2) set r2 to zero
Bitvector::new(0b0110_0000_0000),
// --- main loop ---
// (3) store r1 content to data location 0
Bitvector::new(0b1100_0000_0000),
// (4) store r2 content to data location 1
Bitvector::new(0b1100_0000_0001),
// (5) read input location 0 to r3
Bitvector::new(0b0011_0100_0000),
// (6) jump to (3) if r3 bit 0 is set
Bitvector::new(0b0011_1000_0011),
// (7) increment r2
Bitvector::new(0b0010_0000_1001),
// (8) store r2 content to data location 1
Bitvector::new(0b1110_0000_0001),
// (9) jump to (3)
Bitvector::new(0b0001_1000_0011),
];
// load toy program to program memory, filling unused locations with 0
let mut progmem = BitvectorArray::new_filled(Bitvector::new(0));
for (index, instruction) in toy_program.into_iter().enumerate() {
progmem[Bitvector::new(index as u64)] = instruction;
}
let system = machine_module::System { progmem };
machine_check::run(system);
}