part_mask = (1 << len(part)) - 1
gen_parts.append(f"(({self(part)} & {part_mask}) << {offset})")
offset += len(part)
- return f"({' | '.join(gen_parts)})"
+ if gen_parts:
+ return f"({' | '.join(gen_parts)})"
+ return f"0"
def on_Repl(self, value):
part_mask = (1 << len(value.value)) - 1
for _ in range(value.count):
gen_parts.append(f"({gen_part} << {offset})")
offset += len(value.value)
- return f"({' | '.join(gen_parts)})"
+ if gen_parts:
+ return f"({' | '.join(gen_parts)})"
+ return f"0"
def on_ArrayProxy(self, value):
index_mask = (1 << len(value.index)) - 1
with sim.write_vcd(open(os.path.devnull, "wt")):
with sim.write_vcd(open(os.path.devnull, "wt")):
pass
+
+
+class SimulatorRegressionTestCase(FHDLTestCase):
+ def test_bug_325(self):
+ dut = Module()
+ dut.d.comb += Signal().eq(Cat())
+ Simulator(dut).run()
+
+ def test_bug_325_bis(self):
+ dut = Module()
+ dut.d.comb += Signal().eq(Repl(Const(1), 0))
+ Simulator(dut).run()