physical.cc (8712:7f762428a9f5) physical.cc (8719:d70a85ee7062)
1/*
1/*
2 * Copyright (c) 2010 ARM Limited
2 * Copyright (c) 2010-2011 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

121}
122
123PhysicalMemory::~PhysicalMemory()
124{
125 if (pmemAddr)
126 munmap((char*)pmemAddr, size());
127}
128
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

121}
122
123PhysicalMemory::~PhysicalMemory()
124{
125 if (pmemAddr)
126 munmap((char*)pmemAddr, size());
127}
128
129void
130PhysicalMemory::regStats()
131{
132 using namespace Stats;
133
134 bytesRead
135 .name(name() + ".bytes_read")
136 .desc("Number of bytes read from this memory")
137 ;
138 bytesInstRead
139 .name(name() + ".bytes_inst_read")
140 .desc("Number of instructions bytes read from this memory")
141 ;
142 bytesWritten
143 .name(name() + ".bytes_written")
144 .desc("Number of bytes written to this memory")
145 ;
146 numReads
147 .name(name() + ".num_reads")
148 .desc("Number of read requests responded to by this memory")
149 ;
150 numWrites
151 .name(name() + ".num_writes")
152 .desc("Number of write requests responded to by this memory")
153 ;
154 numOther
155 .name(name() + ".num_other")
156 .desc("Number of other requests responded to by this memory")
157 ;
158 bwRead
159 .name(name() + ".bw_read")
160 .desc("Total read bandwidth from this memory (bytes/s)")
161 .precision(0)
162 .prereq(bytesRead)
163 ;
164 bwInstRead
165 .name(name() + ".bw_inst_read")
166 .desc("Instruction read bandwidth from this memory (bytes/s)")
167 .precision(0)
168 .prereq(bytesInstRead)
169 ;
170 bwWrite
171 .name(name() + ".bw_write")
172 .desc("Write bandwidth from this memory (bytes/s)")
173 .precision(0)
174 .prereq(bytesWritten)
175 ;
176 bwTotal
177 .name(name() + ".bw_total")
178 .desc("Total bandwidth to/from this memory (bytes/s)")
179 .precision(0)
180 .prereq(bwTotal)
181 ;
182 bwRead = bytesRead / simSeconds;
183 bwInstRead = bytesInstRead / simSeconds;
184 bwWrite = bytesWritten / simSeconds;
185 bwTotal = (bytesRead + bytesWritten) / simSeconds;
186}
187
129unsigned
130PhysicalMemory::deviceBlockSize() const
131{
132 //Can accept anysize request
133 return 0;
134}
135
136Tick

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

299 panic("Invalid size for conditional read/write\n");
300 }
301
302 if (overwrite_mem)
303 std::memcpy(hostAddr, &overwrite_val, pkt->getSize());
304
305 assert(!pkt->req->isInstFetch());
306 TRACE_PACKET("Read/Write");
188unsigned
189PhysicalMemory::deviceBlockSize() const
190{
191 //Can accept anysize request
192 return 0;
193}
194
195Tick

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

358 panic("Invalid size for conditional read/write\n");
359 }
360
361 if (overwrite_mem)
362 std::memcpy(hostAddr, &overwrite_val, pkt->getSize());
363
364 assert(!pkt->req->isInstFetch());
365 TRACE_PACKET("Read/Write");
366 numOther++;
307 } else if (pkt->isRead()) {
308 assert(!pkt->isWrite());
309 if (pkt->isLLSC()) {
310 trackLoadLocked(pkt);
311 }
312 if (pmemAddr)
313 memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
314 TRACE_PACKET(pkt->req->isInstFetch() ? "IFetch" : "Read");
367 } else if (pkt->isRead()) {
368 assert(!pkt->isWrite());
369 if (pkt->isLLSC()) {
370 trackLoadLocked(pkt);
371 }
372 if (pmemAddr)
373 memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
374 TRACE_PACKET(pkt->req->isInstFetch() ? "IFetch" : "Read");
375 numReads++;
376 bytesRead += pkt->getSize();
377 if (pkt->req->isInstFetch())
378 bytesInstRead += pkt->getSize();
315 } else if (pkt->isWrite()) {
316 if (writeOK(pkt)) {
317 if (pmemAddr)
318 memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
319 assert(!pkt->req->isInstFetch());
320 TRACE_PACKET("Write");
379 } else if (pkt->isWrite()) {
380 if (writeOK(pkt)) {
381 if (pmemAddr)
382 memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
383 assert(!pkt->req->isInstFetch());
384 TRACE_PACKET("Write");
385 numWrites++;
386 bytesWritten += pkt->getSize();
321 }
322 } else if (pkt->isInvalidate()) {
323 //upgrade or invalidate
324 if (pkt->needsResponse()) {
325 pkt->makeAtomicResponse();
326 }
327 } else {
328 panic("unimplemented");

--- 271 unchanged lines hidden ---
387 }
388 } else if (pkt->isInvalidate()) {
389 //upgrade or invalidate
390 if (pkt->needsResponse()) {
391 pkt->makeAtomicResponse();
392 }
393 } else {
394 panic("unimplemented");

--- 271 unchanged lines hidden ---