def __init__(self, port):
self.port = port
assert(len(self.port.slots) == 1)
- super().__init__(
+ Actor.__init__(self,
("address", Sink, [("a", self.port.hub.aw)]),
("data", Source, [("d", self.port.hub.dw)]))
def __init__(self, port):
self.port = port
assert(len(self.port.slots) > 1)
- super().__init__(
+ Actor.__init__(self,
("address", Sink, [("a", self.port.hub.aw)]),
("data", Source, [("d", self.port.hub.dw)]))
class Reader(Actor):
def __init__(self):
self.bus = wishbone.Interface()
- super().__init__(
+ Actor.__init__(self,
("address", Sink, [("a", 30)]),
("data", Source, [("d", 32)]))
class Writer(Actor):
def __init__(self):
self.bus = wishbone.Interface()
- super().__init__(
+ Actor.__init__(self,
("address_data", Sink, [("a", 30), ("d", 32)]))
def get_fragment(self):
if self.offsetbits:
parameters_layout.append(("offset", self.offsetbits))
- super().__init__(
+ Actor.__init__(self,
("parameters", Sink, parameters_layout),
("source", Source, [("value", max(self.nbits, self.offsetbits))]))
class SimActor(Actor):
def __init__(self, generator, *endpoint_descriptions, **misc):
- super().__init__(*endpoint_descriptions, **misc)
+ Actor.__init__(self, *endpoint_descriptions, **misc)
self.token_exchanger = TokenExchanger(generator, self)
def update_busy(self, s):
else:
s = str(list(t.value.values())[0])
print(prefix + s)
- super().__init__(dumper_gen(),
+ SimActor.__init__(self, dumper_gen(),
("result", Sink, layout))
class SingleGenerator(Actor):
def __init__(self, layout, mode):
self._mode = mode
- super().__init__(("source", Source, _convert_layout(layout)))
+ Actor.__init__(self, ("source", Source, _convert_layout(layout)))
self._registers, self._assigns = _create_registers_assign(layout,
self.token("source"), self._mode != MODE_SINGLE_SHOT)
if mode == MODE_EXTERNAL:
class Collector(Actor):
def __init__(self, layout, depth=1024):
- super().__init__(("sink", Sink, layout))
+ Actor.__init__(self, ("sink", Sink, layout))
self._depth = depth
self._dw = sum(len(s) for s in self.token("sink").flatten())
class Cast(CombinatorialActor):
def __init__(self, layout_from, layout_to):
- super().__init__(
+ CombinatorialActor.__init__(self,
("sink", Sink, _rawbits_layout(layout_from)),
("source", Source, _rawbits_layout(layout_to)))
class Unpack(Actor):
def __init__(self, n, layout_to):
self.n = n
- super().__init__(
+ Actor.__init__(self,
("sink", Sink, pack_layout(layout_to, n)),
("source", Source, layout_to))
class Pack(Actor):
def __init__(self, layout_from, n):
self.n = n
- super().__init__(
+ Actor.__init__(self,
("sink", Sink, layout_from),
("source", Source, pack_layout(layout_from, n)))
class RegisterField(RegisterFields):
def __init__(self, name, size=1, access_bus=READ_WRITE, access_dev=READ_ONLY, reset=0, atomic_write=False):
self.field = Field(name, size, access_bus, access_dev, reset, atomic_write)
- super().__init__(name, [self.field])
+ RegisterFields.__init__(self, name, [self.field])
(ALIAS_NON_ATOMIC, ALIAS_ATOMIC_HOLD, ALIAS_ATOMIC_COMMIT) = range(3)
class Interface(SimpleInterface):
def __init__(self):
- super().__init__(Description(
+ SimpleInterface.__init__(self, Description(
(M_TO_S, "adr", 14),
(M_TO_S, "we", 1),
(M_TO_S, "dat_w", data_width),
class Interface(SimpleInterface):
def __init__(self):
- super().__init__(_desc)
+ SimpleInterface.__init__(self, _desc)
class InterconnectPointToPoint(SimpleInterconnect):
def __init__(self, master, slave):
- super().__init__(master, [slave])
+ SimpleInterconnect.__init__(self, master, [slave])
class Arbiter:
def __init__(self, masters, target):
return _Assign(self, r)
def __hash__(self):
- return super().__hash__()
+ return HUID.__hash__(self)
class _Operator(Value):
def __init__(self, op, operands):
- super().__init__()
+ Value.__init__(self)
self.op = op
self.operands = operands
class _Slice(Value):
def __init__(self, value, start, stop):
- super().__init__()
+ Value.__init__(self)
self.value = value
self.start = start
self.stop = stop
class Cat(Value):
def __init__(self, *args):
- super().__init__()
+ Value.__init__(self)
self.l = args
class Replicate(Value):
def __init__(self, v, n):
- super().__init__()
+ Value.__init__(self)
self.v = v
self.n = n
class Signal(Value):
def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None):
- super().__init__()
+ Value.__init__(self)
# determine number of bits and signedness
if bits_sign is None:
if isinstance(key, Value):
return _ArrayProxy(self, key)
else:
- return super().__getitem__(key)
+ return list.__getitem__(self, key)
# extras
class Instance(HUID):
def __init__(self, of, *items, name=""):
- super().__init__()
+ HUID.__init__(self)
self.of = of
if name:
self.name_override = name
class Memory(HUID):
def __init__(self, width, depth, init=None):
- super().__init__()
+ HUID.__init__(self)
self.width = width
self.depth = depth
self.ports = []
cases[n] = [assign]
return Case(k, cases).makedefault()
else:
- return super().visit_Assign(node)
+ return NodeTransformer.visit_Assign(self, node)
def visit_ArrayProxy(self, node):
array_muxed = Signal(value_bits_sign(node))
class Actor(HUID):
def __init__(self, *endpoint_descriptions, endpoints=None):
- super().__init__()
+ HUID.__init__(self)
if endpoints is None:
self.endpoints = {}
for desc in endpoint_descriptions:
def __init__(self, delay, *endpoint_descriptions, **misc):
self.delay = delay
self.trigger = Signal()
- super().__init__(*endpoint_descriptions, **misc)
+ BinaryActor.__init__(self, *endpoint_descriptions, **misc)
def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
ready = Signal()
def __init__(self, latency, *endpoint_descriptions, **misc):
self.latency = latency
self.pipe_ce = Signal()
- super().__init__(*endpoint_descriptions, **misc)
+ BinaryActor.__init__(self, *endpoint_descriptions, **misc)
def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
valid = Signal(self.latency)
self._r_reset = RegisterRaw("reset", 1)
self.order = []
- super().__init__(dfg, self._create)
+ DFGHook.__init__(self, dfg, self._create)
def _create(self, u, ep, v):
self.order.append((u, ep, v))
h.freeze.eq(self._r_freeze.field.r),
h.reset.eq(self._r_reset.re)
]
- return Fragment(comb) + super().get_fragment()
+ return Fragment(comb) + DFGHook.get_fragment(self)
class AbstractActor(HUID):
def __init__(self, actor_class, parameters=dict(), name=None):
- super().__init__()
+ HUID.__init__(self)
self.actor_class = actor_class
self.parameters = parameters
self.name = name
class DataFlowGraph(MultiDiGraph):
def __init__(self):
- super().__init__()
+ MultiDiGraph.__init__(self)
self.elaborated = False
def add_connection(self, source_node, sink_node,
self.dfg = dfg
if debugger:
self.debugger = DFGReporter(self.dfg, debugger_nbits)
- super().__init__()
+ Actor.__init__(self)
def get_registers(self):
if hasattr(self, "debugger"):
class EndpointReporter(EndpointSimHook):
def __init__(self, endpoint):
- super().__init__(endpoint)
+ EndpointSimHook.__init__(self, endpoint)
self.reset()
def reset(self):
class DFGReporter(DFGHook):
def __init__(self, dfg):
- super().__init__(dfg, lambda u, ep, v: EndpointReporter(u.actor.endpoints[ep]))
+ DFGHook.__init__(self, dfg, lambda u, ep, v: EndpointReporter(u.actor.endpoints[ep]))
def get_edge_labels(self):
d = dict()
class Buffer(PipelinedActor):
def __init__(self, layout):
- super().__init__(1,
+ PipelinedActor.__init__(self, 1,
("d", Sink, layout), ("q", Source, layout))
def get_process_fragment(self):
for n, r in enumerate(subrecords)]
ep_source = ("source", Source, source)
eps.append(ep_source)
- super().__init__(*eps)
+ Actor.__init__(self, *eps)
def get_fragment(self):
source = self.endpoints["source"]
for n, r in enumerate(subr)]
ep_sink = ("sink", Sink, sink)
eps.append(ep_sink)
- super().__init__(*eps)
+ Actor.__init__(self, *eps)
def get_fragment(self):
sources = [self.endpoints[e] for e in self.sources()]
class Pytholite(UnifiedIOObject):
def __init__(self, dataflow=None, buses={}):
- super().__init__(dataflow, buses)
+ UnifiedIOObject.__init__(self, dataflow, buses)
if dataflow is not None:
self.busy.reset = 1
self.memory_ports = dict((mem, mem.get_port(write_capable=True, we_granularity=8))
for mem in self._memories)
def get_fragment(self):
- return super().get_fragment() + self.fragment
+ return UnifiedIOObject.get_fragment(self) + self.fragment
class _TokenPullExprCompiler(ExprCompiler):
def __init__(self, symdict, modelname, ep):
- super().__init__(symdict)
+ ExprCompiler.__init__(self, symdict)
self.modelname = modelname
self.ep = ep
class _BusReadExprCompiler(ExprCompiler):
def __init__(self, symdict, modelname, data_signal):
- super().__init__(symdict)
+ ExprCompiler.__init__(self, symdict)
self.modelname = modelname
self.data_signal = data_signal
class UnifiedIOObject(Actor):
def __init__(self, dataflow=None, buses={}):
if dataflow is not None:
- super().__init__(*dataflow)
+ Actor.__init__(self, *dataflow)
self.buses = buses
self._memories = set(v for v in self.buses.values() if isinstance(v, Memory))
class UnifiedIOSimulation(UnifiedIOObject):
def __init__(self, generator, dataflow=None, buses={}):
self.generator = Trampoline(generator)
- super().__init__(dataflow, buses)
+ UnifiedIOObject.__init__(self, dataflow, buses)
self.callers = []
self.busname_to_caller_id = {}
yield None
def get_fragment(self):
- f = super().get_fragment()
+ f = UnifiedIOObject.get_fragment(self)
return sum([c.get_fragment() for c in self.callers], f)