Check.cc (12748:ae5ce8e42de7) Check.cc (12749:223c83ed9979)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * Copyright (c) 2009 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

102 flags.set(Request::INST_FETCH);
103 }
104 } else {
105 cmd = MemCmd::WriteReq;
106 flags.set(Request::PF_EXCLUSIVE);
107 }
108
109 // Prefetches are assumed to be 0 sized
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * Copyright (c) 2009 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

102 flags.set(Request::INST_FETCH);
103 }
104 } else {
105 cmd = MemCmd::WriteReq;
106 flags.set(Request::PF_EXCLUSIVE);
107 }
108
109 // Prefetches are assumed to be 0 sized
110 RequestPtr req = new Request(m_address, 0, flags,
110 RequestPtr req = std::make_shared<Request>(m_address, 0, flags,
111 m_tester_ptr->masterId(), curTick(), m_pc);
112 req->setContext(index);
113
114 PacketPtr pkt = new Packet(req, cmd);
115 // despite the oddity of the 0 size (questionable if this should
116 // even be allowed), a prefetch is still a read and as such needs
117 // a place to store the result
118 uint8_t *data = new uint8_t[1];
119 pkt->dataDynamic(data);
120
121 // push the subblock onto the sender state. The sequencer will
122 // update the subblock on the return
123 pkt->senderState = new SenderState(m_address, req->getSize());
124
125 if (port->sendTimingReq(pkt)) {
126 DPRINTF(RubyTest, "successfully initiated prefetch.\n");
127 } else {
128 // If the packet did not issue, must delete
129 delete pkt->senderState;
111 m_tester_ptr->masterId(), curTick(), m_pc);
112 req->setContext(index);
113
114 PacketPtr pkt = new Packet(req, cmd);
115 // despite the oddity of the 0 size (questionable if this should
116 // even be allowed), a prefetch is still a read and as such needs
117 // a place to store the result
118 uint8_t *data = new uint8_t[1];
119 pkt->dataDynamic(data);
120
121 // push the subblock onto the sender state. The sequencer will
122 // update the subblock on the return
123 pkt->senderState = new SenderState(m_address, req->getSize());
124
125 if (port->sendTimingReq(pkt)) {
126 DPRINTF(RubyTest, "successfully initiated prefetch.\n");
127 } else {
128 // If the packet did not issue, must delete
129 delete pkt->senderState;
130 delete pkt->req;
131 delete pkt;
132
133 DPRINTF(RubyTest,
134 "prefetch initiation failed because Port was busy.\n");
135 }
136}
137
138void
139Check::initiateFlush()
140{
141
142 DPRINTF(RubyTest, "initiating Flush\n");
143
144 int index = random_mt.random(0, m_num_writers - 1);
145 MasterPort* port = m_tester_ptr->getWritableCpuPort(index);
146
147 Request::Flags flags;
148
130 delete pkt;
131
132 DPRINTF(RubyTest,
133 "prefetch initiation failed because Port was busy.\n");
134 }
135}
136
137void
138Check::initiateFlush()
139{
140
141 DPRINTF(RubyTest, "initiating Flush\n");
142
143 int index = random_mt.random(0, m_num_writers - 1);
144 MasterPort* port = m_tester_ptr->getWritableCpuPort(index);
145
146 Request::Flags flags;
147
149 RequestPtr req = new Request(m_address, CHECK_SIZE, flags,
148 RequestPtr req = std::make_shared<Request>(m_address, CHECK_SIZE, flags,
150 m_tester_ptr->masterId(), curTick(), m_pc);
151
152 Packet::Command cmd;
153
154 cmd = MemCmd::FlushReq;
155
156 PacketPtr pkt = new Packet(req, cmd);
157

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

174 MasterPort* port = m_tester_ptr->getWritableCpuPort(index);
175
176 Request::Flags flags;
177
178 // Create the particular address for the next byte to be written
179 Addr writeAddr(m_address + m_store_count);
180
181 // Stores are assumed to be 1 byte-sized
149 m_tester_ptr->masterId(), curTick(), m_pc);
150
151 Packet::Command cmd;
152
153 cmd = MemCmd::FlushReq;
154
155 PacketPtr pkt = new Packet(req, cmd);
156

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

173 MasterPort* port = m_tester_ptr->getWritableCpuPort(index);
174
175 Request::Flags flags;
176
177 // Create the particular address for the next byte to be written
178 Addr writeAddr(m_address + m_store_count);
179
180 // Stores are assumed to be 1 byte-sized
182 RequestPtr req = new Request(writeAddr, 1, flags, m_tester_ptr->masterId(),
183 curTick(), m_pc);
181 RequestPtr req = std::make_shared<Request>(
182 writeAddr, 1, flags, m_tester_ptr->masterId(), curTick(), m_pc);
184
185 req->setContext(index);
186 Packet::Command cmd;
187
188 // 1 out of 8 chance, issue an atomic rather than a write
189 // if ((random() & 0x7) == 0) {
190 // cmd = MemCmd::SwapReq;
191 // } else {

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

210 (TesterStatus_to_string(m_status)).c_str());
211 m_status = TesterStatus_Action_Pending;
212 DPRINTF(RubyTest, "Check %#x, State=Action_Pending\n", m_address);
213 } else {
214 // If the packet did not issue, must delete
215 // Note: No need to delete the data, the packet destructor
216 // will delete it
217 delete pkt->senderState;
183
184 req->setContext(index);
185 Packet::Command cmd;
186
187 // 1 out of 8 chance, issue an atomic rather than a write
188 // if ((random() & 0x7) == 0) {
189 // cmd = MemCmd::SwapReq;
190 // } else {

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

209 (TesterStatus_to_string(m_status)).c_str());
210 m_status = TesterStatus_Action_Pending;
211 DPRINTF(RubyTest, "Check %#x, State=Action_Pending\n", m_address);
212 } else {
213 // If the packet did not issue, must delete
214 // Note: No need to delete the data, the packet destructor
215 // will delete it
216 delete pkt->senderState;
218 delete pkt->req;
219 delete pkt;
220
221 DPRINTF(RubyTest, "failed to initiate action - sequencer not ready\n");
222 }
223
224 DPRINTF(RubyTest, "status after action update: %s\n",
225 (TesterStatus_to_string(m_status)).c_str());
226}

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

239 // If necessary, make the request an instruction fetch
240 if (m_tester_ptr->isInstOnlyCpuPort(index) ||
241 (m_tester_ptr->isInstDataCpuPort(index) &&
242 (random_mt.random(0, 0x1)))) {
243 flags.set(Request::INST_FETCH);
244 }
245
246 // Checks are sized depending on the number of bytes written
217 delete pkt;
218
219 DPRINTF(RubyTest, "failed to initiate action - sequencer not ready\n");
220 }
221
222 DPRINTF(RubyTest, "status after action update: %s\n",
223 (TesterStatus_to_string(m_status)).c_str());
224}

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

237 // If necessary, make the request an instruction fetch
238 if (m_tester_ptr->isInstOnlyCpuPort(index) ||
239 (m_tester_ptr->isInstDataCpuPort(index) &&
240 (random_mt.random(0, 0x1)))) {
241 flags.set(Request::INST_FETCH);
242 }
243
244 // Checks are sized depending on the number of bytes written
247 RequestPtr req = new Request(m_address, CHECK_SIZE, flags,
245 RequestPtr req = std::make_shared<Request>(m_address, CHECK_SIZE, flags,
248 m_tester_ptr->masterId(), curTick(), m_pc);
249
250 req->setContext(index);
251 PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
252 uint8_t *dataArray = new uint8_t[CHECK_SIZE];
253 pkt->dataDynamic(dataArray);
254
255 DPRINTF(RubyTest, "Seq read: index %d\n", index);

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

264 TesterStatus_to_string(m_status).c_str());
265 m_status = TesterStatus_Check_Pending;
266 DPRINTF(RubyTest, "Check %#x, State=Check_Pending\n", m_address);
267 } else {
268 // If the packet did not issue, must delete
269 // Note: No need to delete the data, the packet destructor
270 // will delete it
271 delete pkt->senderState;
246 m_tester_ptr->masterId(), curTick(), m_pc);
247
248 req->setContext(index);
249 PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
250 uint8_t *dataArray = new uint8_t[CHECK_SIZE];
251 pkt->dataDynamic(dataArray);
252
253 DPRINTF(RubyTest, "Seq read: index %d\n", index);

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

262 TesterStatus_to_string(m_status).c_str());
263 m_status = TesterStatus_Check_Pending;
264 DPRINTF(RubyTest, "Check %#x, State=Check_Pending\n", m_address);
265 } else {
266 // If the packet did not issue, must delete
267 // Note: No need to delete the data, the packet destructor
268 // will delete it
269 delete pkt->senderState;
272 delete pkt->req;
273 delete pkt;
274
275 DPRINTF(RubyTest, "failed to initiate check - cpu port not ready\n");
276 }
277
278 DPRINTF(RubyTest, "status after check update: %s\n",
279 TesterStatus_to_string(m_status).c_str());
280}

--- 114 unchanged lines hidden ---
270 delete pkt;
271
272 DPRINTF(RubyTest, "failed to initiate check - cpu port not ready\n");
273 }
274
275 DPRINTF(RubyTest, "status after check update: %s\n",
276 TesterStatus_to_string(m_status).c_str());
277}

--- 114 unchanged lines hidden ---