Check.cc (11025:4872dbdea907) Check.cc (11266:452e10b868ea)
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

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

89
90 Packet::Command cmd;
91
92 // 1 in 8 chance this will be an exclusive prefetch
93 if (random_mt.random(0, 0x7) != 0) {
94 cmd = MemCmd::ReadReq;
95
96 // if necessary, make the request an instruction fetch
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

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

89
90 Packet::Command cmd;
91
92 // 1 in 8 chance this will be an exclusive prefetch
93 if (random_mt.random(0, 0x7) != 0) {
94 cmd = MemCmd::ReadReq;
95
96 // if necessary, make the request an instruction fetch
97 if (m_tester_ptr->isInstReadableCpuPort(index)) {
97 if (m_tester_ptr->isInstOnlyCpuPort(index) ||
98 (m_tester_ptr->isInstDataCpuPort(index) &&
99 (random_mt.random(0, 0x1)))) {
98 flags.set(Request::INST_FETCH);
99 }
100 } else {
101 cmd = MemCmd::WriteReq;
102 flags.set(Request::PF_EXCLUSIVE);
103 }
104
105 // Prefetches are assumed to be 0 sized

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

188 cmd = MemCmd::WriteReq;
189 // }
190
191 PacketPtr pkt = new Packet(req, cmd);
192 uint8_t *writeData = new uint8_t[1];
193 *writeData = m_value + m_store_count;
194 pkt->dataDynamic(writeData);
195
100 flags.set(Request::INST_FETCH);
101 }
102 } else {
103 cmd = MemCmd::WriteReq;
104 flags.set(Request::PF_EXCLUSIVE);
105 }
106
107 // Prefetches are assumed to be 0 sized

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

190 cmd = MemCmd::WriteReq;
191 // }
192
193 PacketPtr pkt = new Packet(req, cmd);
194 uint8_t *writeData = new uint8_t[1];
195 *writeData = m_value + m_store_count;
196 pkt->dataDynamic(writeData);
197
196 DPRINTF(RubyTest, "data 0x%x check 0x%x\n",
198 DPRINTF(RubyTest, "Seq write: index %d data 0x%x check 0x%x\n", index,
197 *(pkt->getConstPtr<uint8_t>()), *writeData);
198
199 // push the subblock onto the sender state. The sequencer will
200 // update the subblock on the return
201 pkt->senderState = new SenderState(writeAddr, req->getSize());
202
203 if (port->sendTimingReq(pkt)) {
204 DPRINTF(RubyTest, "initiating action - successful\n");
205 DPRINTF(RubyTest, "status before action update: %s\n",
206 (TesterStatus_to_string(m_status)).c_str());
207 m_status = TesterStatus_Action_Pending;
199 *(pkt->getConstPtr<uint8_t>()), *writeData);
200
201 // push the subblock onto the sender state. The sequencer will
202 // update the subblock on the return
203 pkt->senderState = new SenderState(writeAddr, req->getSize());
204
205 if (port->sendTimingReq(pkt)) {
206 DPRINTF(RubyTest, "initiating action - successful\n");
207 DPRINTF(RubyTest, "status before action update: %s\n",
208 (TesterStatus_to_string(m_status)).c_str());
209 m_status = TesterStatus_Action_Pending;
210 DPRINTF(RubyTest, "Check %s, State=Action_Pending\n", m_address);
208 } else {
209 // If the packet did not issue, must delete
210 // Note: No need to delete the data, the packet destructor
211 // will delete it
212 delete pkt->senderState;
213 delete pkt->req;
214 delete pkt;
215

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

227 assert(m_status == TesterStatus_Ready);
228
229 int index = random_mt.random(0, m_num_readers - 1);
230 MasterPort* port = m_tester_ptr->getReadableCpuPort(index);
231
232 Request::Flags flags;
233
234 // If necessary, make the request an instruction fetch
211 } else {
212 // If the packet did not issue, must delete
213 // Note: No need to delete the data, the packet destructor
214 // will delete it
215 delete pkt->senderState;
216 delete pkt->req;
217 delete pkt;
218

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

230 assert(m_status == TesterStatus_Ready);
231
232 int index = random_mt.random(0, m_num_readers - 1);
233 MasterPort* port = m_tester_ptr->getReadableCpuPort(index);
234
235 Request::Flags flags;
236
237 // If necessary, make the request an instruction fetch
235 if (m_tester_ptr->isInstReadableCpuPort(index)) {
238 if (m_tester_ptr->isInstOnlyCpuPort(index) ||
239 (m_tester_ptr->isInstDataCpuPort(index) &&
240 (random_mt.random(0, 0x1)))) {
236 flags.set(Request::INST_FETCH);
237 }
238
239 // Checks are sized depending on the number of bytes written
240 Request *req = new Request(m_address, CHECK_SIZE, flags,
241 m_tester_ptr->masterId(), curTick(), m_pc);
242
243 req->setThreadContext(index, 0);
244 PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
245 uint8_t *dataArray = new uint8_t[CHECK_SIZE];
246 pkt->dataDynamic(dataArray);
247
241 flags.set(Request::INST_FETCH);
242 }
243
244 // Checks are sized depending on the number of bytes written
245 Request *req = new Request(m_address, CHECK_SIZE, flags,
246 m_tester_ptr->masterId(), curTick(), m_pc);
247
248 req->setThreadContext(index, 0);
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);
254
248 // push the subblock onto the sender state. The sequencer will
249 // update the subblock on the return
250 pkt->senderState = new SenderState(m_address, req->getSize());
251
252 if (port->sendTimingReq(pkt)) {
253 DPRINTF(RubyTest, "initiating check - successful\n");
254 DPRINTF(RubyTest, "status before check update: %s\n",
255 TesterStatus_to_string(m_status).c_str());
256 m_status = TesterStatus_Check_Pending;
255 // push the subblock onto the sender state. The sequencer will
256 // update the subblock on the return
257 pkt->senderState = new SenderState(m_address, req->getSize());
258
259 if (port->sendTimingReq(pkt)) {
260 DPRINTF(RubyTest, "initiating check - successful\n");
261 DPRINTF(RubyTest, "status before check update: %s\n",
262 TesterStatus_to_string(m_status).c_str());
263 m_status = TesterStatus_Check_Pending;
264 DPRINTF(RubyTest, "Check %s, State=Check_Pending\n", m_address);
257 } else {
258 // If the packet did not issue, must delete
259 // Note: No need to delete the data, the packet destructor
260 // will delete it
261 delete pkt->senderState;
262 delete pkt->req;
263 delete pkt;
264

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

286 if (m_status == TesterStatus_Action_Pending) {
287 DPRINTF(RubyTest, "Action callback write value: %d, currently %d\n",
288 (m_value + m_store_count), data->getByte(0));
289 // Perform store one byte at a time
290 data->setByte(0, (m_value + m_store_count));
291 m_store_count++;
292 if (m_store_count == CHECK_SIZE) {
293 m_status = TesterStatus_Ready;
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;
270 delete pkt->req;
271 delete pkt;
272

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

294 if (m_status == TesterStatus_Action_Pending) {
295 DPRINTF(RubyTest, "Action callback write value: %d, currently %d\n",
296 (m_value + m_store_count), data->getByte(0));
297 // Perform store one byte at a time
298 data->setByte(0, (m_value + m_store_count));
299 m_store_count++;
300 if (m_store_count == CHECK_SIZE) {
301 m_status = TesterStatus_Ready;
302 DPRINTF(RubyTest, "Check %s, State=Ready\n", m_address);
294 } else {
295 m_status = TesterStatus_Idle;
303 } else {
304 m_status = TesterStatus_Idle;
305 DPRINTF(RubyTest, "Check %s, State=Idle store_count: %d\n",
306 m_address, m_store_count);
296 }
297 DPRINTF(RubyTest, "Action callback return data now %d\n",
298 data->getByte(0));
299 } else if (m_status == TesterStatus_Check_Pending) {
300 DPRINTF(RubyTest, "Check callback\n");
301 // Perform load/check
302 for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) {
303 if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) {

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

311 }
312 DPRINTF(RubyTest, "Action/check success\n");
313 debugPrint();
314
315 // successful check complete, increment complete
316 m_tester_ptr->incrementCheckCompletions();
317
318 m_status = TesterStatus_Idle;
307 }
308 DPRINTF(RubyTest, "Action callback return data now %d\n",
309 data->getByte(0));
310 } else if (m_status == TesterStatus_Check_Pending) {
311 DPRINTF(RubyTest, "Check callback\n");
312 // Perform load/check
313 for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) {
314 if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) {

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

322 }
323 DPRINTF(RubyTest, "Action/check success\n");
324 debugPrint();
325
326 // successful check complete, increment complete
327 m_tester_ptr->incrementCheckCompletions();
328
329 m_status = TesterStatus_Idle;
330 DPRINTF(RubyTest, "Check %s, State=Idle\n", m_address);
319 pickValue();
320
321 } else {
322 panic("Unexpected TesterStatus: %s proc: %d data: %s m_status: %s "
323 "time: %d\n", *this, proc, data, m_status, curTime);
324 }
325
326 DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc,
327 makeLineAddress(m_address));
328 DPRINTF(RubyTest, "Callback done\n");
329 debugPrint();
330}
331
332void
333Check::changeAddress(Addr address)
334{
335 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
336 m_status = TesterStatus_Idle;
337 m_address = address;
331 pickValue();
332
333 } else {
334 panic("Unexpected TesterStatus: %s proc: %d data: %s m_status: %s "
335 "time: %d\n", *this, proc, data, m_status, curTime);
336 }
337
338 DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc,
339 makeLineAddress(m_address));
340 DPRINTF(RubyTest, "Callback done\n");
341 debugPrint();
342}
343
344void
345Check::changeAddress(Addr address)
346{
347 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
348 m_status = TesterStatus_Idle;
349 m_address = address;
350 DPRINTF(RubyTest, "Check %s, State=Idle\n", m_address);
338 m_store_count = 0;
339}
340
341void
342Check::pickValue()
343{
344 assert(m_status == TesterStatus_Idle);
351 m_store_count = 0;
352}
353
354void
355Check::pickValue()
356{
357 assert(m_status == TesterStatus_Idle);
345 m_status = TesterStatus_Idle;
346 m_value = random_mt.random(0, 0xff); // One byte
347 m_store_count = 0;
348}
349
350void
351Check::pickInitiatingNode()
352{
353 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
354 m_status = TesterStatus_Idle;
355 m_initiatingNode = (random_mt.random(0, m_num_writers - 1));
358 m_value = random_mt.random(0, 0xff); // One byte
359 m_store_count = 0;
360}
361
362void
363Check::pickInitiatingNode()
364{
365 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
366 m_status = TesterStatus_Idle;
367 m_initiatingNode = (random_mt.random(0, m_num_writers - 1));
356 DPRINTF(RubyTest, "picked initiating node %d\n", m_initiatingNode);
368 DPRINTF(RubyTest, "Check %s, State=Idle, picked initiating node %d\n",
369 m_address, m_initiatingNode);
357 m_store_count = 0;
358}
359
360void
361Check::print(std::ostream& out) const
362{
363 out << "["
364 << m_address << ", value: "

--- 15 unchanged lines hidden ---
370 m_store_count = 0;
371}
372
373void
374Check::print(std::ostream& out) const
375{
376 out << "["
377 << m_address << ", value: "

--- 15 unchanged lines hidden ---