Overview
Co-simulation state verification checks a processor device under test (DUT) against a reference ISA simulator. In MorFuzz, the ISA simulator runs in parallel with the DUT, both execute the same inputs, and correctness is checked by comparing their states after each instruction is executed. [C1]
Role in MorFuzz
MorFuzz applies this verification method as an online co-simulation approach. The ISA simulator serves as the reference model for the DUT, allowing runtime detection of divergent architectural behavior during fuzzing. [C1]
MorFuzz’s implementation extracts the core logic of Spike, the official RISC-V ISA simulator, as the reference model used to check the DUT’s behavior. [C5]
Handling delayed write-back
A direct state comparison at instruction commit can be unreliable across different processor microarchitectures. The MorFuzz paper notes that prior work assumed write-back data is always ready when the DUT commits instructions, but this assumption does not always hold. Rocket is given as an example of a processor that supports delayed write-back, where long-latency instructions such as multiply, divide, and floating-point operations may not have write-back data ready at the commit stage. [C2]
To accommodate such differences, MorFuzz abstracts state comparison into two stages: a commitment stage and a judgment stage. This separation allows the co-simulation framework to tolerate cases where committed instructions do not immediately expose final write-back data. [C3]
State synchronization
MorFuzz can synchronize legally mismatched hardware state to the simulator. The paper describes checking legality by analyzing the accessed physical address on the simulator; if the access is legal, MorFuzz synchronizes the hardware state to the simulator, and otherwise reports the mismatch as a potential bug. [C4]
The same mechanism can also synchronize external events, including interrupts, to the simulator. By automatically synchronizing mismatched states, MorFuzz allows simulations to continue deeper instead of stopping early because of false positives. [C4]
Synchronization prerequisites
MorFuzz defines strict rules for approving state synchronization. A difference must satisfy prerequisites before it is treated as legal. First, only instructions involving operations beyond the verification scope may proceed to synchronization, limiting synchronization-triggering instruction types to CSR instructions and memory-operation instructions. Second, the DUT’s control-flow information must pass the commitment-stage check. If the DUT incorrectly approves access to privileged registers or reserved address space, the simulator side throws an exception. [C6]
Interaction with instruction morphing
When instruction morphing is used, MorFuzz maintains a morphing map keyed by the instruction before morphing and its address, with the morphed instruction as the value. This lets the reference model perform the same morphing as the DUT, so both models execute deterministic and identical morphed instructions and morphing does not introduce false positives. [C7]