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; --- 114 unchanged lines hidden (view full) --- 123} 124 125bool 126PhysicalMemory::doTimingAccess (Packet *pkt, MemoryPort* memoryPort) 127{ 128 doFunctionalAccess(pkt); 129 130 // turn packet around to go back to requester |
131 pkt->makeTimingResponse(); |
132 MemResponseEvent* response = new MemResponseEvent(pkt, memoryPort); 133 response->schedule(curTick + lat); 134 135 return true; 136} 137 138Tick 139PhysicalMemory::doAtomicAccess(Packet *pkt) 140{ 141 doFunctionalAccess(pkt); 142 pkt->time = curTick + lat; 143 return curTick + lat; 144} 145 146void 147PhysicalMemory::doFunctionalAccess(Packet *pkt) 148{ |
149 assert(pkt->getAddr() + pkt->getSize() < pmem_size); |
150 151 switch (pkt->cmd) { |
152 case Packet::ReadReq: 153 memcpy(pkt->getPtr 154 pmem_addr + pkt->getAddr() - base_addr, 155 pkt->getSize()); |
156 break; |
157 case Packet::WriteReq: 158 memcpy(pmem_addr + pkt->getAddr() - base_addr, 159 pkt->getPtr<uint8_t>(), 160 pkt->getSize()); |
161 // temporary hack: will need to add real LL/SC implementation 162 // for cacheless systems later. 163 if (pkt->req->getFlags() & LOCKED) { 164 pkt->req->setScResult(1); 165 } 166 break; 167 default: 168 panic("unimplemented"); 169 } 170 |
171 pkt->result = Packet::Success; |
172} 173 174Port * 175PhysicalMemory::getPort(const std::string &if_name) 176{ 177 if (if_name == "") { 178 if (port != NULL) 179 panic("PhysicalMemory::getPort: additional port requested to memory!"); --- 198 unchanged lines hidden --- |