mem-cache: Fix FIFO replacement
Change FIFO from using curTicks() to using timeTicks counter to avoid issues where multiple lines are considered to have entered the cache at the same tick. Change-Id: I5e0b894eb9bec4f0f8bc8f48ec2766a0fc5079c6 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65952 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com> Maintainer: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
@@ -36,11 +36,9 @@
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
|
||||
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
|
||||
namespace replacement_policy
|
||||
{
|
||||
|
||||
FIFO::FIFO(const Params &p)
|
||||
: Base(p)
|
||||
{
|
||||
@@ -51,7 +49,7 @@ FIFO::invalidate(const std::shared_ptr<ReplacementData>& replacement_data)
|
||||
{
|
||||
// Reset insertion tick
|
||||
std::static_pointer_cast<FIFOReplData>(
|
||||
replacement_data)->tickInserted = Tick(0);
|
||||
replacement_data)->tickInserted = ++timeTicks;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -65,7 +63,7 @@ FIFO::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
|
||||
{
|
||||
// Set insertion tick
|
||||
std::static_pointer_cast<FIFOReplData>(
|
||||
replacement_data)->tickInserted = curTick();
|
||||
replacement_data)->tickInserted = ++timeTicks;
|
||||
}
|
||||
|
||||
ReplaceableEntry*
|
||||
|
||||
@@ -56,13 +56,19 @@ class FIFO : public Base
|
||||
{
|
||||
/** Tick on which the entry was inserted. */
|
||||
Tick tickInserted;
|
||||
|
||||
/**
|
||||
* Default constructor. Invalidate data.
|
||||
*/
|
||||
FIFOReplData() : tickInserted(0) {}
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* A counter that tracks the number of
|
||||
* ticks since being created to avoid a tie
|
||||
*/
|
||||
mutable Tick timeTicks;
|
||||
|
||||
public:
|
||||
typedef FIFORPParams Params;
|
||||
FIFO(const Params &p);
|
||||
|
||||
Reference in New Issue
Block a user