Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with upcoming cocotb 2.0 #84

Merged
merged 7 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unneeded uses of setimmediatevalue()
Up until
cocotb/cocotb@bfd811b
setimmediatevalue() did not actually work as expected. Using regular
value assignment preserves the old behavior.
  • Loading branch information
p12tic committed Sep 25, 2024
commit e0d6009bcf2215d9432e4856fe4e95459d3f3f68
22 changes: 11 additions & 11 deletions src/cocotb_bus/drivers/amba.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def __init__(self, entity: SimHandleBase, name: str, clock: SimHandleBase,
**kwargs: Any):
BusDriver.__init__(self, entity, name, clock, **kwargs)

# Drive some sensible defaults (setimmediatevalue to avoid x asserts)
self.bus.AWVALID.setimmediatevalue(0)
self.bus.WVALID.setimmediatevalue(0)
self.bus.ARVALID.setimmediatevalue(0)
self.bus.BREADY.setimmediatevalue(1)
self.bus.RREADY.setimmediatevalue(1)
# Drive some sensible defaults
self.bus.AWVALID.value = 0
self.bus.WVALID.value = 0
self.bus.ARVALID.value = 0
self.bus.BREADY.value = 1
self.bus.RREADY.value = 1

# Set the default value (0) for the unsupported signals, which
# translate to:
Expand All @@ -91,7 +91,7 @@ def __init__(self, entity: SimHandleBase, name: str, clock: SimHandleBase,
"ARID", "ARREGION", "ARLOCK", "ARCACHE", "ARPROT", "ARQOS"]
for signal in unsupported_signals:
try:
getattr(self.bus, signal).setimmediatevalue(0)
getattr(self.bus, signal).value = 0
except AttributeError:
pass

Expand Down Expand Up @@ -596,10 +596,10 @@ def __init__(self, entity, name, clock, memory, callback=None, event=None,
self.clock = clock

self.big_endian = big_endian
self.bus.ARREADY.setimmediatevalue(1)
self.bus.RVALID.setimmediatevalue(0)
self.bus.RLAST.setimmediatevalue(0)
self.bus.AWREADY.setimmediatevalue(1)
self.bus.ARREADY.value = 1
self.bus.RVALID.value = 0
self.bus.RLAST.value = 0
self.bus.AWREADY.value = 1
self._memory = memory

self.write_address_busy = Lock("%s_wabusy" % name)
Expand Down
20 changes: 10 additions & 10 deletions src/cocotb_bus/drivers/avalon.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ def __init__(self, entity, name, clock, **kwargs):
self._can_read = False
self._can_write = False

# Drive some sensible defaults (setimmediatevalue to avoid x asserts)
# Drive some sensible defaults
if hasattr(self.bus, "read"):
self.bus.read.setimmediatevalue(0)
self.bus.read.value = 0
self._can_read = True

if hasattr(self.bus, "write"):
self.bus.write.setimmediatevalue(0)
self.bus.write.value = 0
self.bus.writedata.value = create_binary_from_other(self.bus.writedata.value,
"x" * len(self.bus.writedata))
self._can_write = True

if hasattr(self.bus, "byteenable"):
self.bus.byteenable.setimmediatevalue(0)
self.bus.byteenable.value = 0

if hasattr(self.bus, "cs"):
self.bus.cs.setimmediatevalue(0)
self.bus.cs.value = 0

self.bus.address.setimmediatevalue(create_binary_from_other(self.bus.address.value,
"x" * len(self.bus.address)))
self.bus.address.value = create_binary_from_other(self.bus.address.value,
"x" * len(self.bus.address))

def read(self, address):
pass
Expand Down Expand Up @@ -260,10 +260,10 @@ def __init__(self, entity, name, clock, readlatency_min=1,
self._coro = cocotb.start_soon(self._respond())

if hasattr(self.bus, "readdatavalid"):
self.bus.readdatavalid.setimmediatevalue(0)
self.bus.readdatavalid.value = 0

if hasattr(self.bus, "waitrequest"):
self.bus.waitrequest.setimmediatevalue(0)
self.bus.waitrequest.value = 0

if hasattr(self.bus, "burstcount"):
if hasattr(self.bus, "readdatavalid"):
Expand All @@ -275,7 +275,7 @@ def __init__(self, entity, name, clock, readlatency_min=1,
self.bus.waitrequest.value = 0

if hasattr(self.bus, "readdatavalid"):
self.bus.readdatavalid.setimmediatevalue(0)
self.bus.readdatavalid.value = 0

def _pad(self):
"""Pad response queue up to read latency."""
Expand Down
2 changes: 1 addition & 1 deletion src/cocotb_bus/drivers/opb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OPBMaster(BusDriver):

def __init__(self, entity, name, clock, **kwargs):
BusDriver.__init__(self, entity, name, clock, **kwargs)
self.bus.select.setimmediatevalue(0)
self.bus.select.value = 0
self.log.debug("OPBMaster created")

@coroutine
Expand Down