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

Add support for upcoming cocotb 2.0 #91

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

p12tic
Copy link

@p12tic p12tic commented Sep 6, 2024

This PR adds support for upcoming cocotb 2.0 release in a way that both cocotb 1.x and cocotb 2.x can be supported with minimal maintenance overhead.

Fixes #88.

In order to test with cocotb master, the following patch needs to be applied to pick newer dependencies:

diff --git a/setup.cfg b/setup.cfg
index 8fa9aa2..500b4b7 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -68,9 +68,9 @@ usedevelop = True
 deps =
     pytest == 7.2.1
     pytest-xdist == 3.1.0
-    cocotb == 1.7.2
-    cocotb-bus == 0.2.1
-    cocotb-test == 0.2.4
+    cocotb @git+https://github.com/cocotb/cocotb@828d127e8e865fc2ecf4979ea54767e1da80dd21
+    cocotb-bus @git+https://github.com/p12tic/[email protected]
+    cocotb-test @git+https://github.com/p12tic/[email protected]
     coverage == 7.0.5
     pytest-cov == 4.0.0

PRs to cocotb-bus and cocotb-test have been opened themperek/cocotb-test#263, cocotb/cocotb-bus#83, so sometime soon it will be possible to test by pinning to some commit in the master branches of these projects and sometime later a released version can be used.

On upcoming cocotb 2.0 cocotb.SIM_NAME may not exist at all. On cocotb
1.x it was set to None. Checking for existence of SIM_NAME supports both
cocotb 2.0 and 1.x.
binstr is read only property on upcoming cocotb 2.0
On upcoming cocotb 2.0 such conversion is deprecated and will eventually
always return True. The recommended replacement is to convert to string
and then compare.

On cocotb 1.9 explicit conversion to string is no longer necessary. Once
this is minimum version of cocotb supported by cocotbext-axi, the
explicit conversions can be dropped.
The .data field of cocotb.triggers.Event has been removed in cocotb 2.0.
This is a part of the API exposed by cocotbext-axi. It is probably best
to keep the current API until support for cocotb 1.x has been removed
from cocotbext-axi.

Accordingly, the simpliest solution for this problem is to detect cocotb
2.0 version and re-add the .data field when event.set is being called on
cocotb 2.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LogicArray in cocotb has been rewritten
1 participant