Giacomo Travaglini has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/48904 )

Change subject: python: Expose the AddrRange exclude to the python world
......................................................................

python: Expose the AddrRange exclude to the python world

Change-Id: I9cb1bf66d4e9390c8d3c4403afec9f896d19c162
Signed-off-by: Giacomo Travaglini <[email protected]>
---
M src/python/m5/params.py
M src/python/pybind11/core.cc
2 files changed, 12 insertions(+), 0 deletions(-)



diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 67bba65..79c1bcb 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -864,6 +864,17 @@
         return AddrRange(int(self.start), int(self.end),
                          self.masks, int(self.intlvMatch))

+    def exclude(self, ranges):
+        from _m5.range import AddrRangeVector
+
+        # The wrapped C++ class is assuming an AddrRangeVector
+        # We are therefore converting to it before excluding ranges
+        # and reconverting it into a list of AddrRange before returning
+        pybind_exclude = AddrRangeVector([ r.getValue() for r in ranges ])
+        pybind_include = self.getValue().exclude(pybind_ranges)
+
+        return [ AddrRange(r.start(), r.end()) for r in pybind_include ]
+
 # Boolean parameter type.  Python doesn't let you subclass bool, since
 # it doesn't want to let you create multiple instances of True and
 # False.  Thus this is a little more complicated than String.
diff --git a/src/python/pybind11/core.cc b/src/python/pybind11/core.cc
index 0e9c311..257ae23 100644
--- a/src/python/pybind11/core.cc
+++ b/src/python/pybind11/core.cc
@@ -167,6 +167,7 @@
         .def("mergesWith", &AddrRange::mergesWith)
         .def("intersects", &AddrRange::intersects)
         .def("isSubset", &AddrRange::isSubset)
+        .def("exclude", &AddrRange::exclude)
         ;

     // We need to make vectors of AddrRange opaque to avoid weird

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48904
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I9cb1bf66d4e9390c8d3c4403afec9f896d19c162
Gerrit-Change-Number: 48904
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to