AbstractReplacementPolicy.hh revision 10970
17008SN/A/* 27008SN/A * Copyright (c) 2007 Mark D. Hill and David A. Wood 37008SN/A * All rights reserved. 47008SN/A * 57008SN/A * Redistribution and use in source and binary forms, with or without 67008SN/A * modification, are permitted provided that the following conditions are 77008SN/A * met: redistributions of source code must retain the above copyright 87008SN/A * notice, this list of conditions and the following disclaimer; 97008SN/A * redistributions in binary form must reproduce the above copyright 107008SN/A * notice, this list of conditions and the following disclaimer in the 117008SN/A * documentation and/or other materials provided with the distribution; 127008SN/A * neither the name of the copyright holders nor the names of its 137008SN/A * contributors may be used to endorse or promote products derived from 147008SN/A * this software without specific prior written permission. 157008SN/A * 167008SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177008SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187008SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197008SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207008SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217008SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227008SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237008SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247008SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 257008SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 267008SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 277008SN/A */ 286145SN/A 2910441Snilay@cs.wisc.edu#ifndef __MEM_RUBY_STRUCTURES_ABSTRACTREPLACEMENTPOLICY_HH__ 3010441Snilay@cs.wisc.edu#define __MEM_RUBY_STRUCTURES_ABSTRACTREPLACEMENTPOLICY_HH__ 316145SN/A 329505SN/A#include "base/types.hh" 3310970Sdavid.hashe@amd.com#include "mem/ruby/common/TypeDefines.hh" 3410970Sdavid.hashe@amd.com#include "params/ReplacementPolicy.hh" 3510970Sdavid.hashe@amd.com#include "sim/sim_object.hh" 366145SN/A 3710970Sdavid.hashe@amd.comclass AbstractReplacementPolicy : public SimObject 387039SN/A{ 397039SN/A public: 4010970Sdavid.hashe@amd.com typedef ReplacementPolicyParams Params; 4110970Sdavid.hashe@amd.com AbstractReplacementPolicy(const Params * p); 427039SN/A virtual ~AbstractReplacementPolicy(); 436145SN/A 447039SN/A /* touch a block. a.k.a. update timestamp */ 4510314Snilay@cs.wisc.edu virtual void touch(int64 set, int64 way, Tick time) = 0; 466145SN/A 477039SN/A /* returns the way to replace */ 4810314Snilay@cs.wisc.edu virtual int64 getVictim(int64 set) const = 0; 496145SN/A 507039SN/A /* get the time of the last access */ 5110314Snilay@cs.wisc.edu Tick getLastAccess(int64 set, int64 way); 526145SN/A 5310970Sdavid.hashe@amd.com virtual bool useOccupancy() const { return false; } 5410970Sdavid.hashe@amd.com 557039SN/A protected: 567039SN/A unsigned m_num_sets; /** total number of sets */ 577039SN/A unsigned m_assoc; /** set associativity */ 589505SN/A Tick **m_last_ref_ptr; /** timestamp of last reference */ 596145SN/A}; 606145SN/A 6110441Snilay@cs.wisc.edu#endif // __MEM_RUBY_STRUCTURES_ABSTRACTREPLACEMENTPOLICY_HH__ 62