mem-ruby: Fix type casting in makeNextStrideAddress

The RubyPrefetcher uses makeNextStrideAddress() with
a negative stride to find prefetched address.
The type of this expression is:
uint64_t + uint32_t * int;
This gives wrong result due to implicit conversion.
Fix this with static cast and it works correctly:
uint64_t + int * int;

Change-Id: I36e17e00d5c66c3699fe1d5b287971225a162d04
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31314
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
seanzw
2020-07-14 15:51:59 -07:00
committed by ZHENGRONG WANG
parent 3ce7333a36
commit 75257c7a42

View File

@@ -66,7 +66,8 @@ makeLineAddress(Addr addr, int cacheLineBits)
Addr
makeNextStrideAddress(Addr addr, int stride)
{
return makeLineAddress(addr) + RubySystem::getBlockSizeBytes() * stride;
return makeLineAddress(addr) +
static_cast<int>(RubySystem::getBlockSizeBytes()) * stride;
}
std::string