Overview
add_directed_instr_stream is a code artifact referenced in the riscv_asm_program_gen.sv assembly-program generation flow used by the open-source CHIPS Alliance riscv-dv random instruction generator for RISC-V processor verification. The surrounding riscv_asm_program_gen class is described as generating complete RISC-V assembly programs, including initialization, instruction, data, stack, page-table, interrupt, and exception-handling sections. [C1]
Role in program generation
Within the described gen_program() flow, gen_program() first acts as the main function that generates all sections of the assembly program. It then calls get_directed_instr_stream(), and the ratio of directed instruction generation is selected from another function named add_directed_instr_stream(). [C2]
The evidence includes a representative reporter message from riscv_asm_program_gen.sv showing a directed stream being added:
riscv_asm_program_gen.sv(1552) @ 0: reporter [asm_gen] Adding directed instruction stream:riscv_jal_instr ratio: 30/1000
This indicates that add_directed_instr_stream is associated with registering or adding a named directed instruction stream together with a ratio value, as shown by the riscv_jal_instr example at 30/1000. [C3]
Relationship to later directed-stream generation
After header generation and GPR initialization, the described flow calls generate_directed_instr_stream(). That later function decides the ratio, inserts directed instruction streams, randomizes instructions, and selects source and destination registers such as rs1, rs2, and rd based on instruction type. [C4]
Based on the provided evidence, add_directed_instr_stream appears in the earlier directed-stream setup path, while generate_directed_instr_stream() is described as the later step that inserts and randomizes the directed streams into the generated assembly program. [C2][C4]
Evidence limitations
The provided evidence does not include the SystemVerilog implementation, function signature, arguments, return type, or full control flow of add_directed_instr_stream. The documented claims are therefore limited to its placement in the gen_program() flow and its observed association with adding directed instruction streams and ratios. [C2][C3]