From 4ce0f20436e49c0a9c363710f5e16fbbc6621a44 Mon Sep 17 00:00:00 2001 From: studyztp Date: Wed, 30 Oct 2024 18:26:45 -0700 Subject: [PATCH] cpu: make PcCountPair use 64 bit unsigned int for count In PcCountPair param, change the type for "count" from 32 bit int to 64 bit unsigned int. Change-Id: I2dc1bb2692914f06eaaae9bd5bbfb061bcbbfb8b --- src/cpu/probes/pc_count_pair.hh | 10 +++++----- src/cpu/probes/pc_count_tracker_manager.cc | 2 +- src/cpu/probes/pc_count_tracker_manager.hh | 2 +- src/python/pybind11/core.cc | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cpu/probes/pc_count_pair.hh b/src/cpu/probes/pc_count_pair.hh index fd6bc639fe..c58ecb6362 100644 --- a/src/cpu/probes/pc_count_pair.hh +++ b/src/cpu/probes/pc_count_pair.hh @@ -42,12 +42,12 @@ class PcCountPair /** The Program Counter address */ Addr pc; /** The count of the Program Counter address */ - int count; + uint64_t count; public: /** Explicit constructor assigning the pc and count values */ - explicit constexpr PcCountPair(Addr _pc, int _count) : + explicit constexpr PcCountPair(Addr _pc, uint64_t _count) : pc(_pc), count(_count) {} /** Default constructor for parameter classes */ @@ -56,7 +56,7 @@ class PcCountPair /** Returns the Program Counter address */ constexpr Addr getPC() const { return pc; } /** Returns the count of the Program */ - constexpr int getCount() const { return count; } + constexpr uint64_t getCount() const { return count; } /** Greater than comparison */ constexpr bool @@ -86,8 +86,8 @@ class PcCountPair { size_t operator()(const PcCountPair& item) const { - size_t xHash = std::hash()(item.pc); - size_t yHash = std::hash()(item.count); + size_t xHash = std::hash()(item.pc); + size_t yHash = std::hash()(item.count); return xHash * 2 + yHash; } }; diff --git a/src/cpu/probes/pc_count_tracker_manager.cc b/src/cpu/probes/pc_count_tracker_manager.cc index 88d7dda568..d55181f6be 100644 --- a/src/cpu/probes/pc_count_tracker_manager.cc +++ b/src/cpu/probes/pc_count_tracker_manager.cc @@ -57,7 +57,7 @@ PcCountTrackerManager::checkCount(Addr pc) { if(ifListNotEmpty) { - int count = ++counter.find(pc)->second; + uint64_t count = ++counter.find(pc)->second; // increment the counter of the encountered PC address by 1 currentPair = PcCountPair(pc,count); diff --git a/src/cpu/probes/pc_count_tracker_manager.hh b/src/cpu/probes/pc_count_tracker_manager.hh index 00742ff239..c70d6a47e4 100644 --- a/src/cpu/probes/pc_count_tracker_manager.hh +++ b/src/cpu/probes/pc_count_tracker_manager.hh @@ -54,7 +54,7 @@ class PcCountTrackerManager : public SimObject { /** a counter that stores all the target PC addresses and the number * of times the target PC has been executed */ - std::unordered_map counter; + std::unordered_map counter; /** a set that stores all the PC Count pairs that should raise an * exit event at diff --git a/src/python/pybind11/core.cc b/src/python/pybind11/core.cc index 98208701de..57e2d19964 100644 --- a/src/python/pybind11/core.cc +++ b/src/python/pybind11/core.cc @@ -170,12 +170,12 @@ init_pc(py::module_ &m_native) py::module_ m = m_native.def_submodule("pc"); py::class_(m, "PcCountPair") .def(py::init<>()) - .def(py::init()) + .def(py::init()) .def("__eq__", [](const PcCountPair& self, py::object other) { py::int_ pyPC = other.attr("get_pc")(); py::int_ pyCount = other.attr("get_count")(); uint64_t cPC = pyPC.cast(); - int cCount = pyCount.cast(); + uint64_t cCount = pyCount.cast(); return (self.getPC() == cPC && self.getCount() == cCount); }) .def("__hash__", [](const PcCountPair& self){