Giter VIP home page Giter VIP logo

Comments (3)

mballance avatar mballance commented on June 21, 2024 1

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.

alwilson avatar alwilson commented on June 21, 2024

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.

alwilson avatar alwilson commented on June 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.