Skip to content

Commit

Permalink
Added start method
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio da Silva <[email protected]>
  • Loading branch information
aignacio committed Nov 1, 2024
1 parent 3274392 commit 2dc4f2b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ waves.add_signal(
],
group="MISO",
)
waves.start()
...
<Running sim, issuing txns>
...
Expand Down
9 changes: 7 additions & 2 deletions cocotbext/waves/waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <[email protected]>
# Date : 25.10.2024
# Last Modified Date: 31.10.2024
# Last Modified Date: 01.11.2024
import cocotb
import wavedrom
import json
Expand Down Expand Up @@ -56,6 +56,7 @@ def __init__(
self.head = {"text": name, "tick": 0, "every": 1}
self.foot = {"text": "Generated by cocotbext-waves", "tick": 0, "every": 1}

self._start = False
self.close = False
self.hscale = hscale
self.debug = debug
Expand All @@ -65,7 +66,6 @@ def __init__(
self.color_idx = 3 # Start color for multi-bit signal

self.add_signal(clk, color=None, is_clock=True, is_posedge_clock=is_posedge)
self.mon = cocotb.start_soon(self._monitor())

self.log = logging.getLogger(f"cocotb.waves.{name}")
self.log.info(f"Waveform / Wavedrom - ({name})")
Expand Down Expand Up @@ -150,6 +150,11 @@ def add_signal(
for item in sig_list:
self.waves["signal"].append(item)

def start(self):
if self._start is False:
self.mon = cocotb.start_soon(self._monitor())
self._start = True

async def _monitor(self):
while True:
if self.is_posedge is True:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_gen_ahb_waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <[email protected]>
# Date : 25.10.2024
# Last Modified Date: 31.10.2024
# Last Modified Date: 01.11.2024
import cocotb
import os
import random
Expand Down Expand Up @@ -80,6 +80,8 @@ async def run_test(dut, bp_fn=None, pip_mode=False):
]
)

waves.start()

await setup_dut(dut, cfg.RST_CYCLES)

ahb_master = AHBMaster(AHBBus.from_entity(dut), dut.hclk, dut.hresetn, def_val="Z")
Expand Down
4 changes: 3 additions & 1 deletion tests/test_gen_ahb_waves_ram.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <[email protected]>
# Date : 25.10.2024
# Last Modified Date: 31.10.2024
# Last Modified Date: 01.11.2024
import cocotb
import os
import random
Expand Down Expand Up @@ -67,6 +67,8 @@ async def run_test(dut):
group="MISO",
)

waves.start()

await setup_dut(dut, cfg.RST_CYCLES)

ahb_lite_sram = AHBLiteSlaveRAM(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_gen_ahb_waves_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <[email protected]>
# Date : 25.10.2024
# Last Modified Date: 31.10.2024
# Last Modified Date: 01.11.2024
import cocotb
import os
import random
Expand Down Expand Up @@ -65,6 +65,8 @@ async def run_test(dut):
)
waves.add_trigger(dut.hresetn, 1)

waves.start()

await setup_dut(dut, cfg.RST_CYCLES)

ahb_master = AHBMaster(AHBBus.from_entity(dut), dut.hclk, dut.hresetn, def_val="Z")
Expand Down

0 comments on commit 2dc4f2b

Please sign in to comment.