Deleted Added
sdiff udiff text old ( 2836:c8f549058964 ) new ( 2839:d5dd8a3cdea0 )
full compact
1/*
2 * Copyright (c) 2002-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;

--- 74 unchanged lines hidden (view full) ---

83 panic("TimingSimpleCPU doesn't expect recvStatusChange callback!");
84}
85
86TimingSimpleCPU::TimingSimpleCPU(Params *p)
87 : BaseSimpleCPU(p), icachePort(this), dcachePort(this)
88{
89 _status = Idle;
90 ifetch_pkt = dcache_pkt = NULL;
91 quiesceEvent = NULL;
92 state = SimObject::Timing;
93}
94
95
96TimingSimpleCPU::~TimingSimpleCPU()
97{
98}
99

--- 7 unchanged lines hidden (view full) ---

107void
108TimingSimpleCPU::unserialize(Checkpoint *cp, const string &section)
109{
110 UNSERIALIZE_ENUM(_status);
111 BaseSimpleCPU::unserialize(cp, section);
112}
113
114bool
115TimingSimpleCPU::quiesce(Event *quiesce_event)
116{
117 // TimingSimpleCPU is ready to quiesce if it's not waiting for
118 // an access to complete.
119 if (status() == Idle || status() == Running || status() == SwitchedOut) {
120 DPRINTF(Config, "Ready to quiesce\n");
121 changeState(SimObject::QuiescedTiming);
122 return false;
123 } else {
124 DPRINTF(Config, "Waiting to quiesce\n");
125 changeState(SimObject::Quiescing);
126 quiesceEvent = quiesce_event;
127 return true;
128 }
129}
130
131void
132TimingSimpleCPU::resume()
133{
134 if (_status != SwitchedOut && _status != Idle) {

--- 283 unchanged lines hidden (view full) ---

418 assert(pkt->result == Packet::Success);
419 assert(_status == IcacheWaitResponse);
420
421 _status = Running;
422
423 delete pkt->req;
424 delete pkt;
425
426 if (getState() == SimObject::Quiescing) {
427 completeQuiesce();
428 return;
429 }
430
431 preExecute();
432 if (curStaticInst->isMemRef() && !curStaticInst->isDataPrefetch()) {
433 // load or store: just send to dcache
434 Fault fault = curStaticInst->initiateAcc(this, traceData);
435 if (fault == NoFault) {

--- 39 unchanged lines hidden (view full) ---

475TimingSimpleCPU::completeDataAccess(Packet *pkt)
476{
477 // received a response from the dcache: complete the load or store
478 // instruction
479 assert(pkt->result == Packet::Success);
480 assert(_status == DcacheWaitResponse);
481 _status = Running;
482
483 if (getState() == SimObject::Quiescing) {
484 completeQuiesce();
485
486 delete pkt->req;
487 delete pkt;
488
489 return;
490 }
491
492 Fault fault = curStaticInst->completeAcc(pkt, this, traceData);
493
494 delete pkt->req;
495 delete pkt;
496
497 postExecute();
498 advanceInst(fault);
499}
500
501
502void
503TimingSimpleCPU::completeQuiesce()
504{
505 DPRINTF(Config, "Done quiescing\n");
506 changeState(SimObject::QuiescedTiming);
507 quiesceEvent->process();
508}
509
510bool
511TimingSimpleCPU::DcachePort::recvTiming(Packet *pkt)
512{
513 cpu->completeDataAccess(pkt);
514 return true;
515}

--- 111 unchanged lines hidden ---