Check.cc (11800:54436a1784dc) Check.cc (12612:a64e6b723e5f)
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

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

204 // update the subblock on the return
205 pkt->senderState = new SenderState(writeAddr, req->getSize());
206
207 if (port->sendTimingReq(pkt)) {
208 DPRINTF(RubyTest, "initiating action - successful\n");
209 DPRINTF(RubyTest, "status before action update: %s\n",
210 (TesterStatus_to_string(m_status)).c_str());
211 m_status = TesterStatus_Action_Pending;
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

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

204 // update the subblock on the return
205 pkt->senderState = new SenderState(writeAddr, req->getSize());
206
207 if (port->sendTimingReq(pkt)) {
208 DPRINTF(RubyTest, "initiating action - successful\n");
209 DPRINTF(RubyTest, "status before action update: %s\n",
210 (TesterStatus_to_string(m_status)).c_str());
211 m_status = TesterStatus_Action_Pending;
212 DPRINTF(RubyTest, "Check %s, State=Action_Pending\n", m_address);
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;
218 delete pkt->req;
219 delete pkt;
220

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

258 // update the subblock on the return
259 pkt->senderState = new SenderState(m_address, req->getSize());
260
261 if (port->sendTimingReq(pkt)) {
262 DPRINTF(RubyTest, "initiating check - successful\n");
263 DPRINTF(RubyTest, "status before check update: %s\n",
264 TesterStatus_to_string(m_status).c_str());
265 m_status = TesterStatus_Check_Pending;
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;
218 delete pkt->req;
219 delete pkt;
220

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

258 // update the subblock on the return
259 pkt->senderState = new SenderState(m_address, req->getSize());
260
261 if (port->sendTimingReq(pkt)) {
262 DPRINTF(RubyTest, "initiating check - successful\n");
263 DPRINTF(RubyTest, "status before check update: %s\n",
264 TesterStatus_to_string(m_status).c_str());
265 m_status = TesterStatus_Check_Pending;
266 DPRINTF(RubyTest, "Check %s, State=Check_Pending\n", m_address);
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;
272 delete pkt->req;
273 delete pkt;
274

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

296 if (m_status == TesterStatus_Action_Pending) {
297 DPRINTF(RubyTest, "Action callback write value: %d, currently %d\n",
298 (m_value + m_store_count), data->getByte(0));
299 // Perform store one byte at a time
300 data->setByte(0, (m_value + m_store_count));
301 m_store_count++;
302 if (m_store_count == CHECK_SIZE) {
303 m_status = TesterStatus_Ready;
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;
272 delete pkt->req;
273 delete pkt;
274

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

296 if (m_status == TesterStatus_Action_Pending) {
297 DPRINTF(RubyTest, "Action callback write value: %d, currently %d\n",
298 (m_value + m_store_count), data->getByte(0));
299 // Perform store one byte at a time
300 data->setByte(0, (m_value + m_store_count));
301 m_store_count++;
302 if (m_store_count == CHECK_SIZE) {
303 m_status = TesterStatus_Ready;
304 DPRINTF(RubyTest, "Check %s, State=Ready\n", m_address);
304 DPRINTF(RubyTest, "Check %#x, State=Ready\n", m_address);
305 } else {
306 m_status = TesterStatus_Idle;
305 } else {
306 m_status = TesterStatus_Idle;
307 DPRINTF(RubyTest, "Check %s, State=Idle store_count: %d\n",
307 DPRINTF(RubyTest, "Check %#x, State=Idle store_count: %d\n",
308 m_address, m_store_count);
309 }
310 DPRINTF(RubyTest, "Action callback return data now %d\n",
311 data->getByte(0));
312 } else if (m_status == TesterStatus_Check_Pending) {
313 DPRINTF(RubyTest, "Check callback\n");
314 // Perform load/check
315 for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) {
316 if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) {
308 m_address, m_store_count);
309 }
310 DPRINTF(RubyTest, "Action callback return data now %d\n",
311 data->getByte(0));
312 } else if (m_status == TesterStatus_Check_Pending) {
313 DPRINTF(RubyTest, "Check callback\n");
314 // Perform load/check
315 for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) {
316 if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) {
317 panic("Action/check failure: proc: %d address: %s data: %s "
317 panic("Action/check failure: proc: %d address: %#x data: %s "
318 "byte_number: %d m_value+byte_number: %d byte: %d %s"
319 "Time: %d\n",
320 proc, address, data, byte_number,
321 (int)m_value + byte_number,
322 (int)data->getByte(byte_number), *this, curTime);
323 }
324 }
325 DPRINTF(RubyTest, "Action/check success\n");
326 debugPrint();
327
328 // successful check complete, increment complete
329 m_tester_ptr->incrementCheckCompletions();
330
331 m_status = TesterStatus_Idle;
318 "byte_number: %d m_value+byte_number: %d byte: %d %s"
319 "Time: %d\n",
320 proc, address, data, byte_number,
321 (int)m_value + byte_number,
322 (int)data->getByte(byte_number), *this, curTime);
323 }
324 }
325 DPRINTF(RubyTest, "Action/check success\n");
326 debugPrint();
327
328 // successful check complete, increment complete
329 m_tester_ptr->incrementCheckCompletions();
330
331 m_status = TesterStatus_Idle;
332 DPRINTF(RubyTest, "Check %s, State=Idle\n", m_address);
332 DPRINTF(RubyTest, "Check %#x, State=Idle\n", m_address);
333 pickValue();
334
335 } else {
336 panic("Unexpected TesterStatus: %s proc: %d data: %s m_status: %s "
337 "time: %d\n", *this, proc, data, m_status, curTime);
338 }
339
340 DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc,
341 makeLineAddress(m_address));
342 DPRINTF(RubyTest, "Callback done\n");
343 debugPrint();
344}
345
346void
347Check::changeAddress(Addr address)
348{
349 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
350 m_status = TesterStatus_Idle;
351 m_address = address;
333 pickValue();
334
335 } else {
336 panic("Unexpected TesterStatus: %s proc: %d data: %s m_status: %s "
337 "time: %d\n", *this, proc, data, m_status, curTime);
338 }
339
340 DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc,
341 makeLineAddress(m_address));
342 DPRINTF(RubyTest, "Callback done\n");
343 debugPrint();
344}
345
346void
347Check::changeAddress(Addr address)
348{
349 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
350 m_status = TesterStatus_Idle;
351 m_address = address;
352 DPRINTF(RubyTest, "Check %s, State=Idle\n", m_address);
352 DPRINTF(RubyTest, "Check %#x, State=Idle\n", m_address);
353 m_store_count = 0;
354}
355
356void
357Check::pickValue()
358{
359 assert(m_status == TesterStatus_Idle);
360 m_value = random_mt.random(0, 0xff); // One byte
361 m_store_count = 0;
362}
363
364void
365Check::pickInitiatingNode()
366{
367 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
368 m_status = TesterStatus_Idle;
369 m_initiatingNode = (random_mt.random(0, m_num_writers - 1));
353 m_store_count = 0;
354}
355
356void
357Check::pickValue()
358{
359 assert(m_status == TesterStatus_Idle);
360 m_value = random_mt.random(0, 0xff); // One byte
361 m_store_count = 0;
362}
363
364void
365Check::pickInitiatingNode()
366{
367 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready);
368 m_status = TesterStatus_Idle;
369 m_initiatingNode = (random_mt.random(0, m_num_writers - 1));
370 DPRINTF(RubyTest, "Check %s, State=Idle, picked initiating node %d\n",
370 DPRINTF(RubyTest, "Check %#x, State=Idle, picked initiating node %d\n",
371 m_address, m_initiatingNode);
372 m_store_count = 0;
373}
374
375void
376Check::print(std::ostream& out) const
377{
378 out << "["

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

--- 16 unchanged lines hidden ---