uio: unified I/O object

This commit is contained in:
Sebastien Bourdeauducq 2012-11-17 19:54:50 +01:00
parent d10df1a8ab
commit 7add4c6f3c
4 changed files with 14 additions and 13 deletions

View File

@ -6,7 +6,7 @@ from migen.fhdl.structure import _Slice
from migen.pytholite.reg import * from migen.pytholite.reg import *
from migen.pytholite.expr import * from migen.pytholite.expr import *
from migen.pytholite import transel from migen.pytholite import transel
from migen.pytholite.io import make_io_object, gen_io from migen.pytholite.io import Pytholite, gen_io
from migen.pytholite.fsm import * from migen.pytholite.fsm import *
def _is_name_used(node, name): def _is_name_used(node, name):
@ -228,7 +228,7 @@ class _Compiler:
raise NotImplementedError raise NotImplementedError
def make_pytholite(func, **ioresources): def make_pytholite(func, **ioresources):
ioo = make_io_object(**ioresources) ioo = Pytholite(**ioresources)
tree = ast.parse(inspect.getsource(func)) tree = ast.parse(inspect.getsource(func))
symdict = func.__globals__.copy() symdict = func.__globals__.copy()

View File

@ -1,24 +1,16 @@
import ast import ast
from migen.fhdl.structure import * from migen.fhdl.structure import *
from migen.flow.actor import * from migen.uio.ioo import UnifiedIOObject
from migen.actorlib.sim import * from migen.actorlib.sim import *
from migen.bus.transactions import *
from migen.pytholite.fsm import * from migen.pytholite.fsm import *
from migen.pytholite.expr import ExprCompiler from migen.pytholite.expr import ExprCompiler
class Pytholite: class Pytholite(UnifiedIOObject):
def get_fragment(self): def get_fragment(self):
return self.fragment return self.fragment
class DFPytholite(Pytholite, Actor):
pass
def make_io_object(dataflow=None):
if dataflow is None:
return Pytholite()
else:
return DFPytholite(*dataflow)
class _TokenPullExprCompiler(ExprCompiler): class _TokenPullExprCompiler(ExprCompiler):
def __init__(self, symdict, modelname, ep): def __init__(self, symdict, modelname, ep):
super().__init__(symdict) super().__init__(symdict)

0
migen/uio/__init__.py Normal file
View File

9
migen/uio/ioo.py Normal file
View File

@ -0,0 +1,9 @@
from migen.fhdl.structure import *
from migen.flow.actor import *
from migen.bus import wishbone
class UnifiedIOObject(Actor):
def __init__(self, dataflow=None, buses={}):
if dataflow is not None:
super().__init__(*dataflow)
self.buses = buses