bus/asmibus: swap port position to be consistent with wishbone API

This commit is contained in:
Sebastien Bourdeauducq 2012-11-17 19:42:39 +01:00
parent ece786d6aa
commit 86090e1cbd
2 changed files with 8 additions and 8 deletions

View File

@ -78,8 +78,8 @@ def test_asmi():
port = hub.get_port() port = hub.get_port()
hub.finalize() hub.finalize()
# Create the initiator, target and tap (similar to the Wishbone case). # Create the initiator, target and tap (similar to the Wishbone case).
master = asmibus.Initiator(port, my_generator()) master = asmibus.Initiator(my_generator(), port)
slave = asmibus.Target(hub, MyModelASMI()) slave = asmibus.Target(MyModelASMI(), hub)
tap = asmibus.Tap(hub) tap = asmibus.Tap(hub)
# Run the simulation (same as the Wishbone case). # Run the simulation (same as the Wishbone case).
def end_simulation(s): def end_simulation(s):

View File

@ -213,13 +213,13 @@ class Tap(PureSimulable):
self.transaction = transaction self.transaction = transaction
class Initiator(PureSimulable): class Initiator(PureSimulable):
def __init__(self, port, generator): def __init__(self, generator, port):
self.port = port
self.generator = generator self.generator = generator
self.port = port
self.done = False self.done = False
self._exe = None self._exe = None
def _execute(self, s, port, generator): def _execute(self, s, generator, port):
while True: while True:
transaction = next(generator) transaction = next(generator)
transaction_start = s.cycle_counter transaction_start = s.cycle_counter
@ -260,7 +260,7 @@ class Initiator(PureSimulable):
def do_simulation(self, s): def do_simulation(self, s):
if not self.done: if not self.done:
if self._exe is None: if self._exe is None:
self._exe = self._execute(s, self.port, self.generator) self._exe = self._execute(s, self.generator, self.port)
try: try:
next(self._exe) next(self._exe)
except StopIteration: except StopIteration:
@ -288,9 +288,9 @@ class TargetModel:
return self.last_slot return self.last_slot
class Target(PureSimulable): class Target(PureSimulable):
def __init__(self, hub, model): def __init__(self, model, hub):
self.hub = hub
self.model = model self.model = model
self.hub = hub
self._calling_tag = -1 self._calling_tag = -1
self._write_request_d = -1 self._write_request_d = -1
self._write_request = -1 self._write_request = -1