diff --git a/hdl21/flatten.py b/hdl21/flatten.py index 5609810..ea787d5 100644 --- a/hdl21/flatten.py +++ b/hdl21/flatten.py @@ -89,7 +89,7 @@ def _find_signal_or_port(m: h.Module, name: str) -> h.Signal: def is_flat(m: Union[h.Instance, h.Instantiable]) -> bool: if isinstance(m, h.Instance): return is_flat(m.of) - elif isinstance(m, (h.PrimitiveCall, h.GeneratorCall, h.ExternalModuleCall)): + elif isinstance(m, (h.PrimitiveCall, h.ExternalModuleCall)): return True elif isinstance(m, h.Module): insts = m.instances.values() diff --git a/hdl21/tests/test_flatten.py b/hdl21/tests/test_flatten.py index d07f9f8..913354f 100644 --- a/hdl21/tests/test_flatten.py +++ b/hdl21/tests/test_flatten.py @@ -149,34 +149,3 @@ class M: flattened = flatten(M) - -def test_flatten_generator(): - """Flatten a Generator - (And it has Concat too! Kinda. But not by the point flattening happens).""" - - @h.paramclass - class Params: - how_many = h.Param(dtype=int, default=5, desc="How many inverters you want?") - - @h.generator - def Gen(params: Params) -> h.Module: - if params.how_many < 2: - raise ValueError - - @h.module - class M: - vdd, vss, vin, vout = h.Ports(4) - internal_signal = h.Signal(width=params.how_many - 1) - # Array of `how_many` series-connected inverters - invs = params.how_many * Inverter( - vdd=vdd, - vss=vss, - vin=h.Concat(vin, internal_signal), - vout=h.Concat(internal_signal, vout), - ) - - return M - - gen5 = Gen(how_many=5) - assert not is_flat(gen5) - flattened = flatten(gen5)