Comments (3)
Hi @alwilson, appreciate the heads-up on this. I've created a PR on the Boolector project to support for 3.11 and 3.12. You can find that here:
Boolector/boolector#211
from pyvsc.
Also, there are some minor unit test regressions due to 3.11. Coverpoint bin names use str() to get the enum name, but it looks like that now returns the enum value instead. Also, some uses of random.sample() hit a type error now that wants the population arg to be a sequence. Here's some quick fixes I made, not sure if it works for 3.10 though and not sure about the enum workaround since it doesn't return the enum instance name as well.
diff --git a/src/vsc/coverage.py b/src/vsc/coverage.py
index 2567db6..55ae833 100644
--- a/src/vsc/coverage.py
+++ b/src/vsc/coverage.py
@@ -820,7 +820,7 @@ class coverpoint(object):
for v in enum_bins.range_l:
e = ei.v2e_m[v[0]]
- self.model.add_bin_model(CoverpointBinEnumModel(str(e), v[0]))
+ self.model.add_bin_model(CoverpointBinEnumModel(e.name, v[0]))
elif isinstance(self.cp_t, type_base):
binspec = RangelistModel()
diff --git a/src/vsc/model/coverpoint_cross_model.py b/src/vsc/model/coverpoint_cross_model.py
index ff387b9..3776aef 100644
--- a/src/vsc/model/coverpoint_cross_model.py
+++ b/src/vsc/model/coverpoint_cross_model.py
@@ -93,7 +93,7 @@ class CoverpointCrossModel(CoverItemBase):
def select_unhit_bin(self, r:RandIF)->int:
if len(self.unhit_s) > 0:
- return random.sample(self.unhit_s, 1)[0]
+ return random.sample(sorted(self.unhit_s), 1)[0]
else:
return -1
diff --git a/src/vsc/model/rand_info_builder.py b/src/vsc/model/rand_info_builder.py
index b661b4f..5b16be7 100644
--- a/src/vsc/model/rand_info_builder.py
+++ b/src/vsc/model/rand_info_builder.py
@@ -159,7 +159,7 @@ class RandInfoBuilder(ModelVisitor,RandIF):
return self._rng.randint(low,high)
def sample(self, s, k):
- return self._rng.sample(s, k)
+ return self._rng.sample(sorted(s), k)
def visit_constraint_block(self, c):
if RandInfoBuilder.EN_DEBUG:
diff --git a/ve/unit/test_coverage_driven_constraints.py b/ve/unit/test_coverage_driven_constraints.py
index 7921623..a22701d 100644
--- a/ve/unit/test_coverage_driven_constraints.py
+++ b/ve/unit/test_coverage_driven_constraints.py
@@ -24,7 +24,7 @@ class TestCoverageDrivenConstraints(VscTestCase):
return low
def sample(self, s, k):
- return random.sample(s, k)
+ return random.sample(sorted(s), k)
@vsc.randobj
diff --git a/ve/unit/test_coverage_enum.py b/ve/unit/test_coverage_enum.py
index abf911a..6f97f99 100644
--- a/ve/unit/test_coverage_enum.py
+++ b/ve/unit/test_coverage_enum.py
@@ -31,8 +31,8 @@ class TestCoverageEnum(VscTestCase):
v = my_e.B
cg.sample()
- self.assertEqual(cg.cp.get_model().get_bin_name(0), "my_e.A")
- self.assertEqual(cg.cp.get_model().get_bin_name(1), "my_e.B")
+ self.assertEqual(cg.cp.get_model().get_bin_name(0), "A")
+ self.assertEqual(cg.cp.get_model().get_bin_name(1), "B")
# def test_bin_names_enum(self):
#
@@ -81,10 +81,10 @@ class TestCoverageEnum(VscTestCase):
v = my_e.D
cg.sample()
- self.assertEqual(cg.cp.get_model().get_bin_name(0), "my_e.A")
- self.assertEqual(cg.cp.get_model().get_bin_name(1), "my_e.B")
- self.assertEqual(cg.cp.get_model().get_bin_name(2), "my_e.C")
- self.assertEqual(cg.cp.get_model().get_bin_name(3), "my_e.D")
+ self.assertEqual(cg.cp.get_model().get_bin_name(0), "A")
+ self.assertEqual(cg.cp.get_model().get_bin_name(1), "B")
+ self.assertEqual(cg.cp.get_model().get_bin_name(2), "C")
+ self.assertEqual(cg.cp.get_model().get_bin_name(3), "D")
self.assertEqual(cg.cp.get_coverage(), 100)
from pyvsc.
That PR went through and pyboolector installs fine now. Sounds like they'll be fixing up some other version issues in the next release. Thanks @mballance!
from pyvsc.
Related Issues (20)
- Selecting a list element from a list of bit-vectors returns an int HOT 3
- Setting constraint_mode to False retains the previous range/bounds of the constraint HOT 1
- Cannot make constraint under if_then soft HOT 13
- Cannot use random value as list index in a constraint HOT 2
- PicklingError when trying to pickle a VSC randobj HOT 2
- What is the relation between pyvsc and portable stimulus (pss)? HOT 2
- how to print coverage model HOT 3
- pyvsc performance dominated by stack frame operations in inspect module HOT 1
- import error _boolector_add
- Enh: Support Default bin (How to write "default" in vsc.coverpoint ?)
- install error for latest version macos HOT 3
- support for function incur in constraint functions HOT 5
- constraint solver error HOT 1
- Distributions have higher priority than soft constraints HOT 1
- I can't install pyvsc for pypy3.10! HOT 4
- not_inside constraint unexpectedly reducing output set significantly HOT 1
- Is there an example of pyvsc integrated with cocotb and SV RTL with a simulator? HOT 2
- Solve order of randsz_list_t size constraints within foreach incorrect [v0.8.8] HOT 5
- randsz_list_t: Placing the sum constraint before the size constraints can result in incorrect sums [v0.8.8]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyvsc.