physical.cc (5275:5279ced1dd8b) physical.cc (5314:e902f12a3af1)
1/*
2 * Copyright (c) 2001-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;

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

309PhysicalMemory::doFunctionalAccess(PacketPtr pkt)
310{
311 assert(pkt->getAddr() >= start() &&
312 pkt->getAddr() + pkt->getSize() <= start() + size());
313
314
315 uint8_t *hostAddr = pmemAddr + pkt->getAddr() - start();
316
1/*
2 * Copyright (c) 2001-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;

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

309PhysicalMemory::doFunctionalAccess(PacketPtr pkt)
310{
311 assert(pkt->getAddr() >= start() &&
312 pkt->getAddr() + pkt->getSize() <= start() + size());
313
314
315 uint8_t *hostAddr = pmemAddr + pkt->getAddr() - start();
316
317 if (pkt->cmd == MemCmd::ReadReq) {
317 if (pkt->isRead()) {
318 memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
319 TRACE_PACKET("Read");
318 memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
319 TRACE_PACKET("Read");
320 } else if (pkt->cmd == MemCmd::WriteReq) {
320 pkt->makeAtomicResponse();
321 } else if (pkt->isWrite()) {
321 memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
322 TRACE_PACKET("Write");
322 memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
323 TRACE_PACKET("Write");
324 pkt->makeAtomicResponse();
325 } else if (pkt->isPrint()) {
326 Packet::PrintReqState *prs = dynamic_cast<Packet::PrintReqState*>(pkt->senderState);
327 prs->printLabels();
328 ccprintf(prs->os, "%s%#x\n", prs->curPrefix(), *hostAddr);
323 } else {
324 panic("PhysicalMemory: unimplemented functional command %s",
325 pkt->cmdString());
326 }
329 } else {
330 panic("PhysicalMemory: unimplemented functional command %s",
331 pkt->cmdString());
332 }
327
328 pkt->makeAtomicResponse();
329}
330
331
332Port *
333PhysicalMemory::getPort(const std::string &if_name, int idx)
334{
335 // Accept request for "functional" port for backwards compatibility
336 // with places where this function is called from C++. I'd prefer

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

400PhysicalMemory::MemoryPort::recvAtomic(PacketPtr pkt)
401{
402 return memory->doAtomicAccess(pkt);
403}
404
405void
406PhysicalMemory::MemoryPort::recvFunctional(PacketPtr pkt)
407{
333}
334
335
336Port *
337PhysicalMemory::getPort(const std::string &if_name, int idx)
338{
339 // Accept request for "functional" port for backwards compatibility
340 // with places where this function is called from C++. I'd prefer

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

404PhysicalMemory::MemoryPort::recvAtomic(PacketPtr pkt)
405{
406 return memory->doAtomicAccess(pkt);
407}
408
409void
410PhysicalMemory::MemoryPort::recvFunctional(PacketPtr pkt)
411{
412 pkt->pushLabel(memory->name());
413
408 if (!checkFunctional(pkt)) {
409 // Default implementation of SimpleTimingPort::recvFunctional()
410 // calls recvAtomic() and throws away the latency; we can save a
411 // little here by just not calculating the latency.
412 memory->doFunctionalAccess(pkt);
413 }
414 if (!checkFunctional(pkt)) {
415 // Default implementation of SimpleTimingPort::recvFunctional()
416 // calls recvAtomic() and throws away the latency; we can save a
417 // little here by just not calculating the latency.
418 memory->doFunctionalAccess(pkt);
419 }
420
421 pkt->popLabel();
414}
415
416unsigned int
417PhysicalMemory::drain(Event *de)
418{
419 int count = 0;
420 for (PortIterator pi = ports.begin(); pi != ports.end(); ++pi) {
421 count += (*pi)->drain(de);

--- 123 unchanged lines hidden ---
422}
423
424unsigned int
425PhysicalMemory::drain(Event *de)
426{
427 int count = 0;
428 for (PortIterator pi = ports.begin(); pi != ports.end(); ++pi) {
429 count += (*pi)->drain(de);

--- 123 unchanged lines hidden ---