TimerTable.hh revision 6154
12623SN/A 22623SN/A/* 32623SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 42623SN/A * All rights reserved. 52623SN/A * 62623SN/A * Redistribution and use in source and binary forms, with or without 72623SN/A * modification, are permitted provided that the following conditions are 82623SN/A * met: redistributions of source code must retain the above copyright 92623SN/A * notice, this list of conditions and the following disclaimer; 102623SN/A * redistributions in binary form must reproduce the above copyright 112623SN/A * notice, this list of conditions and the following disclaimer in the 122623SN/A * documentation and/or other materials provided with the distribution; 132623SN/A * neither the name of the copyright holders nor the names of its 142623SN/A * contributors may be used to endorse or promote products derived from 152623SN/A * this software without specific prior written permission. 162623SN/A * 172623SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192623SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202623SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232623SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242623SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262623SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272665Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu */ 292623SN/A 302623SN/A/* 313170Sstever@eecs.umich.edu * TimerTable.h 323806Ssaidi@eecs.umich.edu * 332623SN/A * Description: 344040Ssaidi@eecs.umich.edu * 352623SN/A * $Id$ 362623SN/A * 373348Sbinkertn@umich.edu */ 383348Sbinkertn@umich.edu 394762Snate@binkert.org#ifndef TIMERTABLE_H 402901Ssaidi@eecs.umich.edu#define TIMERTABLE_H 412623SN/A 422623SN/A#include "mem/ruby/common/Global.hh" 432623SN/A#include "mem/gems_common/Map.hh" 442623SN/A#include "mem/ruby/common/Address.hh" 452623SN/Aclass Consumer; 462623SN/Aclass Chip; 472623SN/A 482623SN/Aclass TimerTable { 492623SN/Apublic: 502623SN/A 512623SN/A // Constructors 522623SN/A TimerTable(Chip* chip_ptr); 532623SN/A 542623SN/A // Destructor 552623SN/A //~TimerTable(); 562623SN/A 572623SN/A // Class Methods 582623SN/A static void printConfig(ostream& out) {} 592623SN/A 604873Sstever@eecs.umich.edu // Public Methods 612623SN/A void setConsumer(Consumer* consumer_ptr) { ASSERT(m_consumer_ptr==NULL); m_consumer_ptr = consumer_ptr; } 622623SN/A void setDescription(const string& name) { m_name = name; } 632856Srdreslin@umich.edu 642856Srdreslin@umich.edu bool isReady() const; 652856Srdreslin@umich.edu const Address& readyAddress() const; 662856Srdreslin@umich.edu bool isSet(const Address& address) const { return m_map.exist(address); } 672856Srdreslin@umich.edu void set(const Address& address, Time relative_latency); 682856Srdreslin@umich.edu void unset(const Address& address); 692856Srdreslin@umich.edu void print(ostream& out) const; 704968Sacolyte@umich.eduprivate: 714968Sacolyte@umich.edu // Private Methods 724968Sacolyte@umich.edu void updateNext() const; 734968Sacolyte@umich.edu 742856Srdreslin@umich.edu // Private copy constructor and assignment operator 752856Srdreslin@umich.edu TimerTable(const TimerTable& obj); 762856Srdreslin@umich.edu TimerTable& operator=(const TimerTable& obj); 772623SN/A 782623SN/A // Data Members (m_prefix) 792623SN/A Map<Address, Time> m_map; 802623SN/A Chip* m_chip_ptr; 812623SN/A mutable bool m_next_valid; 822623SN/A mutable Time m_next_time; // Only valid if m_next_valid is true 832680Sktlim@umich.edu mutable Address m_next_address; // Only valid if m_next_valid is true 842680Sktlim@umich.edu Consumer* m_consumer_ptr; // Consumer to signal a wakeup() 852623SN/A string m_name; 862623SN/A}; 872680Sktlim@umich.edu 882623SN/A// ******************* Definitions ******************* 892623SN/A 904968Sacolyte@umich.edu// Output operator definition 914968Sacolyte@umich.eduextern inline 924968Sacolyte@umich.eduostream& operator<<(ostream& out, const TimerTable& obj) 934968Sacolyte@umich.edu{ 944968Sacolyte@umich.edu obj.print(out); 954968Sacolyte@umich.edu out << flush; 962623SN/A return out; 972623SN/A} 982623SN/A#endif //TIMERTABLE_H 993349Sbinkertn@umich.edu