Deleted Added
sdiff udiff text old ( 2674:6d4afef73a20 ) new ( 2678:1f86b91dc3bb )
full compact
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;

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

100 cpu->_status = DcacheWaitResponse;
101 cpu->dcache_pkt = NULL;
102 }
103*/
104}
105
106template<class Impl>
107DefaultFetch<Impl>::DefaultFetch(Params *params)
108 : branchPred(params),
109 decodeToFetchDelay(params->decodeToFetchDelay),
110 renameToFetchDelay(params->renameToFetchDelay),
111 iewToFetchDelay(params->iewToFetchDelay),
112 commitToFetchDelay(params->commitToFetchDelay),
113 fetchWidth(params->fetchWidth),
114 numThreads(params->numberOfThreads),
115 numFetchingThreads(params->smtNumFetchingThreads),
116 interruptPending(false)
117{
118 if (numThreads > Impl::MaxThreads)
119 fatal("numThreads is not a valid value\n");
120
121 DPRINTF(Fetch, "Fetch constructor called\n");
122
123 // Set fetch stage's status to inactive.
124 _status = Inactive;

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

156 cacheBlkMask = (cacheBlkSize - 1);
157
158 for (int tid=0; tid < numThreads; tid++) {
159
160 fetchStatus[tid] = Running;
161
162 priorityList.push_back(tid);
163
164 memPkt[tid] = NULL;
165
166 // Create space to store a cache line.
167 cacheData[tid] = new uint8_t[cacheBlkSize];
168
169 stalls[tid].decode = 0;
170 stalls[tid].rename = 0;
171 stalls[tid].iew = 0;
172 stalls[tid].commit = 0;

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

278DefaultFetch<Impl>::setCPU(FullCPU *cpu_ptr)
279{
280 DPRINTF(Fetch, "Setting the CPU pointer.\n");
281 cpu = cpu_ptr;
282
283 // Name is finally available, so create the port.
284 icachePort = new IcachePort(this);
285
286 // Fetch needs to start fetching instructions at the very beginning,
287 // so it must start up in active state.
288 switchToActive();
289}
290
291template<class Impl>
292void
293DefaultFetch<Impl>::setTimeBuffer(TimeBuffer<TimeStruct> *time_buffer)

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

350{
351 unsigned tid = pkt->req->getThreadNum();
352
353 DPRINTF(Fetch, "[tid:%u] Waking up from cache miss.\n",tid);
354
355 // Only change the status if it's still waiting on the icache access
356 // to return.
357 if (fetchStatus[tid] != IcacheWaitResponse ||
358 pkt != memPkt[tid] ||
359 isSwitchedOut()) {
360 ++fetchIcacheSquashes;
361 delete pkt;
362 return;
363 }
364
365 // Wake up the CPU (if it went to sleep and was waiting on this completion
366 // event).
367 cpu->wakeCPU();
368
369 DPRINTF(Activity, "[tid:%u] Activating fetch due to cache completion\n",

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

378 fetchStatus[tid] = IcacheAccessComplete;
379 }
380
381// memcpy(cacheData[tid], memReq[tid]->data, memReq[tid]->size);
382
383 // Reset the mem req to NULL.
384 delete pkt->req;
385 delete pkt;
386 memPkt[tid] = NULL;
387}
388
389template <class Impl>
390void
391DefaultFetch<Impl>::switchOut()
392{
393 // Fetch is ready to switch out at any time.
394 switchedOut = true;

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

509 fetch_PC = icacheBlockAlignPC(fetch_PC);
510
511 // Setup the memReq to do a read of the first instruction's address.
512 // Set the appropriate read size and flags as well.
513 // Build request here.
514 RequestPtr mem_req = new Request(tid, fetch_PC, cacheBlkSize, flags,
515 fetch_PC, cpu->readCpuId(), tid);
516
517 memPkt[tid] = NULL;
518
519 // Translate the instruction request.
520//#if FULL_SYSTEM
521 fault = cpu->translateInstReq(mem_req);
522//#else
523// fault = pTable->translate(memReq[tid]);
524//#endif
525

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

560 DPRINTF(Fetch, "Doing cache access.\n");
561
562 lastIcacheStall[tid] = curTick;
563
564 DPRINTF(Activity, "[tid:%i]: Activity: Waiting on I-cache "
565 "response.\n", tid);
566
567 fetchStatus[tid] = IcacheWaitResponse;
568 }
569
570 ret_fault = fault;
571 return true;
572}
573
574template <class Impl>
575inline void

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

580
581 PC[tid] = new_PC;
582 nextPC[tid] = new_PC + instSize;
583
584 // Clear the icache miss if it's outstanding.
585 if (fetchStatus[tid] == IcacheWaitResponse) {
586 DPRINTF(Fetch, "[tid:%i]: Squashing outstanding Icache miss.\n",
587 tid);
588 delete memPkt[tid];
589 memPkt[tid] = NULL;
590 }
591
592 fetchStatus[tid] = Squashing;
593
594 ++fetchSquashCycles;
595}
596
597template<class Impl>

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

1078
1079 DPRINTF(Fetch, "[tid:%i]: Blocked, need to handle the trap.\n",tid);
1080
1081 fetchStatus[tid] = TrapPending;
1082 status_change = true;
1083
1084 warn("%lli fault (%d) detected @ PC %08p", curTick, fault, PC[tid]);
1085#else // !FULL_SYSTEM
1086 fatal("fault (%d) detected @ PC %08p", fault, PC[tid]);
1087#endif // FULL_SYSTEM
1088 }
1089}
1090
1091
1092///////////////////////////////////////
1093// //
1094// SMT FETCH POLICY MAINTAINED HERE //

--- 141 unchanged lines hidden ---