mem-ruby: Make bitSelect use bits<Addr>
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Sat, 7 Sep 2019 10:08:40 +0000 (12:08 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Mon, 30 Sep 2019 20:58:46 +0000 (20:58 +0000)
There is no need to replicate bits<Addr>' functionality.

As a side effect, ADDRESS_WIDTH is no longer used and was removed

Change-Id: Ia5679f3976c81f779665d82cb758850092f2a293
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21085
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/ruby/common/Address.cc
src/mem/ruby/common/Address.hh

index 5c89d31ccb5a1cb1bb46b154a2e1aba408e2f384..40ce0feb077e18abce841092af4245b398d2720b 100644 (file)
@@ -35,15 +35,7 @@ Addr
 bitSelect(Addr addr, unsigned int small, unsigned int big)
 {
     assert(big >= small);
-
-    if (big >= ADDRESS_WIDTH - 1) {
-        return (addr >> small);
-    } else {
-        Addr mask = ~((Addr)~0 << (big + 1));
-        // FIXME - this is slow to manipulate a 64-bit number using 32-bits
-        Addr partial = (addr & mask);
-        return (partial >> small);
-    }
+    return bits<Addr>(addr, big, small);
 }
 
 Addr
index 31f52e540de11b616a2d03da81834b51d9a82f93..30682fab0c51b28821cbde4f93b82ab4efb7f6d0 100644 (file)
@@ -35,8 +35,6 @@
 
 #include "base/types.hh"
 
-const uint32_t ADDRESS_WIDTH = 64; // address width in bytes
-
 // selects bits inclusive
 Addr bitSelect(Addr addr, unsigned int small, unsigned int big);
 Addr maskLowOrderBits(Addr addr, unsigned int number);