1/* 2 * Copyright (c) 2000-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; --- 48 unchanged lines hidden (view full) --- 57#include "base/time.hh" 58#include "cpu/base.hh" 59#include "cpu/smt.hh" 60#include "mem/mem_object.hh" 61#include "mem/port.hh" 62#include "sim/async.hh" 63#include "sim/builder.hh" 64#include "sim/host.hh" |
65#include "sim/serialize.hh" |
66#include "sim/sim_events.hh" 67#include "sim/sim_exit.hh" 68#include "sim/sim_object.hh" 69#include "sim/stat_control.hh" 70#include "sim/stats.hh" 71#include "sim/root.hh" 72 73using namespace std; --- 443 unchanged lines hidden (view full) --- 517 pollQueue.service(); 518 } 519 } 520 } 521 522 // not reached... only exit is return on SimLoopExitEvent 523} 524 |
525Event * 526createCountedQuiesce() 527{ 528 return new CountedQuiesceEvent(); 529} 530 531void 532cleanupCountedQuiesce(Event *counted_quiesce) 533{ 534 CountedQuiesceEvent *event = 535 dynamic_cast<CountedQuiesceEvent *>(counted_quiesce); 536 if (event == NULL) { 537 fatal("Called cleanupCountedQuiesce() on an event that was not " 538 "a CountedQuiesceEvent."); 539 } 540 assert(event->getCount() == 0); 541 delete event; 542} 543 544void 545serializeAll() 546{ 547 Serializable::serializeAll(); 548} 549 550void 551unserializeAll() 552{ 553 Serializable::unserializeAll(); 554} 555 |
556/** 557 * Queue of C++ callbacks to invoke on simulator exit. 558 */ 559CallbackQueue exitCallbacks; 560 561/** 562 * Register an exit callback. 563 */ 564void 565registerExitCallback(Callback *callback) 566{ 567 exitCallbacks.add(callback); 568} 569 |
570BaseCPU * 571convertToBaseCPUPtr(SimObject *obj) 572{ 573 BaseCPU *ptr = dynamic_cast<BaseCPU *>(obj); 574 575 if (ptr == NULL) 576 warn("Casting to BaseCPU pointer failed"); 577 return ptr; 578} 579 |
580/** 581 * Do C++ simulator exit processing. Exported to SWIG to be invoked 582 * when simulator terminates via Python's atexit mechanism. 583 */ 584void 585doExitCleanup() 586{ 587 exitCallbacks.process(); 588 exitCallbacks.clear(); 589 590 cout.flush(); 591 592 ParamContext::cleanupAllContexts(); 593 594 // print simulation stats 595 Stats::DumpNow(); 596} |