This repository contains wavedrom svg generator for cocotb sims.
Installation from pip (release version, stable):
$ pip install cocotbext-waves
Example sampling AHB signals using cocotbext-ahb
.
from cocotbext.waves import waveform
...
waves = waveform(
clk=dut.hclk, name="ahb_test", hscale=3, debug=True
)
waves.add_signal(
[
dut.hsel,
dut.haddr,
dut.hburst,
dut.hsize,
dut.htrans,
dut.hwdata,
dut.hwrite,
dut.hready_in,
],
group="MOSI",
)
waves.add_signal(
[
dut.hrdata,
dut.hready,
dut.hresp,
],
group="MISO",
)
waves.start()
...
<Running sim, issuing txns>
...
waves.save_svg()
waves.save_txt()
Output:
class waveform:
def __init__(
self,
clk,
name,
hscale: int = 2,
is_posedge: bool = True,
debug: bool = False,
start: bool = True
) -> None:
- clk: Synchronous clock used as the sample the signals
- name: Defines the object / filename, also part of the diagram header
- hscale: Horizontal scale for the SVG
- is_posedge: Defines clock model
- debug: Enable some debug messages
- start: Starts the signal monitoring
Optional start/stop the sampling to create the diagram.y
Adds a trigger to start sampling the signal, starts when handle.value == val.
Adds a signal to be monitored in the diagram. If it is a clock, other arguments can be populated, please note that signals from the same group have to be declared in a single method call.
Set header/foot propertries of the diagram, more info on wavedrom website.
Stops the sampling and convert into SVG the final diagram.
Stops the sampling and convert into .txt fmt the json.