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->isRead()) { |
318 memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize()); 319 TRACE_PACKET("Read"); |
320 pkt->makeAtomicResponse(); 321 } else if (pkt->isWrite()) { |
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); |
329 } else { 330 panic("PhysicalMemory: unimplemented functional command %s", 331 pkt->cmdString()); 332 } |
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 |
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(); |
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 --- |