Deleted Added
sdiff udiff text old ( 8736:2d8a57343fe3 ) new ( 8786:8be24baf68b8 )
full compact
1/*
2 * Copyright (c) 2003-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;

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

33 * Definition of BaseCache functions.
34 */
35
36#include "cpu/base.hh"
37#include "cpu/smt.hh"
38#include "debug/Cache.hh"
39#include "mem/cache/base.hh"
40#include "mem/cache/mshr.hh"
41
42using namespace std;
43
44BaseCache::CachePort::CachePort(const std::string &_name, BaseCache *_cache,
45 const std::string &_label)
46 : SimpleTimingPort(_name, _cache), cache(_cache),
47 label(_label), blocked(false), mustSendRetry(false)
48{
49}
50
51
52BaseCache::BaseCache(const Params *p)
53 : MemObject(p),
54 mshrQueue("MSHRs", p->mshrs, 4, MSHRQueue_MSHRs),
55 writeBuffer("write buffer", p->write_buffers, p->mshrs+1000,

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

63 noTargetMSHR(NULL),
64 missCount(p->max_miss_count),
65 drainEvent(NULL),
66 addrRange(p->addr_range),
67 _numCpus(p->num_cpus)
68{
69}
70
71
72bool
73BaseCache::CachePort::checkFunctional(PacketPtr pkt)
74{
75 pkt->pushLabel(label);
76 bool done = SimpleTimingPort::checkFunctional(pkt);
77 pkt->popLabel();
78 return done;
79}

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

112 DPRINTF(Cache, "Cache Unblocking\n");
113 blocked = false;
114 if (mustSendRetry)
115 {
116 DPRINTF(Cache, "Cache Sending Retry\n");
117 mustSendRetry = false;
118 SendRetryEvent *ev = new SendRetryEvent(this, true);
119 // @TODO: need to find a better time (next bus cycle?)
120 cache->schedule(ev, curTick() + 1);
121 }
122}
123
124
125void
126BaseCache::init()
127{
128 if (!cpuSidePort || !memSidePort)
129 panic("Cache not hooked up on both sides\n");
130 cpuSidePort->sendRangeChange();
131}
132
133
134void
135BaseCache::regStats()
136{
137 using namespace Stats;
138
139 // Hit statistics
140 for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) {
141 MemCmd cmd(access_idx);
142 const string &cstr = cmd.toString();
143
144 hits[access_idx]
145#if FULL_SYSTEM
146 .init(_numCpus + 1)
147#else
148 .init(_numCpus)
149#endif
150 .name(name() + "." + cstr + "_hits")
151 .desc("number of " + cstr + " hits")
152 .flags(total | nozero | nonan)
153 ;
154 }
155
156// These macros make it easier to sum the right subset of commands and
157// to change the subset of commands that are considered "demand" vs

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

178 overallHits = demandHits + SUM_NON_DEMAND(hits);
179
180 // Miss statistics
181 for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) {
182 MemCmd cmd(access_idx);
183 const string &cstr = cmd.toString();
184
185 misses[access_idx]
186#if FULL_SYSTEM
187 .init(_numCpus + 1)
188#else
189 .init(_numCpus)
190#endif
191 .name(name() + "." + cstr + "_misses")
192 .desc("number of " + cstr + " misses")
193 .flags(total | nozero | nonan)
194 ;
195 }
196
197 demandMisses
198 .name(name() + ".demand_misses")

--- 443 unchanged lines hidden ---