From 5587dd94f0d21aebdc9b025979f09d3c2ed21c17 Mon Sep 17 00:00:00 2001 From: Onur Kayiran Date: Mon, 30 Apr 2018 17:56:27 -0400 Subject: [PATCH] mem-ruby: Generate address with masking cacheline bits MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit makeLineAddress function uses m_block_size_bits to create masked addresses. m_block_size_bits is used to specify cache, directory, and memory controller interleaving, and it can be larger than the cache line size. To generate addresses that can align with the cache line rather than the interleaving granularity, a version of makeLineAddress is created to specify bits that need to be masked. Change-Id: I06deec4949da7fa46f1d6f7575334f18ee61c786 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28135 Tested-by: kokoro Reviewed-by: Matt Sinclair Reviewed-by: Onur Kayıran Maintainer: Jason Lowe-Power --- src/mem/ruby/common/Address.cc | 6 ++++++ src/mem/ruby/common/Address.hh | 1 + 2 files changed, 7 insertions(+) diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc index 40ce0feb0..39de974a5 100644 --- a/src/mem/ruby/common/Address.cc +++ b/src/mem/ruby/common/Address.cc @@ -56,6 +56,12 @@ makeLineAddress(Addr addr) return mbits(addr, 63, RubySystem::getBlockSizeBits()); } +Addr +makeLineAddress(Addr addr, int cacheLineBits) +{ + return maskLowOrderBits(addr, cacheLineBits); +} + // returns the next stride address based on line address Addr makeNextStrideAddress(Addr addr, int stride) diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh index 30682fab0..e5e320f3b 100644 --- a/src/mem/ruby/common/Address.hh +++ b/src/mem/ruby/common/Address.hh @@ -40,6 +40,7 @@ Addr bitSelect(Addr addr, unsigned int small, unsigned int big); Addr maskLowOrderBits(Addr addr, unsigned int number); Addr getOffset(Addr addr); Addr makeLineAddress(Addr addr); +Addr makeLineAddress(Addr addr, int cacheLineBits); Addr makeNextStrideAddress(Addr addr, int stride); std::string printAddress(Addr addr); -- 2.30.2