Deleted Added
sdiff udiff text old ( 2640:266b80dd5eca ) new ( 2641:6d9d837e2032 )
full compact
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->dest = pkt->src;
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->addr + pkt->size < pmem_size);
150
151 switch (pkt->cmd) {
152 case Read:
153 memcpy(pkt->getPtr<uint8_t>(), pmem_addr + pkt->addr - base_addr,
154 pkt->size);
155 break;
156 case Write:
157 memcpy(pmem_addr + pkt->addr - base_addr, pkt->getPtr<uint8_t>(),
158 pkt->size);
159 // temporary hack: will need to add real LL/SC implementation
160 // for cacheless systems later.
161 if (pkt->req->getFlags() & LOCKED) {
162 pkt->req->setScResult(1);
163 }
164 break;
165 default:
166 panic("unimplemented");
167 }
168
169 pkt->result = Success;
170}
171
172Port *
173PhysicalMemory::getPort(const std::string &if_name)
174{
175 if (if_name == "") {
176 if (port != NULL)
177 panic("PhysicalMemory::getPort: additional port requested to memory!");

--- 198 unchanged lines hidden ---