这是什么
快速上手
基本结构
波形字符
常用配置
节点与边沿标注
信号分组
寄存器图
更多资料
这是什么
WaveDrom 是一个开源的数字电路时序图绘制引擎。本工具把它做成了纯本地的在线编辑器:在左侧编写 WaveJSON 描述,右侧实时渲染出时序图,可以导出为 SVG 或 PNG 图片,用于博客文章、报告或论文。所有处理都在你的浏览器中完成,不会上传任何数据。
原项目:github.com/wavedrom/wavedrom (MIT 许可),原作者 Aliaksei Chapyzhenka。
快速上手
打开工具后,左侧是代码区,右侧是预览区,修改代码约 0.3 秒后自动重新渲染。
输入的代码会自动保存在本浏览器(localStorage 键名 at-wavedrom-code),再次打开会自动恢复;从未编辑过时显示第一个示例。
工具栏的「示例」下拉框内置了四个常用例子(时钟数据、SPI、边沿标注、寄存器),选一个即可套用。
语法写错时,编辑器下方会显示错误信息,修改后自动恢复。
「导出 SVG」得到矢量图,适合插入文档;「导出 PNG」得到 2 倍分辨率的位图。导出图片的背景色与当前页面主题一致。
基本结构
最简单的时序图由一个 signal 数组组成,每个元素是一条信号:
{ "signal": [
{ "name": "clk", "wave": "p......" },
{ "name": "data", "wave": "x.345x.", "data": ["head", "body", "tail"] }
]}
name 是信号名;wave 是波形字符串,每个字符代表一个时间片;data 为数据段中的标注文字。
波形字符
字符 含义
0 / 1低电平 / 高电平
p / n正极性 / 负极性时钟周期
P / N带箭头的正 / 负极性时钟
.延续上一个时间片的状态
x不确定值(斜线交叉)
z高阻态
=白色数据段(配合 data 使用)
2 – 9彩色数据段,不同数字不同颜色
u / d弱上拉 / 弱下拉
|时间间隙(打断波形)
常用配置
在顶层添加 config 对象可以调整全局参数:
{ "signal": [ ... ],
"config": { "hscale": 2, "skin": "narrow" }
}
hscale:横向缩放倍数,默认 1,字符很多时调大。
skin:图形样式,可选 default 或 narrow(窄波形)。本工具会根据深浅色模式自动选择配色,无需手动设置颜色。
信号上的 phase(相位偏移)与 period(周期倍数)可微调单个信号,如 { "name": "clk", "wave": "p...", "period": 2, "phase": 0.5 }。
节点与边沿标注
用 node 在波形上放置标记点,再用 edge 数组画出时序弧线和文字:
{ "signal": [
{ "name": "clk", "wave": "p.......", "node": "..a.....b" },
{ "name": "d", "wave": "x.3.4.5x", "node": "...c....d" }
],
"edge": [ "a~>c setup", "d~>b hold" ]
}
node 中每个字母对应一个时间片上的位置;edge 里 a~>c setup 表示从节点 a 到 c 画一条弧线并标注「setup」。
信号分组
把多条信号放进数组并加上组名,可以画出总线分组:
{ "signal": [
["主机",
{ "name": "SCLK", "wave": "p...." },
{ "name": "MOSI", "wave": "x.2.2x", "data": ["D7", "D6"] }
],
{ "name": "CS", "wave": "1.0..1" }
]}
寄存器图
把 signal 换成 reg 即可绘制寄存器位域图,bits 是位数,attr 是属性标注,空的 { "bits": n } 表示保留位:
{ "reg": [
{ "name": "EN", "bits": 1, "attr": "rw" },
{ "bits": 3 },
{ "name": "MODE", "bits": 4, "attr": "rw" }
],
"config": { "bits": 8 }
}
WaveDrom User Manual
Start with a built-in timing diagram, then look up wave characters, timing annotations and register diagrams.
What is this
Quick start
Basic structure
Wave characters
Common configuration
Nodes and timing arcs
Signal groups
Register diagrams
Further reading
What is this
WaveDrom is an open-source engine that renders digital timing diagrams. This tool wraps it in a fully local editor: write WaveJSON on the left, see the diagram rendered live on the right, and export it as SVG or PNG for your blog posts, reports or papers. Everything runs in your browser — no data ever leaves your machine.
Original project: github.com/wavedrom/wavedrom (MIT License), by Aliaksei Chapyzhenka.
Quick start
The left pane is the code editor, the right pane is the live preview. Edits re-render about 0.3 s after you stop typing.
Your code is saved automatically in this browser (localStorage key at-wavedrom-code) and restored next time; the first example is shown until you edit.
The Examples dropdown ships four presets (clock & data, SPI, timing arcs, register) — pick one to start from.
Syntax errors appear below the editor and disappear once fixed.
Export SVG gives a vector image for documents; Export PNG gives a 2× bitmap. The export background matches the current theme.
Basic structure
The simplest diagram is a signal array, one entry per lane:
{ "signal": [
{ "name": "clk", "wave": "p......" },
{ "name": "data", "wave": "x.345x.", "data": ["head", "body", "tail"] }
]}
name is the lane label; wave is the wave string where each character is one time slot; data labels the data bricks.
Wave characters
Char Meaning
0 / 1Low / high level
p / nPositive / negative clock cycle
P / NPositive / negative clock with arrow
.Extend the previous state
xDon't care (crossed)
zHigh impedance
=Plain data brick (use with data)
2 – 9Colored data bricks, one color per digit
u / dWeak pull-up / pull-down
|Time gap (breaks the wave)
Common configuration
Add a top-level config object to tune global parameters:
{ "signal": [ ... ],
"config": { "hscale": 2, "skin": "narrow" }
}
hscale: horizontal scale factor, default 1. Increase it for long wave strings.
skin: graphic style, default or narrow. Colors follow the page theme automatically — no manual color setting needed.
Per-signal phase (shift) and period (stretch) fine-tune a single lane, e.g. { "name": "clk", "wave": "p...", "period": 2, "phase": 0.5 }.
Nodes and timing arcs
Place markers with node, then draw labeled arcs with the edge array:
{ "signal": [
{ "name": "clk", "wave": "p.......", "node": "..a.....b" },
{ "name": "d", "wave": "x.3.4.5x", "node": "...c....d" }
],
"edge": [ "a~>c setup", "d~>b hold" ]
}
Each letter in node marks a time slot; a~>c setup draws an arc from node a to c labeled "setup".
Signal groups
Nest lanes in an array with a group name to draw bus-style groups:
{ "signal": [
["Master",
{ "name": "SCLK", "wave": "p...." },
{ "name": "MOSI", "wave": "x.2.2x", "data": ["D7", "D6"] }
],
{ "name": "CS", "wave": "1.0..1" }
]}
Register diagrams
Swap signal for reg to draw register bit-fields. bits sets the width, attr the attribute label, and an empty { "bits": n } marks reserved bits:
{ "reg": [
{ "name": "EN", "bits": 1, "attr": "rw" },
{ "bits": 3 },
{ "name": "MODE", "bits": 4, "attr": "rw" }
],
"config": { "bits": 8 }
}