fhdl/tools/flat_iteration: generalize

This commit is contained in:
Sebastien Bourdeauducq 2013-03-09 23:03:15 +01:00
parent f53acb92e7
commit 72fb6fd6bd
1 changed files with 3 additions and 1 deletions

View File

@ -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: