Use super() instead of calling parent constructors directly

This commit is contained in:
Sebastien Bourdeauducq 2012-06-08 18:06:12 +02:00
parent 152a7e282e
commit 11674242c4
8 changed files with 23 additions and 23 deletions

View File

@ -20,7 +20,7 @@ class For(Actor):
for n, bv in enumerate(self.d_bv)]
l_source = [("d{0}".format(n), bv)
for n, bv in enumerate(self.d_bv)]
Actor.__init__(self,
super().__init__(
("sink", Sink, l_sink),
("source", Source, l_source))

View File

@ -38,7 +38,7 @@ class RegisterFields:
class RegisterField(RegisterFields):
def __init__(self, name, size=1, access_bus=READ_WRITE, access_dev=READ_ONLY, reset=0):
self.field = Field(name, size, access_bus, access_dev, reset)
RegisterFields.__init__(self, name, [self.field])
super().__init__(name, [self.field])
class FieldAlias:
def __init__(self, f, start, end):

View File

@ -10,7 +10,7 @@ _desc = Description(
class Interface(SimpleInterface):
def __init__(self):
SimpleInterface.__init__(self, _desc)
super().__init__(_desc)
class Interconnect(SimpleInterconnect):
pass

View File

@ -20,11 +20,11 @@ _desc = Description(
class Interface(SimpleInterface):
def __init__(self):
SimpleInterface.__init__(self, _desc)
super().__init__(_desc)
class InterconnectPointToPoint(SimpleInterconnect):
def __init__(self, master, slave):
SimpleInterconnect.__init__(self, master, [slave])
super().__init__(master, [slave])
class Arbiter:
def __init__(self, masters, target):

View File

@ -93,7 +93,7 @@ class SequentialActor(BinaryActor):
def __init__(self, delay, *endpoint_descriptions, **misc):
self.delay = delay
self.trigger = Signal()
BinaryActor.__init__(*endpoint_descriptions, **misc)
super().__init__(*endpoint_descriptions, **misc)
def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
ready = Signal()
@ -125,7 +125,7 @@ class PipelinedActor(BinaryActor):
def __init__(self, latency, *endpoint_descriptions, **misc):
self.latency = latency
self.pipe_ce = Signal()
BinaryActor.__init__(*endpoint_descriptions, **misc)
super().__init__(*endpoint_descriptions, **misc)
def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
valid = Signal(BV(self.latency))

View File

@ -7,7 +7,7 @@ from migen.corelogic import divider
class _SimpleBinary(CombinatorialActor):
def __init__(self, op, bv_op, bv_r):
self.op = op
CombinatorialActor.__init__(self,
super().__init____(
("operands", Sink, [("a", bv_op), ("b", bv_op)]),
("result", Source, [("r", bv_r)]))
@ -19,48 +19,48 @@ class _SimpleBinary(CombinatorialActor):
class Add(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "+", bv, BV(bv.width+1, bv.signed))
super().__init__("+", bv, BV(bv.width+1, bv.signed))
class Sub(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "-", bv, BV(bv.width+1, bv.signed))
super().__init__("-", bv, BV(bv.width+1, bv.signed))
class Mul(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "*", bv, BV(2*bv.width, bv.signed))
super().__init__("*", bv, BV(2*bv.width, bv.signed))
class And(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "&", bv, bv)
super().__init__("&", bv, bv)
class Xor(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "^", bv, bv)
super().__init__("^", bv, bv)
class Or(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "|", bv, bv)
super().__init__("|", bv, bv)
class LT(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "<", bv, BV(1))
super().__init__("<", bv, BV(1))
class LE(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "<=", bv, BV(1))
super().__init__("<=", bv, BV(1))
class EQ(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "==", bv, BV(1))
super().__init__("==", bv, BV(1))
class NE(_SimpleBinary):
def __init__(self, bv):
_SimpleBinary.__init__(self, "!=", bv, BV(1))
super().__init__("!=", bv, BV(1))
class DivMod(SequentialActor):
def __init__(self, width):
self.div = divider.Divider(width)
SequentialActor.__init__(self, width,
super().__init__(width,
("operands", Sink, [("dividend", self.div.dividend_i), ("divisor", self.div.divisor_i)]),
("result", Source, [("quotient", self.div.quotient_o), ("remainder", self.div.remainder_o)]))

View File

@ -7,7 +7,7 @@ from migen.corelogic.misc import optree
class CompositeActor(Actor):
def __init__(self, dfg): # TODO: endpoints
self.dfg = dfg
Actor.__init__(self)
super().__init__()
def get_fragment(self):
this_fragments = [get_conn_fragment(x[0].endpoints[x[2]["source"]], x[1].endpoints[x[2]["sink"]])

View File

@ -5,7 +5,7 @@ from migen.corelogic.misc import optree
class Buffer(PipelinedActor):
def __init__(self, layout):
PipelinedActor.__init__(self, 1,
super().__init__(1,
("d", Sink, layout), ("q", Source, layout))
def get_process_fragment(self):
@ -22,7 +22,7 @@ class Combinator(CombinatorialActor):
for n, r in enumerate(subrecords)]
ep_source = ("source", Source, source)
eps.append(ep_source)
CombinatorialActor.__init__(self, *eps)
super().__init__(*eps)
def get_fragment(self):
source = self.endpoints["source"]
@ -40,6 +40,6 @@ class Splitter(CombinatorialActor):
for n, r in enumerate(subrecords)]
ep_sink = ("sink", Sink, sink)
eps.append(ep_sink)
CombinatorialActor.__init__(self, *eps)
super().__init__(*eps)
# TODO def get_fragment(self):