Home › Practice › Design Verification › cocotb 3: FIFO monitor & scoreboard
cocotb 3: FIFO monitor & scoreboard
HardcocotbPythonDVFIFOEarly
Concept first. Real cocotb testbenches split driving and checking into concurrent coroutines: spawn a background monitor with cocotb.start_soon(monitor(...)), signal completion with an Event, and guard waits with First(done.wait(), Timer(...)).
Verify this 4-entry, 8-bit synchronous FIFO. Writes are accepted on posedge clk when wr_en && !full (writes while full must be ignored). Reads advance on posedge clk when rd_en && !empty, with rd_data showing the front entry combinationally.
module fifo4 (
input clk, rst, wr_en,
input [7:0] wr_data,
input rd_en,
output [7:0] rd_data,
output full, empty
);
Write a testbench that fills the FIFO, attempts an extra write while full (verifying it is ignored), and drains all 4 bytes checking exact FIFO order.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.