fhdl/tools/flat_iteration: generalize
This commit is contained in:
parent
f53acb92e7
commit
72fb6fd6bd
|
@ -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 New Issue