PersistentTable.hh revision 6797
1955SN/A 2955SN/A/* 37816Ssteve.reinhardt@amd.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 45871Snate@binkert.org * All rights reserved. 51762SN/A * 6955SN/A * Redistribution and use in source and binary forms, with or without 7955SN/A * modification, are permitted provided that the following conditions are 8955SN/A * met: redistributions of source code must retain the above copyright 9955SN/A * notice, this list of conditions and the following disclaimer; 10955SN/A * redistributions in binary form must reproduce the above copyright 11955SN/A * notice, this list of conditions and the following disclaimer in the 12955SN/A * documentation and/or other materials provided with the distribution; 13955SN/A * neither the name of the copyright holders nor the names of its 14955SN/A * contributors may be used to endorse or promote products derived from 15955SN/A * this software without specific prior written permission. 16955SN/A * 17955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28955SN/A */ 29955SN/A 302665Ssaidi@eecs.umich.edu#ifndef PersistentTable_H 312665Ssaidi@eecs.umich.edu#define PersistentTable_H 325863Snate@binkert.org 33955SN/A#include "mem/ruby/common/Global.hh" 34955SN/A#include "mem/gems_common/Map.hh" 35955SN/A#include "mem/ruby/common/Address.hh" 36955SN/A#include "mem/ruby/system/MachineID.hh" 37955SN/A#include "mem/protocol/AccessType.hh" 388878Ssteve.reinhardt@amd.com#include "mem/ruby/common/NetDest.hh" 392632Sstever@eecs.umich.edu 408878Ssteve.reinhardt@amd.comclass PersistentTableEntry { 412632Sstever@eecs.umich.edupublic: 42955SN/A void print(ostream& out) const {} 438878Ssteve.reinhardt@amd.com 442632Sstever@eecs.umich.edu NetDest m_starving; 452761Sstever@eecs.umich.edu NetDest m_marked; 462632Sstever@eecs.umich.edu NetDest m_request_to_write; 472632Sstever@eecs.umich.edu}; 482632Sstever@eecs.umich.edu 492761Sstever@eecs.umich.educlass PersistentTable { 502761Sstever@eecs.umich.edupublic: 512761Sstever@eecs.umich.edu // Constructors 528878Ssteve.reinhardt@amd.com PersistentTable(); 538878Ssteve.reinhardt@amd.com 542761Sstever@eecs.umich.edu // Destructor 552761Sstever@eecs.umich.edu ~PersistentTable(); 562761Sstever@eecs.umich.edu 572761Sstever@eecs.umich.edu // Public Methods 582761Sstever@eecs.umich.edu void persistentRequestLock(const Address& address, MachineID locker, AccessType type); 598878Ssteve.reinhardt@amd.com void persistentRequestUnlock(const Address& address, MachineID unlocker); 608878Ssteve.reinhardt@amd.com bool okToIssueStarving(const Address& address, MachineID machID) const; 612632Sstever@eecs.umich.edu MachineID findSmallest(const Address& address) const; 622632Sstever@eecs.umich.edu AccessType typeOfSmallest(const Address& address) const; 638878Ssteve.reinhardt@amd.com void markEntries(const Address& address); 648878Ssteve.reinhardt@amd.com bool isLocked(const Address& addr) const; 652632Sstever@eecs.umich.edu int countStarvingForAddress(const Address& addr) const; 66955SN/A int countReadStarvingForAddress(const Address& addr) const; 67955SN/A 68955SN/A static void printConfig(ostream& out) {} 695863Snate@binkert.org 705863Snate@binkert.org void print(ostream& out) const; 715863Snate@binkert.orgprivate: 725863Snate@binkert.org // Private Methods 735863Snate@binkert.org 745863Snate@binkert.org // Private copy constructor and assignment operator 755863Snate@binkert.org PersistentTable(const PersistentTable& obj); 765863Snate@binkert.org PersistentTable& operator=(const PersistentTable& obj); 775863Snate@binkert.org 785863Snate@binkert.org // Data Members (m_prefix) 795863Snate@binkert.org Map<Address, PersistentTableEntry>* m_map_ptr; 808878Ssteve.reinhardt@amd.com}; 815863Snate@binkert.org 825863Snate@binkert.org// ******************* Definitions ******************* 835863Snate@binkert.org 845863Snate@binkert.org// Output operator definition 855863Snate@binkert.orgextern inline 865863Snate@binkert.orgostream& operator<<(ostream& out, const PersistentTable& obj) 875863Snate@binkert.org{ 885863Snate@binkert.org obj.print(out); 895863Snate@binkert.org out << flush; 905863Snate@binkert.org return out; 915863Snate@binkert.org} 925863Snate@binkert.org 935863Snate@binkert.org// Output operator definition 945863Snate@binkert.orgextern inline 955863Snate@binkert.orgostream& operator<<(ostream& out, const PersistentTableEntry& obj) 968878Ssteve.reinhardt@amd.com{ 975863Snate@binkert.org obj.print(out); 985863Snate@binkert.org out << flush; 995863Snate@binkert.org return out; 1006654Snate@binkert.org} 101955SN/A 1025396Ssaidi@eecs.umich.edu#endif //PersistentTable_H 1035863Snate@binkert.org