Sequencer.hh (6922:1620cffaa3b6) | Sequencer.hh (7039:bc0b6ea676b5) |
---|---|
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; --- 12 unchanged lines hidden (view full) --- 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 | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 |
30/* 31 * $Id: Sequencer.hh 1.70 2006/09/27 14:56:41-05:00 bobba@s1-01.cs.wisc.edu $ 32 * 33 * Description: 34 * 35 */ | 29#ifndef __MEM_RUBY_SYSTEM_SEQUENCER_HH__ 30#define __MEM_RUBY_SYSTEM_SEQUENCER_HH__ |
36 | 31 |
37#ifndef SEQUENCER_H 38#define SEQUENCER_H 39 40#include "mem/ruby/common/Global.hh" 41#include "mem/ruby/common/Consumer.hh" 42#include "mem/protocol/CacheRequestType.hh" | 32#include "mem/gems_common/Map.hh" |
43#include "mem/protocol/AccessModeType.hh" | 33#include "mem/protocol/AccessModeType.hh" |
34#include "mem/protocol/CacheRequestType.hh" |
|
44#include "mem/protocol/GenericMachineType.hh" 45#include "mem/protocol/PrefetchBit.hh" | 35#include "mem/protocol/GenericMachineType.hh" 36#include "mem/protocol/PrefetchBit.hh" |
46#include "mem/ruby/system/RubyPort.hh" 47#include "mem/gems_common/Map.hh" | |
48#include "mem/ruby/common/Address.hh" | 37#include "mem/ruby/common/Address.hh" |
38#include "mem/ruby/common/Consumer.hh" 39#include "mem/ruby/common/Global.hh" 40#include "mem/ruby/system/RubyPort.hh" |
|
49 50class DataBlock; 51class CacheMsg; 52class MachineID; 53class CacheMemory; 54 55class RubySequencerParams; 56 | 41 42class DataBlock; 43class CacheMsg; 44class MachineID; 45class CacheMemory; 46 47class RubySequencerParams; 48 |
57struct SequencerRequest { 58 RubyRequest ruby_request; 59 Time issue_time; | 49struct SequencerRequest 50{ 51 RubyRequest ruby_request; 52 Time issue_time; |
60 | 53 |
61 SequencerRequest(const RubyRequest & _ruby_request, 62 Time _issue_time) 63 : ruby_request(_ruby_request), 64 issue_time(_issue_time) 65 {} | 54 SequencerRequest(const RubyRequest & _ruby_request, Time _issue_time) 55 : ruby_request(_ruby_request), issue_time(_issue_time) 56 {} |
66}; 67 68std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj); 69 | 57}; 58 59std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj); 60 |
70class Sequencer : public RubyPort, public Consumer { 71public: | 61class Sequencer : public RubyPort, public Consumer 62{ 63 public: |
72 typedef RubySequencerParams Params; | 64 typedef RubySequencerParams Params; |
73 // Constructors 74 Sequencer(const Params *); | 65 Sequencer(const Params *); 66 ~Sequencer(); |
75 | 67 |
76 // Destructor 77 ~Sequencer(); | 68 // Public Methods 69 void wakeup(); // Used only for deadlock detection |
78 | 70 |
79 // Public Methods 80 void wakeup(); // Used only for deadlock detection | 71 void printConfig(ostream& out) const; |
81 | 72 |
82 void printConfig(ostream& out) const; | 73 void printProgress(ostream& out) const; |
83 | 74 |
84 void printProgress(ostream& out) const; | 75 void writeCallback(const Address& address, DataBlock& data); 76 void readCallback(const Address& address, DataBlock& data); |
85 | 77 |
86 void writeCallback(const Address& address, DataBlock& data); 87 void readCallback(const Address& address, DataBlock& data); | 78 RequestStatus makeRequest(const RubyRequest & request); 79 RequestStatus getRequestStatus(const RubyRequest& request); 80 bool empty() const; |
88 | 81 |
89 RequestStatus makeRequest(const RubyRequest & request); 90 RequestStatus getRequestStatus(const RubyRequest& request); 91 bool empty() const; | 82 void print(ostream& out) const; 83 void printStats(ostream & out) const; 84 void checkCoherence(const Address& address); |
92 | 85 |
93 void print(ostream& out) const; 94 void printStats(ostream & out) const; 95 void checkCoherence(const Address& address); | 86 void removeRequest(SequencerRequest* request); |
96 | 87 |
97 // bool getRubyMemoryValue(const Address& addr, char* value, unsigned int size_in_bytes); 98 // bool setRubyMemoryValue(const Address& addr, char *value, unsigned int size_in_bytes); | 88 private: 89 bool tryCacheAccess(const Address& addr, CacheRequestType type, 90 const Address& pc, AccessModeType access_mode, 91 int size, DataBlock*& data_ptr); 92 void issueRequest(const RubyRequest& request); |
99 | 93 |
100 void removeRequest(SequencerRequest* request); 101private: 102 // Private Methods 103 bool tryCacheAccess(const Address& addr, CacheRequestType type, const Address& pc, AccessModeType access_mode, int size, DataBlock*& data_ptr); 104 void issueRequest(const RubyRequest& request); | 94 void hitCallback(SequencerRequest* request, DataBlock& data); 95 bool insertRequest(SequencerRequest* request); |
105 | 96 |
106 void hitCallback(SequencerRequest* request, DataBlock& data); 107 bool insertRequest(SequencerRequest* request); | |
108 | 97 |
98 // Private copy constructor and assignment operator 99 Sequencer(const Sequencer& obj); 100 Sequencer& operator=(const Sequencer& obj); |
|
109 | 101 |
110 // Private copy constructor and assignment operator 111 Sequencer(const Sequencer& obj); 112 Sequencer& operator=(const Sequencer& obj); | 102 private: 103 int m_max_outstanding_requests; 104 int m_deadlock_threshold; |
113 | 105 |
114private: 115 int m_max_outstanding_requests; 116 int m_deadlock_threshold; | 106 CacheMemory* m_dataCache_ptr; 107 CacheMemory* m_instCache_ptr; |
117 | 108 |
118 CacheMemory* m_dataCache_ptr; 119 CacheMemory* m_instCache_ptr; | 109 Map<Address, SequencerRequest*> m_writeRequestTable; 110 Map<Address, SequencerRequest*> m_readRequestTable; 111 // Global outstanding request count, across all request tables 112 int m_outstanding_count; 113 bool m_deadlock_check_scheduled; |
120 | 114 |
121 Map<Address, SequencerRequest*> m_writeRequestTable; 122 Map<Address, SequencerRequest*> m_readRequestTable; 123 // Global outstanding request count, across all request tables 124 int m_outstanding_count; 125 bool m_deadlock_check_scheduled; | 115 int m_store_waiting_on_load_cycles; 116 int m_store_waiting_on_store_cycles; 117 int m_load_waiting_on_store_cycles; 118 int m_load_waiting_on_load_cycles; |
126 | 119 |
127 int m_store_waiting_on_load_cycles; 128 int m_store_waiting_on_store_cycles; 129 int m_load_waiting_on_store_cycles; 130 int m_load_waiting_on_load_cycles; | 120 bool m_usingRubyTester; |
131 | 121 |
132 bool m_usingRubyTester; | 122 class SequencerWakeupEvent : public Event 123 { 124 private: 125 Sequencer *m_sequencer_ptr; |
133 | 126 |
134 class SequencerWakeupEvent : public Event 135 { 136 Sequencer *m_sequencer_ptr; | 127 public: 128 SequencerWakeupEvent(Sequencer *_seq) : m_sequencer_ptr(_seq) {} 129 void process() { m_sequencer_ptr->wakeup(); } 130 const char *description() const { return "Sequencer deadlock check"; } 131 }; |
137 | 132 |
138 public: 139 SequencerWakeupEvent(Sequencer *_seq) : m_sequencer_ptr(_seq) {} 140 void process() { m_sequencer_ptr->wakeup(); } 141 const char *description() const { return "Sequencer deadlock check"; } 142 }; 143 144 SequencerWakeupEvent deadlockCheckEvent; | 133 SequencerWakeupEvent deadlockCheckEvent; |
145}; 146 | 134}; 135 |
147// Output operator declaration 148ostream& operator<<(ostream& out, const Sequencer& obj); 149 150// ******************* Definitions ******************* 151 152// Output operator definition 153extern inline 154ostream& operator<<(ostream& out, const Sequencer& obj) | 136inline ostream& 137operator<<(ostream& out, const Sequencer& obj) |
155{ | 138{ |
156 obj.print(out); 157 out << flush; 158 return out; | 139 obj.print(out); 140 out << flush; 141 return out; |
159} 160 | 142} 143 |
161#endif //SEQUENCER_H | 144#endif // __MEM_RUBY_SYSTEM_SEQUENCER_HH__ |
162 | 145 |