waveform
2022-12-30
Generates unicode waveforms that can be embedded into code comments.
Table of Contents
Generates unicode waveforms that can be embedded into code comments
During my work on the Ashet Home Computer, I wanted to document certain wave forms that are required in the SPI module in my Verilog code and started drawing some diagrams:
This didn’t really scale well and was badly readable. So when implementing the next module, I started using block drawing characters:
I really liked the visuals of those drawings, so I wrote myself a small tool that can render such diagrams: waveforms
Input Files
The tool takes input in a line-based fashion:
CLK | LLHLHLHLHLHLHLHLHLHLLLL
/CE | HLLLLLLLLLLLLLLLLLHHHHH
MOSI | ZZB-B-B-B-B-B-B-B-ZZZZZ
MISO | ZZZB-B-B-B-B-B-B-B-ZZZZ
It starts with a signal name, a pipe separator to mark the start of the signal. After that, the following symbols are legal:
L
: edge to lowH
: edge to highZ
: edge to high impedanceB
: edge to low or high (can be both)-
: no change in the signal
Rendered Output
The tool will then create a timing sequence, and renders the described waveforms in unicode characters: