Deleted Added
sdiff udiff text old ( 10910:32f3d1c454ec ) new ( 10913:38dbdeea7f1f )
full compact
1/*
2 * Copyright (c) 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

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

47
48DRAMSim2::DRAMSim2(const Params* p) :
49 AbstractMemory(p),
50 port(name() + ".port", *this),
51 wrapper(p->deviceConfigFile, p->systemConfigFile, p->filePath,
52 p->traceFile, p->range.size() / 1024 / 1024, p->enableDebug),
53 retryReq(false), retryResp(false), startTick(0),
54 nbrOutstandingReads(0), nbrOutstandingWrites(0),
55 drainManager(NULL),
56 sendResponseEvent(this), tickEvent(this)
57{
58 DPRINTF(DRAMSim2,
59 "Instantiated DRAMSim2 with clock %d ns and queue size %d\n",
60 wrapper.clockPeriod(), wrapper.queueSize());
61
62 DRAMSim::TransactionCompleteCB* read_cb =
63 new DRAMSim::Callback<DRAMSim2, void, unsigned, uint64_t, uint64_t>(

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

113
114 DPRINTF(DRAMSim2, "Have %d read, %d write, %d responses outstanding\n",
115 nbrOutstandingReads, nbrOutstandingWrites,
116 responseQueue.size());
117
118 if (!responseQueue.empty() && !sendResponseEvent.scheduled())
119 schedule(sendResponseEvent, curTick());
120
121 // check if we were asked to drain and if we are now done
122 if (drainManager && nbrOutstanding() == 0) {
123 drainManager->signalDrainDone();
124 drainManager = NULL;
125 }
126 } else {
127 retryResp = true;
128
129 DPRINTF(DRAMSim2, "Waiting for response retry\n");
130
131 assert(!sendResponseEvent.scheduled());
132 }
133}

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

334 // what is outstanding
335 p->second.pop();
336 if (p->second.empty())
337 outstandingWrites.erase(p);
338
339 assert(nbrOutstandingWrites != 0);
340 --nbrOutstandingWrites;
341
342 // check if we were asked to drain and if we are now done
343 if (drainManager && nbrOutstanding() == 0) {
344 drainManager->signalDrainDone();
345 drainManager = NULL;
346 }
347}
348
349BaseSlavePort&
350DRAMSim2::getSlavePort(const std::string &if_name, PortID idx)
351{
352 if (if_name != "port") {
353 return MemObject::getSlavePort(if_name, idx);
354 } else {
355 return port;
356 }
357}
358
359unsigned int
360DRAMSim2::drain(DrainManager* dm)
361{
362 // check our outstanding reads and writes and if any they need to
363 // drain
364 if (nbrOutstanding() != 0) {
365 setDrainState(DrainState::Draining);
366 drainManager = dm;
367 return 1;
368 } else {
369 setDrainState(DrainState::Drained);
370 return 0;
371 }
372}
373
374DRAMSim2::MemoryPort::MemoryPort(const std::string& _name,
375 DRAMSim2& _memory)
376 : SlavePort(_name, &_memory), memory(_memory)
377{ }
378
379AddrRangeList

--- 37 unchanged lines hidden ---