1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 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; --- 72 unchanged lines hidden (view full) --- 81 std::string name() const; 82 83 /** Initializes the unit with parameters and a thread id. */ 84 void init(Params *params, int tid); 85 86 /** Registers statistics. */ 87 void regStats(); 88 |
89 /** Switches out the memory dependence predictor. */ |
90 void switchOut(); 91 |
92 /** Takes over from another CPU's thread. */ |
93 void takeOverFrom(); 94 95 /** Sets the pointer to the IQ. */ 96 void setIQ(InstructionQueue<Impl> *iq_ptr); 97 98 /** Inserts a memory instruction. */ 99 void insert(DynInstPtr &inst); 100 --- 53 unchanged lines hidden (view full) --- 154 */ 155 class MemDepEntry : public RefCounted { 156 public: 157 /** Constructs a memory dependence entry. */ 158 MemDepEntry(DynInstPtr &new_inst) 159 : inst(new_inst), regsReady(false), memDepReady(false), 160 completed(false), squashed(false) 161 { |
162#ifdef DEBUG |
163 ++memdep_count; 164 165 DPRINTF(MemDepUnit, "Memory dependency entry created. " 166 "memdep_count=%i\n", memdep_count); |
167#endif |
168 } 169 170 /** Frees any pointers. */ 171 ~MemDepEntry() 172 { 173 for (int i = 0; i < dependInsts.size(); ++i) { 174 dependInsts[i] = NULL; 175 } |
176#ifdef DEBUG |
177 --memdep_count; 178 179 DPRINTF(MemDepUnit, "Memory dependency entry deleted. " 180 "memdep_count=%i\n", memdep_count); |
181#endif |
182 } 183 184 /** Returns the name of the memory dependence entry. */ 185 std::string name() const { return "memdepentry"; } 186 187 /** The instruction being tracked. */ 188 DynInstPtr inst; 189 --- 8 unchanged lines hidden (view full) --- 198 /** If all memory dependencies have been satisfied. */ 199 bool memDepReady; 200 /** If the instruction is completed. */ 201 bool completed; 202 /** If the instruction is squashed. */ 203 bool squashed; 204 205 /** For debugging. */ |
206#ifdef DEBUG |
207 static int memdep_count; 208 static int memdep_insert; 209 static int memdep_erase; |
210#endif |
211 }; 212 213 /** Finds the memory dependence entry in the hash map. */ 214 inline MemDepEntryPtr &findInHash(const DynInstPtr &inst); 215 216 /** Moves an entry to the ready list. */ 217 inline void moveToReady(MemDepEntryPtr &ready_inst_entry); 218 --- 12 unchanged lines hidden (view full) --- 231 232 /** The memory dependence predictor. It is accessed upon new 233 * instructions being added to the IQ, and responds by telling 234 * this unit what instruction the newly added instruction is dependent 235 * upon. 236 */ 237 MemDepPred depPred; 238 |
239 /** Is there an outstanding load barrier that loads must wait on. */ |
240 bool loadBarrier; |
241 /** The sequence number of the load barrier. */ |
242 InstSeqNum loadBarrierSN; |
243 /** Is there an outstanding store barrier that loads must wait on. */ |
244 bool storeBarrier; |
245 /** The sequence number of the store barrier. */ |
246 InstSeqNum storeBarrierSN; 247 248 /** Pointer to the IQ. */ 249 InstructionQueue<Impl> *iqPtr; 250 251 /** The thread id of this memory dependence unit. */ 252 int id; 253 254 /** Stat for number of inserted loads. */ 255 Stats::Scalar<> insertedLoads; 256 /** Stat for number of inserted stores. */ 257 Stats::Scalar<> insertedStores; 258 /** Stat for number of conflicting loads that had to wait for a store. */ 259 Stats::Scalar<> conflictingLoads; 260 /** Stat for number of conflicting stores that had to wait for a store. */ 261 Stats::Scalar<> conflictingStores; 262}; 263 264#endif // __CPU_O3_MEM_DEP_UNIT_HH__ |