From: Sebastien Bourdeauducq Date: Mon, 15 Oct 2012 17:42:30 +0000 (+0200) Subject: transform/unroll_sync: support generator function X-Git-Tag: 24jan2021_ls180~2099^2~822 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fecab5518bfef72105ab4ba437f0cad51fc4e6f4;p=litex.git transform/unroll_sync: support generator function --- diff --git a/migen/transform/unroll.py b/migen/transform/unroll.py index 0d0ef9ee..644fe7ee 100644 --- a/migen/transform/unroll.py +++ b/migen/transform/unroll.py @@ -80,7 +80,7 @@ def _variable_for(s, n): name = "v" return Signal(s.bv, name=name, variable=True) -def unroll_sync(sync, inputs, outputs): +def unroll_sync(statements, inputs, outputs): assert(inputs or outputs) if inputs: sd_in = _list_step_dicts(inputs) @@ -106,7 +106,11 @@ def unroll_sync(sync, inputs, outputs): # replace signals with intermediate variables and copy statements io_var_dict.update(di) - r += _replace(sync, io_var_dict, do_var) + if isinstance(statements, list): + sl = statements + else: + sl = statements(n) + r += _replace(sl, io_var_dict, do_var) # assign to output signals r += [v.eq(do_var[k]) for k, v in do.items()]