[![Lint > Tests > Publish](https://github.com/aignacio/cocotbext-waves/actions/workflows/run.yaml/badge.svg)](https://github.com/aignacio/cocotbext-waves/actions/workflows/run.yaml)
# Cocotb Waves
## Table of Contents
* [Introduction](#intro)
* [Installation](#install)
* [Usage](#usage)
* [Classes & Methods](#methods)
## <a name="intro"></a> Introduction
This repository contains wavedrom svg generator for [cocotb](https://github.com/cocotb/cocotb) sims.
## <a name="install"></a> Installation
Installation from pip (release version, stable):
```bash
$ pip install cocotbext-waves
```
## <a name="usage"></a> Usage
Example sampling AHB signals using [`cocotbext-ahb`](https://github.com/aignacio/cocotbext-ahb).
```python
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:**
![ahb](ahb_test.svg)
## <a name="methods"></a> Classes & Methods
### Class waveform
```python
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
### .start()/.stop()
Optional start/stop the sampling to create the diagram.y
### .add_trigger(handle, val)
Adds a trigger to start sampling the signal, starts when handle.value == val.
### .add_signal(color, is_clock, is_posedge_clock, clock_period, group)
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_head/foot(text, tick, every)
Set header/foot propertries of the diagram, more info on wavedrom website.
### .save_svg()
Stops the sampling and convert into SVG the final diagram.
### .save_txt()
Stops the sampling and convert into .txt fmt the json.
Raw data
{
"_id": null,
"home_page": "https://github.com/aignacio/cocotbext-waves",
"name": "cocotbext-waves",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "soc, vip, hdl, verilog, systemverilog, wavedrom",
"author": "aignacio (Anderson Ignacio)",
"author_email": "<anderson@aignacio.com>",
"download_url": "https://files.pythonhosted.org/packages/e6/99/91240031facf974721bf843426f6c77aebf68d250456bb1c6b24ed17e5c5/cocotbext-waves-0.1.9.tar.gz",
"platform": null,
"description": "\n[![Lint > Tests > Publish](https://github.com/aignacio/cocotbext-waves/actions/workflows/run.yaml/badge.svg)](https://github.com/aignacio/cocotbext-waves/actions/workflows/run.yaml)\n\n# Cocotb Waves\n\n## Table of Contents\n* [Introduction](#intro)\n* [Installation](#install)\n* [Usage](#usage)\n* [Classes & Methods](#methods)\n\n## <a name=\"intro\"></a> Introduction\n\nThis repository contains wavedrom svg generator for [cocotb](https://github.com/cocotb/cocotb) sims.\n\n## <a name=\"install\"></a> Installation\n\nInstallation from pip (release version, stable):\n```bash\n$ pip install cocotbext-waves\n```\n\n## <a name=\"usage\"></a> Usage\n\nExample sampling AHB signals using [`cocotbext-ahb`](https://github.com/aignacio/cocotbext-ahb).\n\n```python\nfrom cocotbext.waves import waveform\n\n...\n\nwaves = waveform(\n clk=dut.hclk, name=\"ahb_test\", hscale=3, debug=True\n)\nwaves.add_signal(\n [\n dut.hsel,\n dut.haddr,\n dut.hburst,\n dut.hsize,\n dut.htrans,\n dut.hwdata,\n dut.hwrite,\n dut.hready_in,\n ],\n group=\"MOSI\",\n)\nwaves.add_signal(\n [\n dut.hrdata,\n dut.hready,\n dut.hresp,\n ],\n group=\"MISO\",\n)\nwaves.start()\n...\n<Running sim, issuing txns>\n...\nwaves.save_svg()\nwaves.save_txt()\n```\n\n**Output:**\n\n![ahb](ahb_test.svg)\n\n## <a name=\"methods\"></a> Classes & Methods\n\n### Class waveform\n\n```python\nclass waveform:\n def __init__(\n self,\n clk,\n name,\n hscale: int = 2,\n is_posedge: bool = True,\n debug: bool = False,\n start: bool = True\n ) -> None:\n```\n\n* **clk**: Synchronous clock used as the sample the signals\n* **name**: Defines the object / filename, also part of the diagram header\n* **hscale**: Horizontal scale for the SVG\n* **is_posedge**: Defines clock model\n* **debug**: Enable some debug messages\n* **start**: Starts the signal monitoring\n\n### .start()/.stop()\n\nOptional start/stop the sampling to create the diagram.y\n\n### .add_trigger(handle, val)\n\nAdds a trigger to start sampling the signal, starts when handle.value == val.\n\n### .add_signal(color, is_clock, is_posedge_clock, clock_period, group)\n\nAdds a signal to be monitored in the diagram. If it is a clock, other arguments\ncan be populated, please note that signals from the same *group* have to be\ndeclared in a single method call.\n\n### .set_head/foot(text, tick, every)\n\nSet header/foot propertries of the diagram, more info on wavedrom website.\n\n### .save_svg()\n\nStops the sampling and convert into SVG the final diagram.\n\n### .save_txt()\n\nStops the sampling and convert into .txt fmt the json.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CocotbExt Wavedrom diagram generator",
"version": "0.1.9",
"project_urls": {
"Bug Tracker": "https://github.com/aignacio/cocotbext-waves/issues",
"Homepage": "https://github.com/aignacio/cocotbext-waves",
"Source Code": "https://github.com/aignacio/cocotbext-waves"
},
"split_keywords": [
"soc",
" vip",
" hdl",
" verilog",
" systemverilog",
" wavedrom"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "944db6ce89bff53214a2fa7580281e07d397d44db212401b16d5da6f5782381c",
"md5": "743fca3e375cf814feb896b0fb2be56e",
"sha256": "dac9bfbe9a89529e5261751bf2fc095079ad1d382c480892e94bc95f64ceaceb"
},
"downloads": -1,
"filename": "cocotbext_waves-0.1.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "743fca3e375cf814feb896b0fb2be56e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6626,
"upload_time": "2024-11-01T20:03:29",
"upload_time_iso_8601": "2024-11-01T20:03:29.553748Z",
"url": "https://files.pythonhosted.org/packages/94/4d/b6ce89bff53214a2fa7580281e07d397d44db212401b16d5da6f5782381c/cocotbext_waves-0.1.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e69991240031facf974721bf843426f6c77aebf68d250456bb1c6b24ed17e5c5",
"md5": "81ff6c38204b6ea2a451410549712317",
"sha256": "93e19b13072b40d4ec77204f946d5bd34708a19734a485cea4fcd1a6b01db7f5"
},
"downloads": -1,
"filename": "cocotbext-waves-0.1.9.tar.gz",
"has_sig": false,
"md5_digest": "81ff6c38204b6ea2a451410549712317",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6517,
"upload_time": "2024-11-01T20:03:31",
"upload_time_iso_8601": "2024-11-01T20:03:31.699240Z",
"url": "https://files.pythonhosted.org/packages/e6/99/91240031facf974721bf843426f6c77aebf68d250456bb1c6b24ed17e5c5/cocotbext-waves-0.1.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-01 20:03:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aignacio",
"github_project": "cocotbext-waves",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cocotbext-waves"
}