Overview
The Instruction Stream Generator is part of a RISC-V cross-level co-simulation verification approach in which a generated instruction stream is supplied to both an RTL core under test and an Instruction Set Simulator (ISS) reference model. The broader testbench compares results after each executed instruction so that RTL errors can be detected immediately when they occur. [C1]
Generation model
The generator is designed for endless generation of unrestricted instructions. In the baseline algorithm, generated instructions are fully randomized; this baseline forms the foundation of the testing process. The implementation also applies modifications that guide generation toward interesting cases. [C2]
One described modification injects a random instruction opcode to create a valid instruction while leaving the remaining instruction fields randomized. This is characterized as simple, generic, and effective, and it helps ensure that a large set of legal instructions is considered. [C3]
Supported instruction behavior
The co-simulation setup is described as supporting generated instruction streams without restrictions. The evidence explicitly states support for memory access instructions, jump instructions including self-loops caused by on-the-fly generation, and special RISC-V CSR access instructions. This breadth enables comprehensive testing while requiring the ISS and RTL core to behave identically on observable architectural state such as register updates. [C4]
Interaction with instruction matching
Unrestricted on-the-fly generation creates a synchronization challenge because a pipelined RTL core may prefetch instructions that are not ultimately executed after jumps or traps. Therefore, the instruction stream logic keeps a queue of pending instructions fetched by the RTL core but not yet consumed by the ISS, storing both the program counter and generated instruction. When the ISS requests the next instruction, the implementation searches this queue for a match on PC and expected instruction, returning the instruction on success or reporting a mismatch otherwise. [C5]
Role in the co-simulation testbench
The Instruction Stream Generator contributes the stimulus stream used by the co-simulation testbench. The testbench feeds the generated stream to both the ISS and the RTL core, while the surrounding infrastructure, including a core adapter, handles completion detection and architectural-state comparison. [C1] [C5]
Relationship to on-the-fly evolution
The generator implements the approach of evolving the instruction stream on-the-fly during simulation: instructions are generated dynamically as the RTL core and ISS fetch them, rather than from a fixed precomputed program. [C6]