from collections import OrderedDict
from migen.fhdl.std import *
-from migen.fhdl.decorators import ModuleDecorator
from migen.genlib.resetsync import AsyncResetSynchronizer
from migen.genlib.record import *
from migen.genlib.fsm import FSM, NextState
+from migen.fhdl.decorators import ModuleTransformer
from misoclib.com.liteeth.common import *
# Generic classes
return r
# Generic modules
-class BufferizeEndpoints(ModuleDecorator):
- def __init__(self, submodule, *args):
- ModuleDecorator.__init__(self, submodule)
+class BufferizeEndpoints(ModuleTransformer):
+ def __init__(self, *names):
+ self.names = names
+ def transform_instance(self, submodule):
endpoints = get_endpoints(submodule)
sinks = {}
sources = {}
for name, endpoint in endpoints.items():
- if name in args or len(args) == 0:
+ if not self.names or name in self.names:
if isinstance(endpoint, Sink):
sinks.update({name : endpoint})
elif isinstance(endpoint, Source):
import math
from migen.fhdl.std import *
-from migen.fhdl.decorators import ModuleDecorator
+from migen.fhdl.decorators import ModuleTransformer
from migen.genlib.resetsync import *
from migen.genlib.fsm import *
from migen.genlib.record import *
return n*logical_sector_size//4
# Generic modules
-class BufferizeEndpoints(ModuleDecorator):
- def __init__(self, submodule, *args):
- ModuleDecorator.__init__(self, submodule)
+class BufferizeEndpoints(ModuleTransformer):
+ def __init__(self, *names):
+ self.names = names
+ def transform_instance(self, submodule):
endpoints = get_endpoints(submodule)
sinks = {}
sources = {}
for name, endpoint in endpoints.items():
- if name in args or len(args) == 0:
+ if not self.names or name in self.names:
if isinstance(endpoint, Sink):
sinks.update({name : endpoint})
elif isinstance(endpoint, Source):
from misoclib.mem.litesata.common import *
from misoclib.mem.litesata.core.link.scrambler import Scrambler
-from migen.fhdl.decorators import ModuleDecorator
from migen.bank.description import *
class LiteSATABISTGenerator(Module):