sim_object.cc (2842:feca0c70f45d) | sim_object.cc (2901:f9a45473ab55) |
---|---|
1/* 2 * Copyright (c) 2001-2005 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; --- 58 unchanged lines hidden (view full) --- 67 : _params(p) 68{ 69#ifdef DEBUG 70 doDebugBreak = false; 71#endif 72 73 doRecordEvent = !Stats::event_ignore.match(name()); 74 simObjectList.push_back(this); | 1/* 2 * Copyright (c) 2001-2005 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; --- 58 unchanged lines hidden (view full) --- 67 : _params(p) 68{ 69#ifdef DEBUG 70 doDebugBreak = false; 71#endif 72 73 doRecordEvent = !Stats::event_ignore.match(name()); 74 simObjectList.push_back(this); |
75 state = Atomic; | 75 state = Running; |
76} 77 78// 79// SimObject constructor: used to maintain static simObjectList 80// 81SimObject::SimObject(const string &_name) 82 : _params(new Params) 83{ 84 _params->name = _name; 85#ifdef DEBUG 86 doDebugBreak = false; 87#endif 88 89 doRecordEvent = !Stats::event_ignore.match(name()); 90 simObjectList.push_back(this); | 76} 77 78// 79// SimObject constructor: used to maintain static simObjectList 80// 81SimObject::SimObject(const string &_name) 82 : _params(new Params) 83{ 84 _params->name = _name; 85#ifdef DEBUG 86 doDebugBreak = false; 87#endif 88 89 doRecordEvent = !Stats::event_ignore.match(name()); 90 simObjectList.push_back(this); |
91 state = Atomic; | 91 state = Running; |
92} 93 94void 95SimObject::connect() 96{ 97} 98 99void --- 164 unchanged lines hidden (view full) --- 264 265void 266SimObject::recordEvent(const std::string &stat) 267{ 268 if (doRecordEvent) 269 Stats::recordEvent(stat); 270} 271 | 92} 93 94void 95SimObject::connect() 96{ 97} 98 99void --- 164 unchanged lines hidden (view full) --- 264 265void 266SimObject::recordEvent(const std::string &stat) 267{ 268 if (doRecordEvent) 269 Stats::recordEvent(stat); 270} 271 |
272bool | 272unsigned int |
273SimObject::drain(Event *drain_event) 274{ | 273SimObject::drain(Event *drain_event) 274{ |
275 if (state != DrainedAtomic && state != Atomic) { 276 panic("Must implement your own drain function if it is to be used " 277 "in timing mode!"); 278 } 279 state = DrainedAtomic; 280 return true; | 275 state = Drained; 276 return 0; |
281} 282 283void 284SimObject::resume() 285{ | 277} 278 279void 280SimObject::resume() 281{ |
286 if (state == DrainedAtomic) { 287 state = Atomic; 288 } else if (state == DrainedTiming) { 289 state = Timing; 290 } | 282 state = Running; |
291} 292 293void 294SimObject::setMemoryMode(State new_mode) 295{ | 283} 284 285void 286SimObject::setMemoryMode(State new_mode) 287{ |
296 assert(new_mode == Timing || new_mode == Atomic); 297 if (state == DrainedAtomic && new_mode == Timing) { 298 state = DrainedTiming; 299 } else if (state == DrainedTiming && new_mode == Atomic) { 300 state = DrainedAtomic; 301 } else { 302 state = new_mode; 303 } | 288 panic("setMemoryMode() should only be called on systems"); |
304} 305 306void 307SimObject::switchOut() 308{ 309 panic("Unimplemented!"); 310} 311 312void 313SimObject::takeOverFrom(BaseCPU *cpu) 314{ 315 panic("Unimplemented!"); 316} 317 318DEFINE_SIM_OBJECT_CLASS_NAME("SimObject", SimObject) | 289} 290 291void 292SimObject::switchOut() 293{ 294 panic("Unimplemented!"); 295} 296 297void 298SimObject::takeOverFrom(BaseCPU *cpu) 299{ 300 panic("Unimplemented!"); 301} 302 303DEFINE_SIM_OBJECT_CLASS_NAME("SimObject", SimObject) |