comm_monitor.cc (10412:6400a2ab4e22) comm_monitor.cc (10615:cd8aae15f89a)
1/*
2 * Copyright (c) 2012-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

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

50 : MemObject(params),
51 masterPort(name() + "-master", *this),
52 slavePort(name() + "-slave", *this),
53 samplePeriodicEvent(this),
54 samplePeriodTicks(params->sample_period),
55 readAddrMask(params->read_addr_mask),
56 writeAddrMask(params->write_addr_mask),
57 stats(params),
1/*
2 * Copyright (c) 2012-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

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

50 : MemObject(params),
51 masterPort(name() + "-master", *this),
52 slavePort(name() + "-slave", *this),
53 samplePeriodicEvent(this),
54 samplePeriodTicks(params->sample_period),
55 readAddrMask(params->read_addr_mask),
56 writeAddrMask(params->write_addr_mask),
57 stats(params),
58 stackDistCalc(params->stack_dist_calc),
58 traceStream(NULL),
59 system(params->system)
60{
61 // If we are using a trace file, then open the file
62 if (params->trace_enable) {
63 std::string filename;
64 if (params->trace_file != "") {
65 // If the trace file is not specified as an absolute path,

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

132 fatal("Communication monitor is not connected on both sides.\n");
133
134 if (traceStream != NULL) {
135 // Check the memory mode. We only record something when in
136 // timing mode. Warn accordingly.
137 if (!system->isTimingMode())
138 warn("%s: Not in timing mode. No trace will be recorded.", name());
139 }
59 traceStream(NULL),
60 system(params->system)
61{
62 // If we are using a trace file, then open the file
63 if (params->trace_enable) {
64 std::string filename;
65 if (params->trace_file != "") {
66 // If the trace file is not specified as an absolute path,

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

133 fatal("Communication monitor is not connected on both sides.\n");
134
135 if (traceStream != NULL) {
136 // Check the memory mode. We only record something when in
137 // timing mode. Warn accordingly.
138 if (!system->isTimingMode())
139 warn("%s: Not in timing mode. No trace will be recorded.", name());
140 }
141
140}
141
142BaseMasterPort&
143CommMonitor::getMasterPort(const std::string& if_name, PortID idx)
144{
145 if (if_name == "master") {
146 return masterPort;
147 } else {

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

169CommMonitor::recvFunctionalSnoop(PacketPtr pkt)
170{
171 slavePort.sendFunctionalSnoop(pkt);
172}
173
174Tick
175CommMonitor::recvAtomic(PacketPtr pkt)
176{
142}
143
144BaseMasterPort&
145CommMonitor::getMasterPort(const std::string& if_name, PortID idx)
146{
147 if (if_name == "master") {
148 return masterPort;
149 } else {

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

171CommMonitor::recvFunctionalSnoop(PacketPtr pkt)
172{
173 slavePort.sendFunctionalSnoop(pkt);
174}
175
176Tick
177CommMonitor::recvAtomic(PacketPtr pkt)
178{
179 // allow stack distance calculations for atomic if enabled
180 if (stackDistCalc)
181 stackDistCalc->update(pkt->cmd, pkt->getAddr());
182
177 return masterPort.sendAtomic(pkt);
178}
179
180Tick
181CommMonitor::recvAtomicSnoop(PacketPtr pkt)
182{
183 return slavePort.sendAtomicSnoop(pkt);
184}
185
186bool
187CommMonitor::recvTimingReq(PacketPtr pkt)
188{
189 // should always see a request
190 assert(pkt->isRequest());
191
192 // Store relevant fields of packet, because packet may be modified
193 // or even deleted when sendTiming() is called.
194 bool is_read = pkt->isRead();
195 bool is_write = pkt->isWrite();
183 return masterPort.sendAtomic(pkt);
184}
185
186Tick
187CommMonitor::recvAtomicSnoop(PacketPtr pkt)
188{
189 return slavePort.sendAtomicSnoop(pkt);
190}
191
192bool
193CommMonitor::recvTimingReq(PacketPtr pkt)
194{
195 // should always see a request
196 assert(pkt->isRequest());
197
198 // Store relevant fields of packet, because packet may be modified
199 // or even deleted when sendTiming() is called.
200 bool is_read = pkt->isRead();
201 bool is_write = pkt->isWrite();
196 int cmd = pkt->cmdToIndex();
202 MemCmd cmd = pkt->cmd;
203 int cmd_idx = pkt->cmdToIndex();
197 Request::FlagsType req_flags = pkt->req->getFlags();
198 unsigned size = pkt->getSize();
199 Addr addr = pkt->getAddr();
200 bool expects_response = pkt->needsResponse() && !pkt->memInhibitAsserted();
201
202 // If a cache miss is served by a cache, a monitor near the memory
203 // would see a request which needs a response, but this response
204 // would be inhibited and not come back from the memory. Therefore

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

211 // packets)
212 bool successful = masterPort.sendTimingReq(pkt);
213
214 // If not successful, restore the sender state
215 if (!successful && expects_response && !stats.disableLatencyHists) {
216 delete pkt->popSenderState();
217 }
218
204 Request::FlagsType req_flags = pkt->req->getFlags();
205 unsigned size = pkt->getSize();
206 Addr addr = pkt->getAddr();
207 bool expects_response = pkt->needsResponse() && !pkt->memInhibitAsserted();
208
209 // If a cache miss is served by a cache, a monitor near the memory
210 // would see a request which needs a response, but this response
211 // would be inhibited and not come back from the memory. Therefore

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

218 // packets)
219 bool successful = masterPort.sendTimingReq(pkt);
220
221 // If not successful, restore the sender state
222 if (!successful && expects_response && !stats.disableLatencyHists) {
223 delete pkt->popSenderState();
224 }
225
226 // If successful and we are calculating stack distances, update
227 // the calculator
228 if (successful && stackDistCalc)
229 stackDistCalc->update(cmd, addr);
230
219 if (successful && traceStream != NULL) {
220 // Create a protobuf message representing the
221 // packet. Currently we do not preserve the flags in the
222 // trace.
223 ProtoMessage::Packet pkt_msg;
224 pkt_msg.set_tick(curTick());
231 if (successful && traceStream != NULL) {
232 // Create a protobuf message representing the
233 // packet. Currently we do not preserve the flags in the
234 // trace.
235 ProtoMessage::Packet pkt_msg;
236 pkt_msg.set_tick(curTick());
225 pkt_msg.set_cmd(cmd);
237 pkt_msg.set_cmd(cmd_idx);
226 pkt_msg.set_flags(req_flags);
227 pkt_msg.set_addr(addr);
228 pkt_msg.set_size(size);
229
230 traceStream->write(pkt_msg);
231 }
232
233 if (successful && is_read) {

--- 372 unchanged lines hidden ---
238 pkt_msg.set_flags(req_flags);
239 pkt_msg.set_addr(addr);
240 pkt_msg.set_size(size);
241
242 traceStream->write(pkt_msg);
243 }
244
245 if (successful && is_read) {

--- 372 unchanged lines hidden ---