Deleted Added
sdiff udiff text old ( 3594:e401993e0cbb ) new ( 3633:524f2aadbc89 )
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;

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

57 panic("DefaultFetch doesn't expect recvAtomic callback!");
58 return curTick;
59}
60
61template<class Impl>
62void
63DefaultFetch<Impl>::IcachePort::recvFunctional(PacketPtr pkt)
64{
65 DPRINTF(Fetch, "DefaultFetch doesn't update its state from a "
66 "functional call.");
67}
68
69template<class Impl>
70void
71DefaultFetch<Impl>::IcachePort::recvStatusChange(Status status)
72{
73 if (status == RangeChange)
74 return;
75
76 panic("DefaultFetch doesn't expect recvStatusChange callback!");
77}
78
79template<class Impl>
80bool
81DefaultFetch<Impl>::IcachePort::recvTiming(PacketPtr pkt)
82{
83 DPRINTF(Fetch, "Received timing\n");
84 if (pkt->isResponse()) {
85 fetch->processCacheCompletion(pkt);
86 }
87 //else Snooped a coherence request, just return
88 return true;
89}
90
91template<class Impl>

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

556
557template <class Impl>
558bool
559DefaultFetch<Impl>::fetchCacheLine(Addr fetch_PC, Fault &ret_fault, unsigned tid)
560{
561 Fault fault = NoFault;
562
563 //AlphaDep
564 if (cacheBlocked || isSwitchedOut() ||
565 (interruptPending && (fetch_PC & 0x3))) {
566 // Hold off fetch from getting new instructions when:
567 // Cache is blocked, or
568 // while an interrupt is pending and we're not in PAL mode, or
569 // fetch is switched out.
570 return false;
571 }
572
573 // Align the fetch PC so it's at the start of a cache block.
574 fetch_PC = icacheBlockAlignPC(fetch_PC);
575
576 // If we've already got the block, no need to try to fetch it again.
577 if (cacheDataValid[tid] && fetch_PC == cacheDataPC[tid]) {
578 return true;
579 }
580
581 // Setup the memReq to do a read of the first instruction's address.
582 // Set the appropriate read size and flags as well.
583 // Build request here.
584 RequestPtr mem_req = new Request(tid, fetch_PC, cacheBlkSize, 0,
585 fetch_PC, cpu->readCpuId(), tid);
586
587 memReq[tid] = mem_req;
588
589 // Translate the instruction request.
590 fault = cpu->translateInstReq(mem_req, cpu->thread[tid]);
591
592 // In the case of faults, the fetch stage may need to stall and wait

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

606 }
607#endif
608
609 // Build packet here.
610 PacketPtr data_pkt = new Packet(mem_req,
611 Packet::ReadReq, Packet::Broadcast);
612 data_pkt->dataDynamicArray(new uint8_t[cacheBlkSize]);
613
614 cacheDataPC[tid] = fetch_PC;
615 cacheDataValid[tid] = false;
616
617 DPRINTF(Fetch, "Fetch: Doing instruction read.\n");
618
619 fetchedCacheLines++;
620
621 // Now do the timing access to see whether or not the instruction
622 // exists within the cache.

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

1047 } else {
1048 ++fetchMiscStallCycles;
1049 }
1050 return;
1051 }
1052 } else {
1053 if (fetchStatus[tid] == Idle) {
1054 ++fetchIdleCycles;
1055 } else if (fetchStatus[tid] == Blocked) {
1056 ++fetchBlockedCycles;
1057 } else if (fetchStatus[tid] == Squashing) {
1058 ++fetchSquashCycles;
1059 } else if (fetchStatus[tid] == IcacheWaitResponse) {
1060 ++icacheStallCycles;
1061 }
1062
1063 // Status is Idle, Squashing, Blocked, or IcacheWaitResponse, so
1064 // fetch should do nothing.
1065 return;
1066 }
1067
1068 ++fetchCycles;

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

1155
1156 // Increment stat of fetched instructions.
1157 ++fetchedInsts;
1158
1159 // Move to the next instruction, unless we have a branch.
1160 fetch_PC = next_PC;
1161
1162 if (instruction->isQuiesce()) {
1163 DPRINTF(Fetch, "Quiesce instruction encountered, halting fetch!",
1164 curTick);
1165 fetchStatus[tid] = QuiescePending;
1166 ++numInst;
1167 status_change = true;
1168 break;
1169 }
1170
1171 offset += instSize;
1172

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

1270
1271 toDecode->insts[numInst] = instruction;
1272 toDecode->size++;
1273
1274 DPRINTF(Fetch, "[tid:%i]: Blocked, need to handle the trap.\n",tid);
1275
1276 fetchStatus[tid] = TrapPending;
1277 status_change = true;
1278#else // !FULL_SYSTEM
1279 fetchStatus[tid] = TrapPending;
1280 status_change = true;
1281
1282#endif // FULL_SYSTEM
1283 DPRINTF(Fetch, "[tid:%i]: fault (%s) detected @ PC %08p",
1284 tid, fault->name(), PC[tid]);
1285 }
1286}
1287
1288template<class Impl>
1289void
1290DefaultFetch<Impl>::recvRetry()
1291{
1292 if (retryPkt != NULL) {

--- 162 unchanged lines hidden ---