Verilator C++ Test Harness
VLSI → Verifying Real Designs (Verilator)
Your Verilog becomes a C++ object
Verilator compiles your Verilog module into a real C++ class — Vyour_module — that you can instantiate, poke, and inspect directly from your own C++ program. A tiny sim_main.cpp that instantiates it, ticks the clock, sets inputs, and reads outputs is the entire "test harness."
The minimal harness shape
#include "Vcounter.h"
#include "verilated.h"
int main(int argc, char** argv) {
Verilated::commandArgs(argc, argv);
Vcounter* dut = new Vcounter;
for (int cycle = 0; cycle < 20; cycle++) {
dut->clk = 0; dut->eval();
dut->clk = 1; dut->eval();
printf("cycle %d: count = %d\n", cycle, dut->count);
}
delete dut;
return 0;
}Every
dut->eval()call settles combinational logic for the current input values — the harness, not Verilator, decides when time advances. This is what "cycle-accurate" means in practice: you're the one driving the clock, one edge at a time.Why this matters for a resume
Tessolve and MosChip's open-source SoC verification roles assume hands-on Verilator harness experience — mentioning it by name in a resume bullet is what passes an automated keyword filter, but actually being able to explain the eval()/clock-tick loop above is what passes the follow-up interview question.
Try it — step through a harness's clock ticks
cycle 0: dut->count = 0
Completion saves automatically after you read through to the end.
Next lesson →