from migen.fhdl import visit as fhdl
from migen.corelogic.fsm import FSM
from migen.pytholite import transel
+from migen.pytholite.io import *
class FinalizeError(Exception):
pass
fsm.act(getattr(fsm, stnames[i]), *actions)
return fsm
-def make_pytholite(func):
+def make_pytholite(func, **ioresources):
+ pl = make_io_object(**ioresources)
+
tree = ast.parse(inspect.getsource(func))
symdict = func.__globals__.copy()
registers = []
fsm = _create_fsm(states)
fsmf = _LowerAbstractLoad().visit(fsm.get_fragment())
- return regf + fsmf
+ pl.fragment = regf + fsmf
+ return pl
--- /dev/null
+from migen.flow.actor import *
+
+class Pytholite:
+ def get_fragment(self):
+ return self.fragment
+
+class DFPytholite(Pytholite, Actor):
+ pass
+
+def make_io_object(dataflow=None):
+ if dataflow is None:
+ return Pytholite()
+ else:
+ return DFPytholite(dataflow)
+