Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

elsewhere: do not create interface in default param

  • Loading branch information...
commit 280a87ea694e0d403732ee1a9f30821e777bc5bd 1 parent 62187aa
@sbourdeauducq sbourdeauducq authored
Showing with 15 additions and 5 deletions.
  1. +6 −2 migen/bus/csr.py
  2. +9 −3 migen/bus/wishbone.py
View
8 migen/bus/csr.py
@@ -18,8 +18,10 @@ class Interconnect(SimpleInterconnect):
pass
class Initiator(PureSimulable):
- def __init__(self, generator, bus=Interface()):
+ def __init__(self, generator, bus=None):
self.generator = generator
+ if bus is None:
+ bus = Interface()
self.bus = bus
self.transaction = None
self.done = False
@@ -50,7 +52,7 @@ def _compute_page_bits(nwords):
return 0
class SRAM:
- def __init__(self, mem_or_size, address, bus=Interface()):
+ def __init__(self, mem_or_size, address, bus=None):
if isinstance(mem_or_size, Memory):
assert(mem_or_size.width <= data_width)
self.mem = mem_or_size
@@ -62,6 +64,8 @@ def __init__(self, mem_or_size, address, bus=Interface()):
self._page = RegisterField("page", page_bits)
else:
self._page = None
+ if bus is None:
+ bus = Interface()
self.bus = bus
def get_registers(self):
View
12 migen/bus/wishbone.py
@@ -133,8 +133,10 @@ def do_simulation(self, s):
self.handler(transaction)
class Initiator(PureSimulable):
- def __init__(self, generator, bus=Interface()):
+ def __init__(self, generator, bus=None):
self.generator = generator
+ if bus is None:
+ bus = Interface()
self.bus = bus
self.transaction_start = 0
self.transaction = None
@@ -178,7 +180,9 @@ def can_ack(self, bus):
return True
class Target(PureSimulable):
- def __init__(self, model, bus=Interface()):
+ def __init__(self, model, bus=None):
+ if bus is None:
+ bus = Interface()
self.bus = bus
self.model = model
@@ -195,12 +199,14 @@ def do_simulation(self, s):
bus.ack = 0
class SRAM:
- def __init__(self, mem_or_size, bus=Interface()):
+ def __init__(self, mem_or_size, bus=None):
if isinstance(mem_or_size, Memory):
assert(mem_or_size.width <= 32)
self.mem = mem_or_size
else:
self.mem = Memory(32, mem_or_size//4)
+ if bus is None:
+ bus = Interface()
self.bus = bus
def get_fragment(self):
Please sign in to comment.
Something went wrong with that request. Please try again.