From e6987962bfd2307c1d085dcddddf816b34a01903 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Fri, 31 Jan 2020 16:54:25 -0500 Subject: [PATCH] Fix nmigen "domain" error when trying to run unit tests When I try to run any unit test with nmigen c42c3a0, I get the following error: Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/mnolan/git/ieee754fpu/src/ieee754/fpmul/test/test_fpmul_pipe.py", line 24, in test_pipe_fp16() File "/home/mnolan/git/ieee754fpu/src/ieee754/fpmul/test/test_fpmul_pipe.py", line 12, in test_pipe_fp16 runfp(dut, 16, "test_fpmul_pipe_fp16", Float16, mul, n_vals=50) File "/home/mnolan/git/ieee754fpu/src/ieee754/fpcommon/test/fpmux.py", line 316, in runfp run_simulation(dut, fns, vcd_name="%s.vcd" % name) File "/home/mnolan/git/nmigen/nmigen/compat/sim/__init__.py", line 22, in run_simulation fragment.domains += ClockDomain("sync") AttributeError: 'FPMULMuxInOut' object has no attribute 'domains' This seems to fix this error by giving the functions in the testbench a default clock domain, rather than leaving it up to nmigen to figure out. --- src/ieee754/fpcommon/test/fpmux.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ieee754/fpcommon/test/fpmux.py b/src/ieee754/fpcommon/test/fpmux.py index 806b215f..0abb67ca 100644 --- a/src/ieee754/fpcommon/test/fpmux.py +++ b/src/ieee754/fpcommon/test/fpmux.py @@ -313,4 +313,4 @@ def runfp(dut, width, name, fpkls, fpop, single_op=False, n_vals=10, for i in range(dut.num_rows): fns.append(test.rcv(i)) fns.append(test.send(i)) - run_simulation(dut, fns, vcd_name="%s.vcd" % name) + run_simulation(dut, {"sync": fns}, vcd_name="%s.vcd" % name) -- 2.30.2