PersistentTable.hh revision 11025
12068SN/A/* 22068SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 32188SN/A * All rights reserved. 42068SN/A * 52068SN/A * Redistribution and use in source and binary forms, with or without 62068SN/A * modification, are permitted provided that the following conditions are 72068SN/A * met: redistributions of source code must retain the above copyright 82068SN/A * notice, this list of conditions and the following disclaimer; 92068SN/A * redistributions in binary form must reproduce the above copyright 102068SN/A * notice, this list of conditions and the following disclaimer in the 112068SN/A * documentation and/or other materials provided with the distribution; 122068SN/A * neither the name of the copyright holders nor the names of its 132068SN/A * contributors may be used to endorse or promote products derived from 142068SN/A * this software without specific prior written permission. 152068SN/A * 162068SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172068SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182068SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192068SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202068SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212068SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222068SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232068SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242068SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252068SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262068SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272068SN/A */ 282665Ssaidi@eecs.umich.edu 292665Ssaidi@eecs.umich.edu#ifndef __MEM_RUBY_STRUCTURES_PERSISTENTTABLE_HH__ 302068SN/A#define __MEM_RUBY_STRUCTURES_PERSISTENTTABLE_HH__ 312649Ssaidi@eecs.umich.edu 322649Ssaidi@eecs.umich.edu#include <iostream> 332649Ssaidi@eecs.umich.edu 342649Ssaidi@eecs.umich.edu#include "base/hashmap.hh" 352649Ssaidi@eecs.umich.edu#include "mem/protocol/AccessType.hh" 362068SN/A#include "mem/ruby/common/Address.hh" 372068SN/A#include "mem/ruby/common/MachineID.hh" 382068SN/A#include "mem/ruby/common/NetDest.hh" 392068SN/A 402068SN/Aclass PersistentTableEntry 412068SN/A{ 422068SN/A public: 432068SN/A PersistentTableEntry() {} 442075SN/A void print(std::ostream& out) const {} 452075SN/A 462075SN/A NetDest m_starving; 472075SN/A NetDest m_marked; 482075SN/A NetDest m_request_to_write; 492075SN/A}; 502069SN/A 512069SN/Aclass PersistentTable 522075SN/A{ 532068SN/A public: 542068SN/A // Constructors 552068SN/A PersistentTable(); 562075SN/A 572075SN/A // Destructor 582068SN/A ~PersistentTable(); 592068SN/A 602075SN/A // Public Methods 612075SN/A void persistentRequestLock(Addr address, MachineID locker, 622068SN/A AccessType type); 632068SN/A void persistentRequestUnlock(Addr address, MachineID unlocker); 642068SN/A bool okToIssueStarving(Addr address, MachineID machID) const; 652075SN/A MachineID findSmallest(Addr address) const; 662075SN/A AccessType typeOfSmallest(Addr address) const; 672075SN/A void markEntries(Addr address); 682075SN/A bool isLocked(Addr addr) const; 692075SN/A int countStarvingForAddress(Addr addr) const; 702075SN/A int countReadStarvingForAddress(Addr addr) const; 712075SN/A 722069SN/A void print(std::ostream& out) const; 732069SN/A 742075SN/A private: 752068SN/A // Private copy constructor and assignment operator 762068SN/A PersistentTable(const PersistentTable& obj); 772068SN/A PersistentTable& operator=(const PersistentTable& obj); 782075SN/A 792068SN/A // Data Members (m_prefix) 802069SN/A typedef m5::hash_map<Addr, PersistentTableEntry> AddressMap; 812068SN/A AddressMap m_map; 822068SN/A}; 832336SN/A 842075SN/Ainline std::ostream& 852068SN/Aoperator<<(std::ostream& out, const PersistentTable& obj) 862069SN/A{ 872068SN/A obj.print(out); 882068SN/A out << std::flush; 892068SN/A return out; 902068SN/A} 912068SN/A 922068SN/Ainline std::ostream& 932068SN/Aoperator<<(std::ostream& out, const PersistentTableEntry& obj) 942068SN/A{ 952336SN/A obj.print(out); 962068SN/A out << std::flush; 972068SN/A return out; 982068SN/A} 992068SN/A 1002068SN/A#endif // __MEM_RUBY_STRUCTURES_PERSISTENTTABLE_HH__ 1012068SN/A