ruby: Import ruby and slicc from GEMS
[gem5.git] / src / mem / ruby / common / Driver.hh
1
2 /*
3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #ifndef DRIVER_H
31 #define DRIVER_H
32
33 #include "Global.hh"
34 #include "Consumer.hh"
35 #include "NodeID.hh"
36 #include "CacheRequestType.hh"
37
38 class System;
39 class SubBlock;
40 class Address;
41 class MachineID;
42 class SimicsHypervisor;
43
44 class Driver {
45 public:
46 // Constructors
47 Driver();
48
49 // Destructor
50 virtual ~Driver() = 0;
51
52 // Public Methods
53 virtual void get_network_config() {}
54 virtual void hitCallback(NodeID proc, SubBlock& data, CacheRequestType type, int thread) = 0; // Called by sequencer
55 virtual void conflictCallback(NodeID proc, SubBlock& data, CacheRequestType type, int thread) { assert(0); } // Called by sequencer
56 virtual integer_t getInstructionCount(int procID) const { return 1; }
57 virtual integer_t getCycleCount(int procID) const { return 1; }
58 virtual SimicsHypervisor * getHypervisor() { return NULL; }
59 virtual void notifySendNack( int procID, const Address & addr, uint64 remote_timestamp, const MachineID & remote_id) { assert(0); }; //Called by Sequencer
60 virtual void notifyReceiveNack( int procID, const Address & addr, uint64 remote_timestamp, const MachineID & remote_id) { assert(0); }; //Called by Sequencer
61 virtual void notifyReceiveNackFinal( int procID, const Address & addr) { assert(0); }; // Called by Sequencer
62 virtual void notifyTrapStart( int procID, const Address & handlerPC, int threadID, int smtThread ) { assert(0); } //called by Sequencer
63 virtual void notifyTrapComplete( int procID, const Address & newPC, int smtThread ) {assert(0); } // called by Sequencer
64 virtual int getOpalTransactionLevel(int procID, int thread) const {
65 cout << "Driver.hh getOpalTransactionLevel() " << endl;
66 return 0; } //called by Sequencer
67 virtual void addThreadDependency(int procID, int requestor_thread, int conflict_thread) const { assert(0);}
68 virtual uint64 getOpalTime(int procID) const{ return 0; } //called by Sequencer
69 virtual uint64 getOpalTimestamp(int procID, int thread) const{
70 cout << "Driver.hh getOpalTimestamp " << endl;
71 return 0; } // called by Sequencer
72 virtual int inTransaction(int procID, int thread ) const{
73 cout << "Driver.hh inTransaction " << endl;
74 return false; } //called by Sequencer
75 virtual void printDebug(){} //called by Sequencer
76
77 virtual void printStats(ostream& out) const = 0;
78 virtual void clearStats() = 0;
79
80 virtual void printConfig(ostream& out) const = 0;
81
82 //virtual void abortCallback(NodeID proc){}
83
84 virtual integer_t readPhysicalMemory(int procID, physical_address_t address,
85 int len ){ ASSERT(0); return 0; }
86
87 virtual void writePhysicalMemory( int procID, physical_address_t address,
88 integer_t value, int len ){ ASSERT(0); }
89
90 protected:
91 // accessible by subclasses
92
93 private:
94 // inaccessible by subclasses
95
96 };
97
98 #endif //DRIVER_H