simple_mem.cc (10910:32f3d1c454ec) | simple_mem.cc (10913:38dbdeea7f1f) |
---|---|
1/* 2 * Copyright (c) 2010-2013 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 --- 39 unchanged lines hidden (view full) --- 48 49using namespace std; 50 51SimpleMemory::SimpleMemory(const SimpleMemoryParams* p) : 52 AbstractMemory(p), 53 port(name() + ".port", *this), latency(p->latency), 54 latency_var(p->latency_var), bandwidth(p->bandwidth), isBusy(false), 55 retryReq(false), retryResp(false), | 1/* 2 * Copyright (c) 2010-2013 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 --- 39 unchanged lines hidden (view full) --- 48 49using namespace std; 50 51SimpleMemory::SimpleMemory(const SimpleMemoryParams* p) : 52 AbstractMemory(p), 53 port(name() + ".port", *this), latency(p->latency), 54 latency_var(p->latency_var), bandwidth(p->bandwidth), isBusy(false), 55 retryReq(false), retryResp(false), |
56 releaseEvent(this), dequeueEvent(this), drainManager(NULL) | 56 releaseEvent(this), dequeueEvent(this) |
57{ 58} 59 60void 61SimpleMemory::init() 62{ 63 AbstractMemory::init(); 64 --- 130 unchanged lines hidden (view full) --- 195 196 // if the queue is not empty, schedule the next dequeue event, 197 // otherwise signal that we are drained if we were asked to do so 198 if (!packetQueue.empty()) { 199 // if there were packets that got in-between then we 200 // already have an event scheduled, so use re-schedule 201 reschedule(dequeueEvent, 202 std::max(packetQueue.front().tick, curTick()), true); | 57{ 58} 59 60void 61SimpleMemory::init() 62{ 63 AbstractMemory::init(); 64 --- 130 unchanged lines hidden (view full) --- 195 196 // if the queue is not empty, schedule the next dequeue event, 197 // otherwise signal that we are drained if we were asked to do so 198 if (!packetQueue.empty()) { 199 // if there were packets that got in-between then we 200 // already have an event scheduled, so use re-schedule 201 reschedule(dequeueEvent, 202 std::max(packetQueue.front().tick, curTick()), true); |
203 } else if (drainManager) { 204 DPRINTF(Drain, "Drainng of SimpleMemory complete\n"); 205 drainManager->signalDrainDone(); 206 drainManager = NULL; | 203 } else if (drainState() == DrainState::Draining) { 204 DPRINTF(Drain, "Draining of SimpleMemory complete\n"); 205 signalDrainDone(); |
207 } 208 } 209} 210 211Tick 212SimpleMemory::getLatency() const 213{ 214 return latency + --- 13 unchanged lines hidden (view full) --- 228{ 229 if (if_name != "port") { 230 return MemObject::getSlavePort(if_name, idx); 231 } else { 232 return port; 233 } 234} 235 | 206 } 207 } 208} 209 210Tick 211SimpleMemory::getLatency() const 212{ 213 return latency + --- 13 unchanged lines hidden (view full) --- 227{ 228 if (if_name != "port") { 229 return MemObject::getSlavePort(if_name, idx); 230 } else { 231 return port; 232 } 233} 234 |
236unsigned int 237SimpleMemory::drain(DrainManager *dm) | 235DrainState 236SimpleMemory::drain() |
238{ | 237{ |
239 int count = 0; 240 241 // also track our internal queue | |
242 if (!packetQueue.empty()) { | 238 if (!packetQueue.empty()) { |
243 count += 1; 244 drainManager = dm; | |
245 DPRINTF(Drain, "SimpleMemory Queue has requests, waiting to drain\n"); | 239 DPRINTF(Drain, "SimpleMemory Queue has requests, waiting to drain\n"); |
246 } 247 248 if (count) 249 setDrainState(DrainState::Draining); 250 else 251 setDrainState(DrainState::Drained); 252 return count; | 240 return DrainState::Draining; 241 } else { 242 return DrainState::Drained; 243 } |
253} 254 255SimpleMemory::MemoryPort::MemoryPort(const std::string& _name, 256 SimpleMemory& _memory) 257 : SlavePort(_name, &_memory), memory(_memory) 258{ } 259 260AddrRangeList --- 36 unchanged lines hidden --- | 244} 245 246SimpleMemory::MemoryPort::MemoryPort(const std::string& _name, 247 SimpleMemory& _memory) 248 : SlavePort(_name, &_memory), memory(_memory) 249{ } 250 251AddrRangeList --- 36 unchanged lines hidden --- |