Testing software is — sometimes — easier than testing hardware. After all, you can always create test files and even fake user input before monitoring outputs using common tools. Hardware though, is a bit different. Sometimes it is hard to visualize exactly what’s happening. [Andrew Ray’s] answer? Produce simulated waveforms using ASCII text.
The process uses some custom tools written in OCaml, but the code is available for you on GitHub. The tool, called Hardcaml, allows you to write test benches for hardware — not a new idea for FPGA developers. The output, however, is an ASCII text waveform and common software development tools can check that waveform against the expected output.
You could do the same thing with a Verilog VCD file, of course, but it wouldn’t be as much fun to read. You’d want to use a waveform viewer to really see what’s going on. In fact, we wondered if it would be worth going the other way, to convert the Hardcaml output to VCD so tools you use to diff waveforms would possibly work.