pytholite: introduce io module
This commit is contained in:
parent
6776f06a42
commit
48acb1bcfd
|
@ -7,6 +7,7 @@ from migen.fhdl.structure import _Slice
|
||||||
from migen.fhdl import visit as fhdl
|
from migen.fhdl import visit as fhdl
|
||||||
from migen.corelogic.fsm import FSM
|
from migen.corelogic.fsm import FSM
|
||||||
from migen.pytholite import transel
|
from migen.pytholite import transel
|
||||||
|
from migen.pytholite.io import *
|
||||||
|
|
||||||
class FinalizeError(Exception):
|
class FinalizeError(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -319,7 +320,9 @@ def _create_fsm(states):
|
||||||
fsm.act(getattr(fsm, stnames[i]), *actions)
|
fsm.act(getattr(fsm, stnames[i]), *actions)
|
||||||
return fsm
|
return fsm
|
||||||
|
|
||||||
def make_pytholite(func):
|
def make_pytholite(func, **ioresources):
|
||||||
|
pl = make_io_object(**ioresources)
|
||||||
|
|
||||||
tree = ast.parse(inspect.getsource(func))
|
tree = ast.parse(inspect.getsource(func))
|
||||||
symdict = func.__globals__.copy()
|
symdict = func.__globals__.copy()
|
||||||
registers = []
|
registers = []
|
||||||
|
@ -334,4 +337,5 @@ def make_pytholite(func):
|
||||||
fsm = _create_fsm(states)
|
fsm = _create_fsm(states)
|
||||||
fsmf = _LowerAbstractLoad().visit(fsm.get_fragment())
|
fsmf = _LowerAbstractLoad().visit(fsm.get_fragment())
|
||||||
|
|
||||||
return regf + fsmf
|
pl.fragment = regf + fsmf
|
||||||
|
return pl
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
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)
|
||||||
|
|
Loading…
Reference in New Issue