Generate WaveJSON timing diagrams for digital signals and create HTML viewers to display them. Use when documenting signal timing, creating timing diagrams, analyzing protocol sequences, visualizing digital waveforms (clock, data, control signals), or displaying/rendering WaveDrom diagrams locally.
/plugin marketplace add lumberbarons/lumber-mart/plugin install lumberbarons-wavejson-plugin-plugins-wavejson-plugin@lumberbarons/lumber-martThis skill is limited to using the following tools:
reference.mdGenerate WaveJSON format timing diagrams for WaveDrom rendering. Perfect for documenting hardware interfaces, signal timing, protocol sequences, and any digital signal visualization.
Format Reference: This skill uses the WaveJSON specification and WaveDrom rendering engine, both licensed under MIT.
Additional Resources:
reference.md - Quick reference card with wave characters, patterns, and validation checklistWaveJSON uses JSON to describe timing diagrams with these key components:
{
"signal": [
{ "name": "clk", "wave": "p......." },
{ "name": "data", "wave": "x.345x..", "data": ["head", "body", "tail"] },
{ "name": "req", "wave": "0.1...0." }
]
}
Clock waves:
p - positive edge clock (rising edge)n - negative edge clock (falling edge)P - positive edge with arrowN - negative edge with arrowLogic levels:
0 - low level1 - high level. - extends previous stateData values:
= - data value (color 2)2, 3, 4, 5 - data values with different colorsx - undefined/don't carez - high impedance (tri-state)u - pull-upd - pull-downSpecial:
| - extend cycle and add gapname - Signal label (string)wave - Timing pattern (string, one char per cycle)data - Array of labels for data values (corresponds to =, 2-5 in wave)period - Signal repetition period (number)phase - Phase shift, positive=future, negative=delay (number)node - Markers for arrows: . (none), A-Z (invisible), others (visible)Create hierarchical groups by using arrays with a label string:
{
"signal": [
["Control Signals",
{ "name": "LE", "wave": "01.0...." },
{ "name": "WR", "wave": "1..01.0." }
],
["Data Bus",
{ "name": "D[7:0]", "wave": "x.3.4..x", "data": ["CTRL", "DATA"] }
]
]
}
Add dependency arrows between signal markers:
{
"signal": [...],
"edge": [
"a~>b Setup time",
"c-~d Hold time",
"e~|~f Pulse width"
]
}
Edge syntax:
node property)> before last char: arrow head- (horizontal), | (vertical), ~ (curvy), / (diagonal)# marks label position{
"signal": [...],
"config": { "hscale": 2 }
}
hscale - Horizontal scale (≥1, default 1)Create local HTML files to render WaveJSON diagrams using the WaveDrom library.
Generate an HTML viewer when:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WaveDrom Timing Diagram</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wavedrom/3.1.0/skins/default.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wavedrom/3.1.0/wavedrom.min.js" type="text/javascript"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f5f5f5;
}
h1, h2 {
color: #333;
}
.diagram-container {
background: white;
padding: 20px;
margin: 20px 0;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
</style>
</head>
<body onload="WaveDrom.ProcessAll()">
<h1>Timing Diagrams</h1>
<div class="diagram-container">
<h2>Diagram Title Here</h2>
<script type="WaveDrom">
{
"signal": [
{ "name": "clk", "wave": "p......." },
{ "name": "data", "wave": "x.345x..", "data": ["head", "body", "tail"] }
]
}
</script>
</div>
<!-- Add more diagrams by adding more diagram-container divs -->
</body>
</html>
For pages with multiple timing diagrams:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hardware Timing Reference</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wavedrom/3.1.0/skins/default.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wavedrom/3.1.0/wavedrom.min.js" type="text/javascript"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f5f5f5;
}
h1 { color: #333; }
h2 { color: #555; margin-top: 0; }
.diagram-container {
background: white;
padding: 20px;
margin: 20px 0;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.description {
color: #666;
margin: 10px 0;
font-size: 14px;
}
</style>
</head>
<body onload="WaveDrom.ProcessAll()">
<h1>Project Timing Diagrams</h1>
<div class="diagram-container">
<h2>Two-Phase Write Sequence</h2>
<p class="description">Shows the complete writeByte() operation with control latch and character write.</p>
<script type="WaveDrom">
{ /* First WaveJSON here */ }
</script>
</div>
<div class="diagram-container">
<h2>Control Word Timing</h2>
<p class="description">D7 clear bit requires 1.0µs delay per PD2437 datasheet.</p>
<script type="WaveDrom">
{ /* Second WaveJSON here */ }
</script>
</div>
</body>
</html>
When user requests HTML viewer:
<script type="WaveDrom"> tagsdocs/timing_diagrams.html)open command (macOS) or xdg-open (Linux)After creating the HTML file:
# macOS
open /path/to/timing_diagrams.html
# Linux
xdg-open /path/to/timing_diagrams.html
# Windows (Git Bash)
start /path/to/timing_diagrams.html
User request: "Create an HTML page showing the SPI transfer timing"
Claude should:
<script type="WaveDrom"> tagdocs/spi_transfer_timing.htmldocs/timing_[description].htmldocs/protocol_timing.htmldocs/[interface]_timing.htmldocs/hardware_timing.htmlWhen creating comprehensive timing documentation:
Before generating HTML:
onload="WaveDrom.ProcessAll()" is present in <body> tag<script type="WaveDrom"> tags are properly formedCurrent stable version: 3.1.0
If user reports rendering issues:
{
"signal": [
{ "name": "CLK", "wave": "p......." },
{ "name": "MOSI", "wave": "x2345678x", "data": ["D7", "D6", "D5", "D4", "D3", "D2", "D1", "D0"] },
{ "name": "MISO", "wave": "x........" },
{ "name": "CS", "wave": "10.....1." }
],
"config": { "hscale": 2 }
}
{
"signal": [
{ "name": "SCL", "wave": "0.p......." },
{ "name": "SDA", "wave": "10.3.4.5.1", "data": ["ADDR", "ACK", "DATA"], "node": ".a.b.c.d.e" },
{},
{ "name": "Event", "wave": "x2.3.4.5.x", "data": ["START", "ADDR", "ACK", "DATA", "STOP"] }
],
"edge": [
"a~>b Start condition",
"c~>d ACK timing"
],
"config": { "hscale": 2 }
}
{
"signal": [
{ "name": "ADDR", "wave": "x.2.....x", "data": ["0x100"] },
{ "name": "DATA", "wave": "x...3...x", "data": ["0xAB"], "node": "....a..." },
{ "name": "WR", "wave": "1....01..", "node": ".....bc." },
{ "name": "CS", "wave": "1.0.....1" }
],
"edge": [
"a~>b Data setup time",
"c~>a Data hold time"
],
"config": { "hscale": 2 }
}
{
"signal": [
{ "name": "ADDR[1:0]", "wave": "2.3.4.5.", "data": ["00", "01", "10", "11"] },
{},
["Chip Selects (Active Low)",
{ "name": "CS0", "wave": "0.1.1.1." },
{ "name": "CS1", "wave": "1.0.1.1." },
{ "name": "CS2", "wave": "1.1.0.1." },
{ "name": "CS3", "wave": "1.1.1.0." }
]
],
"config": { "hscale": 2 }
}
{
"signal": [
["Clock Domain A",
{ "name": "CLK_A", "wave": "p........" },
{ "name": "DATA_A", "wave": "x2.....x.", "data": ["DATA"], "node": ".a......" }
],
{},
["Synchronizer",
{ "name": "SYNC1", "wave": "x..2...x.", "node": "...b...." },
{ "name": "SYNC2", "wave": "x....2.x.", "node": ".....c.." }
],
{},
["Clock Domain B",
{ "name": "CLK_B", "wave": "P........" },
{ "name": "DATA_B", "wave": "x......2x", "data": ["DATA"], "node": "......d." }
]
],
"edge": [
"a~>b Meta-stability",
"c~>d Synchronized"
],
"config": { "hscale": 2 }
}
{
"signal": [
{ "name": "CLK", "wave": "0...1.0...", "node": "....a.b..." },
{ "name": "DATA", "wave": "x.2...3..x", "data": ["Old", "New"], "node": "..c.....d." },
{},
{ "name": "Setup", "wave": "x.2.x.....", "data": ["t_su"], "node": "..e......." },
{ "name": "Hold", "wave": "x......2.x", "data": ["t_h"], "node": ".......f.." }
],
"edge": [
"c~>a Setup time (data before clock)",
"b~>d Hold time (data after clock)"
],
"config": { "hscale": 3 }
}
When asked to generate WaveJSON timing diagrams:
p/n) for clocks, logic levels (0/1) for control, data (=, 2-5) for bus valuesdata array to label bus values meaningfullyedge arrayhscale: 2 or higher for complex timing to make diagrams readablenode property) where arrows should connectWhen asked to "view", "display", "render", or "visualize" timing diagrams locally:
mkdir -p docsonload="WaveDrom.ProcessAll()" to body tag<script type="WaveDrom"> tagsdocs/ directoryopen, Linux: xdg-open, Windows: start)When in doubt, generate WaveJSON and ask: "Would you like me to create an HTML viewer to display this locally?"
To draw arrows between events:
node property to signals with timing markers. for cycles without markersa-z or A-Z for marker positionsExample:
{ "name": "CLK", "wave": "p....", "node": ".a.b." }
{ "name": "DATA", "wave": "x.2.x", "node": "..c..", "data": ["valid"] }
Then add edges:
"edge": [
"a~>c Setup",
"b~>c Hold"
]
Generate WaveJSON as properly formatted JSON that can be:
.json filesAlways validate JSON syntax and test logic before outputting.
When generating timing diagrams for hardware projects:
Reference datasheets, project documentation, and code for actual timing values.
User: "Generate a WaveJSON diagram showing an SPI byte transfer"
Claude should:
Before outputting WaveJSON:
data array matches number of data values in wave