From efc73cddc483d5afedfa0b0c92cee207d62c5c1d Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Sat, 7 Sep 2019 12:08:40 +0200 Subject: [PATCH] mem-ruby: Make bitSelect use bits There is no need to replicate bits' functionality. As a side effect, ADDRESS_WIDTH is no longer used and was removed Change-Id: Ia5679f3976c81f779665d82cb758850092f2a293 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21085 Reviewed-by: Nikos Nikoleris Reviewed-by: Jason Lowe-Power Reviewed-by: Anthony Gutierrez Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/common/Address.cc | 10 +--------- src/mem/ruby/common/Address.hh | 2 -- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc index 5c89d31cc..40ce0feb0 100644 --- a/src/mem/ruby/common/Address.cc +++ b/src/mem/ruby/common/Address.cc @@ -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, big, small); } Addr diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh index 31f52e540..30682fab0 100644 --- a/src/mem/ruby/common/Address.hh +++ b/src/mem/ruby/common/Address.hh @@ -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); -- 2.30.2