fhdl: autofragment
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 10 Dec 2011 19:47:21 +0000 (20:47 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 10 Dec 2011 19:47:21 +0000 (20:47 +0100)
migen/fhdl/autofragment.py [new file with mode: 0644]

diff --git a/migen/fhdl/autofragment.py b/migen/fhdl/autofragment.py
new file mode 100644 (file)
index 0000000..ecad96b
--- /dev/null
@@ -0,0 +1,13 @@
+from .structure import *
+import inspect
+
+def FromLocal():
+       f = Fragment()
+       frame = inspect.currentframe().f_back
+       ns = frame.f_locals
+       for x in ns:
+               obj = ns[x]
+               if hasattr(obj, "GetFragment"):
+                       print("adding "+x)
+                       f += obj.GetFragment()
+       return f