litex/migen/fhdl/autofragment.py

14 lines
246 B
Python
Raw Normal View History

2011-12-10 14:47:21 -05:00
import inspect
2011-12-16 10:02:55 -05:00
from migen.fhdl.structure import *
def from_local():
2011-12-10 14:47:21 -05:00
f = Fragment()
frame = inspect.currentframe().f_back
ns = frame.f_locals
for x in ns:
obj = ns[x]
2011-12-16 10:02:55 -05:00
if hasattr(obj, "get_fragment"):
f += obj.get_fragment()
2011-12-10 14:47:21 -05:00
return f