base: Add XOR and modulo operator to ChannelAddr
authorDavid Schall <david.schall2@arm.com>
Thu, 18 Jun 2020 15:14:44 +0000 (16:14 +0100)
committerCiro Santilli <ciro.santilli@arm.com>
Tue, 9 Feb 2021 12:39:28 +0000 (12:39 +0000)
Channel address class did not offer bitwise
XOR and modulo operation. These two functions
where now added to the ChannelAddr class.

Change-Id: I02a5e49e9700cc5283415c921a25989a130e5d07
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39235
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/base/channel_addr.hh

index 2cfe38027ee9ca6a5ce4efde7fdea581db6434e1..55d227beede875cce6e36c8b840d5b3158f4a885 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 ARM Limited
+ * Copyright (c) 2019, 2021 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -93,6 +93,14 @@ class ChannelAddr
         return ChannelAddr(a << b);
     }
 
+    constexpr ChannelAddr operator^(const int b) const {
+        return ChannelAddr(a ^ b);
+    }
+
+    constexpr ChannelAddr operator%(const int b) const {
+        return ChannelAddr(a % b);
+    }
+
     constexpr ChannelAddr operator*(const Type &b) const {
         return ChannelAddr(a * b);
     }