Skip to content

Commit

Permalink
Amaranth 0.5.3 (kuznia-rdzeni/coreblocks#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Nov 25, 2024
1 parent 5c44ab8 commit e3f5a22
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 78 deletions.
2 changes: 2 additions & 0 deletions test/testing/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def test_error_log(self, caplog):
async def proc(sim: TestbenchContext):
await sim.tick()
sim.set(m.input, 1)
await sim.tick() # A log after the last tick is not handled

with pytest.raises(AssertionError):
with self.run_simulation(m) as sim:
Expand All @@ -112,6 +113,7 @@ def test_assertion(self, caplog):
async def proc(sim: TestbenchContext):
await sim.tick()
sim.set(m.input, 1)
await sim.tick() # A log after the last tick is not handled

with pytest.raises(AssertionError):
with self.run_simulation(m) as sim:
Expand Down
71 changes: 0 additions & 71 deletions transactron/testing/gtkw_extension.py

This file was deleted.

16 changes: 10 additions & 6 deletions transactron/testing/infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .profiler import profiler_process, Profile
from .logging import make_logging_process, parse_logging_level, _LogFormatter
from .tick_count import make_tick_count_process
from .gtkw_extension import write_vcd_ext
from .method_mock import MethodMock
from transactron import Method
from transactron.lib import AdapterTrans
Expand Down Expand Up @@ -156,22 +155,27 @@ def __init__(
extra_signals = extra_signals()
clocks = [d.clk for d in cast(Any, self)._design.fragment.domains.values()]

self.ctx = write_vcd_ext(
cast(Any, self)._engine,
self.ctx = self.write_vcd(
f"{traces_dir}/{traces_file}.vcd",
f"{traces_dir}/{traces_file}.gtkw",
traces=[clocks, extra_signals],
)
else:
self.ctx = nullcontext()

self.deadline = clk_period * max_cycles
self.timeouted = False

async def timeout_testbench(sim: SimulatorContext):
await sim.delay(clk_period * max_cycles)
self.timeouted = True

self.add_testbench(timeout_testbench, background=True)

def run(self) -> bool:
with self.ctx:
self.run_until(self.deadline)
super().run()

return not self.advance()
return not self.timeouted


class TestCaseWithSimulator:
Expand Down
2 changes: 1 addition & 1 deletion transactron/testing/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def log_process(sim: ProcessContext) -> None:
ticks = DependencyContext.get().get_dependency(TicksKey())

async for _, _, ticks_val, combined_trigger_val, *record_vals in (
sim.tick("sync_neg")
sim.tick()
.sample(ticks, combined_trigger)
.sample(*itertools.chain(*([record.trigger] + record.fields for record in records)))
):
Expand Down

0 comments on commit e3f5a22

Please sign in to comment.