mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
fhdl/tools/flat_iteration: generalize
This commit is contained in:
parent
f53acb92e7
commit
72fb6fd6bd
1 changed files with 3 additions and 1 deletions
|
@ -1,10 +1,12 @@
|
|||
import collections
|
||||
|
||||
from migen.fhdl.structure import *
|
||||
from migen.fhdl.structure import _Operator, _Slice, _Assign, _ArrayProxy
|
||||
from migen.fhdl.visit import NodeVisitor, NodeTransformer
|
||||
|
||||
def flat_iteration(l):
|
||||
for element in l:
|
||||
if isinstance(element, (list, tuple)):
|
||||
if isinstance(element, collections.Iterable):
|
||||
for element2 in flat_iteration(element):
|
||||
yield element2
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue