MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / test_csr_instret

Function test_csr_instret

tests/integration/vm_execution.rs:927–944  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

925 );
926}
927
928// --- Helper ---
929
930fn ri(i: RealInstruction) -> RvInstruction {
931 RvInstruction::Real(i)
932}
933
934// Returns the VM itself so a caller can peek at registers after the run.
935fn assemble_and_run(insns: Vec<RvInstruction>) -> (VirtualMachine, StepOutcome) {
936 let assembled = Assembler::assemble(&insns).expect("assembly failed");
937 let mut vm = VirtualMachine::new(&assembled);
938 let result = vm.run(100_000);
939 (vm, result.outcome)
940}
941
942// --- Tests ---
943
944#[test]
945fn test_exit_zero() {
946 let (_, outcome) = assemble_and_run(vec![
947 ri(RealInstruction::Addi(Addi::new(10, 0, 0))), // a0 = 0

Callers

nothing calls this directly

Calls 1

assemble_and_runFunction · 0.85

Tested by

no test coverage detected