RubySystem.hh revision 6145
15790Sgblack@eecs.umich.edu 25790Sgblack@eecs.umich.edu/* 35790Sgblack@eecs.umich.edu * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 45790Sgblack@eecs.umich.edu * All rights reserved. 55790Sgblack@eecs.umich.edu * 65790Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 75790Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 85790Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 95790Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 105790Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 115790Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 125790Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 135790Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 145790Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 155790Sgblack@eecs.umich.edu * this software without specific prior written permission. 165790Sgblack@eecs.umich.edu * 175790Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185790Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195790Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 205790Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 215790Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 225790Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 235790Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 245790Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 255790Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 265790Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 275790Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 285790Sgblack@eecs.umich.edu */ 295790Sgblack@eecs.umich.edu 305790Sgblack@eecs.umich.edu/* 315790Sgblack@eecs.umich.edu * System.h 325790Sgblack@eecs.umich.edu * 3312157Sandreas.sandberg@arm.com * Description: Contains all of the various parts of the system we are 345790Sgblack@eecs.umich.edu * simulating. Performs allocation, deallocation, and setup of all 359898Sandreas@sandberg.pp.se * the major components of the system 369898Sandreas@sandberg.pp.se * 379898Sandreas@sandberg.pp.se * $Id$ 389898Sandreas@sandberg.pp.se * 399898Sandreas@sandberg.pp.se */ 409898Sandreas@sandberg.pp.se 419898Sandreas@sandberg.pp.se#ifndef SYSTEM_H 429898Sandreas@sandberg.pp.se#define SYSTEM_H 439898Sandreas@sandberg.pp.se 449898Sandreas@sandberg.pp.se#include "Global.hh" 459898Sandreas@sandberg.pp.se#include "Vector.hh" 469898Sandreas@sandberg.pp.se#include "Address.hh" 479898Sandreas@sandberg.pp.se#include "RubyConfig.hh" 489898Sandreas@sandberg.pp.se#include "MachineType.hh" 499898Sandreas@sandberg.pp.se#include "AbstractChip.hh" 509898Sandreas@sandberg.pp.se 519898Sandreas@sandberg.pp.seclass Profiler; 529898Sandreas@sandberg.pp.seclass Network; 535790Sgblack@eecs.umich.educlass Driver; 545790Sgblack@eecs.umich.educlass CacheRecorder; 555790Sgblack@eecs.umich.educlass Tracer; 565790Sgblack@eecs.umich.educlass Sequencer; 575790Sgblack@eecs.umich.educlass XactIsolationChecker; 585790Sgblack@eecs.umich.educlass XactCommitArbiter; 595790Sgblack@eecs.umich.educlass XactVisualizer; 605790Sgblack@eecs.umich.educlass TransactionInterfaceManager; 615790Sgblack@eecs.umich.edu 629898Sandreas@sandberg.pp.seclass System { 639898Sandreas@sandberg.pp.sepublic: 6412157Sandreas.sandberg@arm.com // Constructors 6512157Sandreas.sandberg@arm.com System(); 6612157Sandreas.sandberg@arm.com 6712157Sandreas.sandberg@arm.com // Destructor 6812157Sandreas.sandberg@arm.com ~System(); 6912157Sandreas.sandberg@arm.com 7012157Sandreas.sandberg@arm.com // Public Methods 7112157Sandreas.sandberg@arm.com int getNumProcessors() { return RubyConfig::numberOfProcessors(); } 7212157Sandreas.sandberg@arm.com int getNumMemories() { return RubyConfig::numberOfMemories(); } 7312157Sandreas.sandberg@arm.com Profiler* getProfiler() { return m_profiler_ptr; } 7412157Sandreas.sandberg@arm.com Driver* getDriver() { assert(m_driver_ptr != NULL); return m_driver_ptr; } 7512157Sandreas.sandberg@arm.com Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; } 7612157Sandreas.sandberg@arm.com Network* getNetwork() { assert(m_network_ptr != NULL); return m_network_ptr; } 7712157Sandreas.sandberg@arm.com XactIsolationChecker* getXactIsolationChecker() { assert(m_xact_isolation_checker!= NULL); return m_xact_isolation_checker;} 7812157Sandreas.sandberg@arm.com XactCommitArbiter* getXactCommitArbiter() { assert(m_xact_commit_arbiter!= NULL); return m_xact_commit_arbiter;} 7912157Sandreas.sandberg@arm.com XactVisualizer* getXactVisualizer() { assert(m_xact_visualizer!= NULL); return m_xact_visualizer;} 8012157Sandreas.sandberg@arm.com 8112157Sandreas.sandberg@arm.com AbstractChip* getChip(int chipNumber) const { assert(m_chip_vector[chipNumber] != NULL); return m_chip_vector[chipNumber];} 8212157Sandreas.sandberg@arm.com Sequencer* getSequencer(int procNumber) const { 8312157Sandreas.sandberg@arm.com assert(procNumber < RubyConfig::numberOfProcessors()); 8412157Sandreas.sandberg@arm.com return m_chip_vector[procNumber/RubyConfig::numberOfProcsPerChip()]->getSequencer(procNumber%RubyConfig::numberOfProcsPerChip()); 8512157Sandreas.sandberg@arm.com } 8612157Sandreas.sandberg@arm.com TransactionInterfaceManager* getTransactionInterfaceManager(int procNumber) const { 87 return m_chip_vector[procNumber/RubyConfig::numberOfProcsPerChip()]->getTransactionInterfaceManager(procNumber%RubyConfig::numberOfProcsPerChip()); 88 } 89 void recordCacheContents(CacheRecorder& tr) const; 90 void printConfig(ostream& out) const; 91 void printStats(ostream& out); 92 void clearStats() const; 93 94 // called to notify the system when opal is loaded 95 void opalLoadNotify(); 96 97 void print(ostream& out) const; 98#ifdef CHECK_COHERENCE 99 void checkGlobalCoherenceInvariant(const Address& addr); 100#endif 101 102private: 103 // Private Methods 104 105 // Private copy constructor and assignment operator 106 System(const System& obj); 107 System& operator=(const System& obj); 108 109 // Data Members (m_ prefix) 110 Network* m_network_ptr; 111 Vector<AbstractChip*> m_chip_vector; 112 Profiler* m_profiler_ptr; 113 Driver* m_driver_ptr; 114 Tracer* m_tracer_ptr; 115 XactIsolationChecker *m_xact_isolation_checker; 116 XactCommitArbiter *m_xact_commit_arbiter; 117 XactVisualizer *m_xact_visualizer; 118}; 119 120// Output operator declaration 121ostream& operator<<(ostream& out, const System& obj); 122 123// ******************* Definitions ******************* 124 125// Output operator definition 126inline 127ostream& operator<<(ostream& out, const System& obj) 128{ 129// obj.print(out); 130 out << flush; 131 return out; 132} 133 134#endif //SYSTEM_H 135 136 137 138