YARP Driver
Toggling the YARP Interface
In this module, we would implement the driver class to get the transaction from the generator mailbox and use it to toggle the input pins of our RISC-V CPU. The driver class allows the testbench to drive the randomized stimulus to the DUT while ensuring that all the input constraints specified by the DUT are indeed met.
The YARP DUT has two valid/ready based interfaces: the Instruction memory interface and the Data memory interface.
Since this is a single cycle implementation of the RISC-V CPU, the instruction memory interface and the data memory
interface are closely coupled. The data memory interface is only valid when the instruction is either a load or a
store instruction which then asserts the request on the data memory interface. The instruction memory interface
waits for the data memory interface to be ready before it can assert the request for the next instruction.
Given the relationship between the two interfaces, we will build a single agent to handle the two interfaces.
The driver class would be responsible for driving the ready signals of both of these interfaces and as well
as the data signals. However, if we look into the transaction object, it gives us the following information:
instr_mem_ready_delay: The number of cycles the core waits for its instruction (0: no wait at all)data_mem_ready_delay: The number of cycles the core waits for a load or store after its fetch (0: no wait at all)
So for each transaction, the instruction memory makes the core wait its delay and then asserts ready with the
instruction for one cycle; for a load or store, it also starts the data memory, which makes the core wait the data
delay and then asserts its own ready. With delays of 0, the core runs one instruction per cycle. Like a real memory,
each interface also raises its ready at random with junk data while it is idle, which the core must ignore. Let's
try to implement the driver class to handle this.
Related concepts
Loading the interactive workspace...