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 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29
| 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 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29
|
| 30#include "base/random.hh"
|
30#include "cpu/testers/rubytest/Check.hh" 31#include "debug/RubyTest.hh" 32#include "mem/ruby/common/SubBlock.hh" 33#include "mem/ruby/system/Sequencer.hh" 34#include "mem/ruby/system/System.hh" 35 36typedef RubyTester::SenderState SenderState; 37 38Check::Check(const Address& address, const Address& pc, 39 int _num_writers, int _num_readers, RubyTester* _tester) 40 : m_num_writers(_num_writers), m_num_readers(_num_readers), 41 m_tester_ptr(_tester) 42{ 43 m_status = TesterStatus_Idle; 44 45 pickValue(); 46 pickInitiatingNode(); 47 changeAddress(address); 48 m_pc = pc;
| 31#include "cpu/testers/rubytest/Check.hh" 32#include "debug/RubyTest.hh" 33#include "mem/ruby/common/SubBlock.hh" 34#include "mem/ruby/system/Sequencer.hh" 35#include "mem/ruby/system/System.hh" 36 37typedef RubyTester::SenderState SenderState; 38 39Check::Check(const Address& address, const Address& pc, 40 int _num_writers, int _num_readers, RubyTester* _tester) 41 : m_num_writers(_num_writers), m_num_readers(_num_readers), 42 m_tester_ptr(_tester) 43{ 44 m_status = TesterStatus_Idle; 45 46 pickValue(); 47 pickInitiatingNode(); 48 changeAddress(address); 49 m_pc = pc;
|
49 m_access_mode = RubyAccessMode(random() % RubyAccessMode_NUM);
| 50 m_access_mode = RubyAccessMode(random_mt.random(0, 51 RubyAccessMode_NUM - 1));
|
50 m_store_count = 0; 51} 52 53void 54Check::initiate() 55{ 56 DPRINTF(RubyTest, "initiating\n"); 57 debugPrint(); 58 59 // currently no protocols support prefetches
| 52 m_store_count = 0; 53} 54 55void 56Check::initiate() 57{ 58 DPRINTF(RubyTest, "initiating\n"); 59 debugPrint(); 60 61 // currently no protocols support prefetches
|
60 if (false && (random() & 0xf) == 0) {
| 62 if (false && (random_mt.random(0, 0xf) == 0)) {
|
61 initiatePrefetch(); // Prefetch from random processor 62 } 63
| 63 initiatePrefetch(); // Prefetch from random processor 64 } 65
|
64 if (m_tester_ptr->getCheckFlush() && (random() & 0xff) == 0) {
| 66 if (m_tester_ptr->getCheckFlush() && (random_mt.random(0, 0xff) == 0)) {
|
65 initiateFlush(); // issue a Flush request from random processor 66 } 67 68 if (m_status == TesterStatus_Idle) { 69 initiateAction(); 70 } else if (m_status == TesterStatus_Ready) { 71 initiateCheck(); 72 } else { 73 // Pending - do nothing 74 DPRINTF(RubyTest, 75 "initiating action/check - failed: action/check is pending\n"); 76 } 77} 78 79void 80Check::initiatePrefetch() 81{ 82 DPRINTF(RubyTest, "initiating prefetch\n"); 83
| 67 initiateFlush(); // issue a Flush request from random processor 68 } 69 70 if (m_status == TesterStatus_Idle) { 71 initiateAction(); 72 } else if (m_status == TesterStatus_Ready) { 73 initiateCheck(); 74 } else { 75 // Pending - do nothing 76 DPRINTF(RubyTest, 77 "initiating action/check - failed: action/check is pending\n"); 78 } 79} 80 81void 82Check::initiatePrefetch() 83{ 84 DPRINTF(RubyTest, "initiating prefetch\n"); 85
|
84 int index = random() % m_num_readers;
| 86 int index = random_mt.random(0, m_num_readers - 1);
|
85 MasterPort* port = m_tester_ptr->getReadableCpuPort(index); 86 87 Request::Flags flags; 88 flags.set(Request::PREFETCH); 89 90 Packet::Command cmd; 91 92 // 1 in 8 chance this will be an exclusive prefetch
| 87 MasterPort* port = m_tester_ptr->getReadableCpuPort(index); 88 89 Request::Flags flags; 90 flags.set(Request::PREFETCH); 91 92 Packet::Command cmd; 93 94 // 1 in 8 chance this will be an exclusive prefetch
|
93 if ((random() & 0x7) != 0) {
| 95 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)) { 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 106 Request *req = new Request(m_address.getAddress(), 0, flags, 107 m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); 108 req->setThreadContext(index, 0); 109 110 PacketPtr pkt = new Packet(req, cmd); 111 112 // push the subblock onto the sender state. The sequencer will 113 // update the subblock on the return 114 pkt->senderState = new SenderState(m_address, req->getSize()); 115 116 if (port->sendTimingReq(pkt)) { 117 DPRINTF(RubyTest, "successfully initiated prefetch.\n"); 118 } else { 119 // If the packet did not issue, must delete 120 delete pkt->senderState; 121 delete pkt->req; 122 delete pkt; 123 124 DPRINTF(RubyTest, 125 "prefetch initiation failed because Port was busy.\n"); 126 } 127} 128 129void 130Check::initiateFlush() 131{ 132 133 DPRINTF(RubyTest, "initiating Flush\n"); 134
| 96 cmd = MemCmd::ReadReq; 97 98 // if necessary, make the request an instruction fetch 99 if (m_tester_ptr->isInstReadableCpuPort(index)) { 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 108 Request *req = new Request(m_address.getAddress(), 0, flags, 109 m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); 110 req->setThreadContext(index, 0); 111 112 PacketPtr pkt = new Packet(req, cmd); 113 114 // push the subblock onto the sender state. The sequencer will 115 // update the subblock on the return 116 pkt->senderState = new SenderState(m_address, req->getSize()); 117 118 if (port->sendTimingReq(pkt)) { 119 DPRINTF(RubyTest, "successfully initiated prefetch.\n"); 120 } else { 121 // If the packet did not issue, must delete 122 delete pkt->senderState; 123 delete pkt->req; 124 delete pkt; 125 126 DPRINTF(RubyTest, 127 "prefetch initiation failed because Port was busy.\n"); 128 } 129} 130 131void 132Check::initiateFlush() 133{ 134 135 DPRINTF(RubyTest, "initiating Flush\n"); 136
|
135 int index = random() % m_num_writers;
| 137 int index = random_mt.random(0, m_num_writers - 1);
|
136 MasterPort* port = m_tester_ptr->getWritableCpuPort(index); 137 138 Request::Flags flags; 139 140 Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, 141 m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); 142 143 Packet::Command cmd; 144 145 cmd = MemCmd::FlushReq; 146 147 PacketPtr pkt = new Packet(req, cmd); 148 149 // push the subblock onto the sender state. The sequencer will 150 // update the subblock on the return 151 pkt->senderState = new SenderState(m_address, req->getSize()); 152 153 if (port->sendTimingReq(pkt)) { 154 DPRINTF(RubyTest, "initiating Flush - successful\n"); 155 } 156} 157 158void 159Check::initiateAction() 160{ 161 DPRINTF(RubyTest, "initiating Action\n"); 162 assert(m_status == TesterStatus_Idle); 163
| 138 MasterPort* port = m_tester_ptr->getWritableCpuPort(index); 139 140 Request::Flags flags; 141 142 Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, 143 m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); 144 145 Packet::Command cmd; 146 147 cmd = MemCmd::FlushReq; 148 149 PacketPtr pkt = new Packet(req, cmd); 150 151 // push the subblock onto the sender state. The sequencer will 152 // update the subblock on the return 153 pkt->senderState = new SenderState(m_address, req->getSize()); 154 155 if (port->sendTimingReq(pkt)) { 156 DPRINTF(RubyTest, "initiating Flush - successful\n"); 157 } 158} 159 160void 161Check::initiateAction() 162{ 163 DPRINTF(RubyTest, "initiating Action\n"); 164 assert(m_status == TesterStatus_Idle); 165
|
164 int index = random() % m_num_writers;
| 166 int index = random_mt.random(0, m_num_writers - 1);
|
165 MasterPort* port = m_tester_ptr->getWritableCpuPort(index); 166 167 Request::Flags flags; 168 169 // Create the particular address for the next byte to be written 170 Address writeAddr(m_address.getAddress() + m_store_count); 171 172 // Stores are assumed to be 1 byte-sized 173 Request *req = new Request(writeAddr.getAddress(), 1, flags, 174 m_tester_ptr->masterId(), curTick(), 175 m_pc.getAddress()); 176 177 req->setThreadContext(index, 0); 178 Packet::Command cmd; 179 180 // 1 out of 8 chance, issue an atomic rather than a write 181 // if ((random() & 0x7) == 0) { 182 // cmd = MemCmd::SwapReq; 183 // } else { 184 cmd = MemCmd::WriteReq; 185 // } 186 187 PacketPtr pkt = new Packet(req, cmd); 188 uint8_t *writeData = new uint8_t; 189 *writeData = m_value + m_store_count; 190 pkt->dataDynamic(writeData); 191 192 DPRINTF(RubyTest, "data 0x%x check 0x%x\n", 193 *(pkt->getPtr<uint8_t>()), *writeData); 194 195 // push the subblock onto the sender state. The sequencer will 196 // update the subblock on the return 197 pkt->senderState = new SenderState(writeAddr, req->getSize()); 198 199 if (port->sendTimingReq(pkt)) { 200 DPRINTF(RubyTest, "initiating action - successful\n"); 201 DPRINTF(RubyTest, "status before action update: %s\n", 202 (TesterStatus_to_string(m_status)).c_str()); 203 m_status = TesterStatus_Action_Pending; 204 } else { 205 // If the packet did not issue, must delete 206 // Note: No need to delete the data, the packet destructor 207 // will delete it 208 delete pkt->senderState; 209 delete pkt->req; 210 delete pkt; 211 212 DPRINTF(RubyTest, "failed to initiate action - sequencer not ready\n"); 213 } 214 215 DPRINTF(RubyTest, "status after action update: %s\n", 216 (TesterStatus_to_string(m_status)).c_str()); 217} 218 219void 220Check::initiateCheck() 221{ 222 DPRINTF(RubyTest, "Initiating Check\n"); 223 assert(m_status == TesterStatus_Ready); 224
| 167 MasterPort* port = m_tester_ptr->getWritableCpuPort(index); 168 169 Request::Flags flags; 170 171 // Create the particular address for the next byte to be written 172 Address writeAddr(m_address.getAddress() + m_store_count); 173 174 // Stores are assumed to be 1 byte-sized 175 Request *req = new Request(writeAddr.getAddress(), 1, flags, 176 m_tester_ptr->masterId(), curTick(), 177 m_pc.getAddress()); 178 179 req->setThreadContext(index, 0); 180 Packet::Command cmd; 181 182 // 1 out of 8 chance, issue an atomic rather than a write 183 // if ((random() & 0x7) == 0) { 184 // cmd = MemCmd::SwapReq; 185 // } else { 186 cmd = MemCmd::WriteReq; 187 // } 188 189 PacketPtr pkt = new Packet(req, cmd); 190 uint8_t *writeData = new uint8_t; 191 *writeData = m_value + m_store_count; 192 pkt->dataDynamic(writeData); 193 194 DPRINTF(RubyTest, "data 0x%x check 0x%x\n", 195 *(pkt->getPtr<uint8_t>()), *writeData); 196 197 // push the subblock onto the sender state. The sequencer will 198 // update the subblock on the return 199 pkt->senderState = new SenderState(writeAddr, req->getSize()); 200 201 if (port->sendTimingReq(pkt)) { 202 DPRINTF(RubyTest, "initiating action - successful\n"); 203 DPRINTF(RubyTest, "status before action update: %s\n", 204 (TesterStatus_to_string(m_status)).c_str()); 205 m_status = TesterStatus_Action_Pending; 206 } else { 207 // If the packet did not issue, must delete 208 // Note: No need to delete the data, the packet destructor 209 // will delete it 210 delete pkt->senderState; 211 delete pkt->req; 212 delete pkt; 213 214 DPRINTF(RubyTest, "failed to initiate action - sequencer not ready\n"); 215 } 216 217 DPRINTF(RubyTest, "status after action update: %s\n", 218 (TesterStatus_to_string(m_status)).c_str()); 219} 220 221void 222Check::initiateCheck() 223{ 224 DPRINTF(RubyTest, "Initiating Check\n"); 225 assert(m_status == TesterStatus_Ready); 226
|
225 int index = random() % m_num_readers;
| 227 int index = random_mt.random(0, m_num_readers - 1);
|
226 MasterPort* port = m_tester_ptr->getReadableCpuPort(index); 227 228 Request::Flags flags; 229 230 // If necessary, make the request an instruction fetch 231 if (m_tester_ptr->isInstReadableCpuPort(index)) { 232 flags.set(Request::INST_FETCH); 233 } 234 235 // Checks are sized depending on the number of bytes written 236 Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, 237 m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); 238 239 req->setThreadContext(index, 0); 240 PacketPtr pkt = new Packet(req, MemCmd::ReadReq); 241 uint8_t *dataArray = new uint8_t[CHECK_SIZE]; 242 pkt->dataDynamicArray(dataArray); 243 244 // push the subblock onto the sender state. The sequencer will 245 // update the subblock on the return 246 pkt->senderState = new SenderState(m_address, req->getSize()); 247 248 if (port->sendTimingReq(pkt)) { 249 DPRINTF(RubyTest, "initiating check - successful\n"); 250 DPRINTF(RubyTest, "status before check update: %s\n", 251 TesterStatus_to_string(m_status).c_str()); 252 m_status = TesterStatus_Check_Pending; 253 } else { 254 // If the packet did not issue, must delete 255 // Note: No need to delete the data, the packet destructor 256 // will delete it 257 delete pkt->senderState; 258 delete pkt->req; 259 delete pkt; 260 261 DPRINTF(RubyTest, "failed to initiate check - cpu port not ready\n"); 262 } 263 264 DPRINTF(RubyTest, "status after check update: %s\n", 265 TesterStatus_to_string(m_status).c_str()); 266} 267 268void 269Check::performCallback(NodeID proc, SubBlock* data, Cycles curTime) 270{ 271 Address address = data->getAddress(); 272 273 // This isn't exactly right since we now have multi-byte checks 274 // assert(getAddress() == address); 275 276 assert(getAddress().getLineAddress() == address.getLineAddress()); 277 assert(data != NULL); 278 279 DPRINTF(RubyTest, "RubyTester Callback\n"); 280 debugPrint(); 281 282 if (m_status == TesterStatus_Action_Pending) { 283 DPRINTF(RubyTest, "Action callback write value: %d, currently %d\n", 284 (m_value + m_store_count), data->getByte(0)); 285 // Perform store one byte at a time 286 data->setByte(0, (m_value + m_store_count)); 287 m_store_count++; 288 if (m_store_count == CHECK_SIZE) { 289 m_status = TesterStatus_Ready; 290 } else { 291 m_status = TesterStatus_Idle; 292 } 293 DPRINTF(RubyTest, "Action callback return data now %d\n", 294 data->getByte(0)); 295 } else if (m_status == TesterStatus_Check_Pending) { 296 DPRINTF(RubyTest, "Check callback\n"); 297 // Perform load/check 298 for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) { 299 if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) { 300 panic("Action/check failure: proc: %d address: %s data: %s " 301 "byte_number: %d m_value+byte_number: %d byte: %d %s" 302 "Time: %d\n", 303 proc, address, data, byte_number, 304 (int)m_value + byte_number, 305 (int)data->getByte(byte_number), *this, curTime); 306 } 307 } 308 DPRINTF(RubyTest, "Action/check success\n"); 309 debugPrint(); 310 311 // successful check complete, increment complete 312 m_tester_ptr->incrementCheckCompletions(); 313 314 m_status = TesterStatus_Idle; 315 pickValue(); 316 317 } else { 318 panic("Unexpected TesterStatus: %s proc: %d data: %s m_status: %s " 319 "time: %d\n", *this, proc, data, m_status, curTime); 320 } 321 322 DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc, 323 getAddress().getLineAddress()); 324 DPRINTF(RubyTest, "Callback done\n"); 325 debugPrint(); 326} 327 328void 329Check::changeAddress(const Address& address) 330{ 331 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready); 332 m_status = TesterStatus_Idle; 333 m_address = address; 334 m_store_count = 0; 335} 336 337void 338Check::pickValue() 339{ 340 assert(m_status == TesterStatus_Idle); 341 m_status = TesterStatus_Idle;
| 228 MasterPort* port = m_tester_ptr->getReadableCpuPort(index); 229 230 Request::Flags flags; 231 232 // If necessary, make the request an instruction fetch 233 if (m_tester_ptr->isInstReadableCpuPort(index)) { 234 flags.set(Request::INST_FETCH); 235 } 236 237 // Checks are sized depending on the number of bytes written 238 Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, 239 m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); 240 241 req->setThreadContext(index, 0); 242 PacketPtr pkt = new Packet(req, MemCmd::ReadReq); 243 uint8_t *dataArray = new uint8_t[CHECK_SIZE]; 244 pkt->dataDynamicArray(dataArray); 245 246 // push the subblock onto the sender state. The sequencer will 247 // update the subblock on the return 248 pkt->senderState = new SenderState(m_address, req->getSize()); 249 250 if (port->sendTimingReq(pkt)) { 251 DPRINTF(RubyTest, "initiating check - successful\n"); 252 DPRINTF(RubyTest, "status before check update: %s\n", 253 TesterStatus_to_string(m_status).c_str()); 254 m_status = TesterStatus_Check_Pending; 255 } else { 256 // If the packet did not issue, must delete 257 // Note: No need to delete the data, the packet destructor 258 // will delete it 259 delete pkt->senderState; 260 delete pkt->req; 261 delete pkt; 262 263 DPRINTF(RubyTest, "failed to initiate check - cpu port not ready\n"); 264 } 265 266 DPRINTF(RubyTest, "status after check update: %s\n", 267 TesterStatus_to_string(m_status).c_str()); 268} 269 270void 271Check::performCallback(NodeID proc, SubBlock* data, Cycles curTime) 272{ 273 Address address = data->getAddress(); 274 275 // This isn't exactly right since we now have multi-byte checks 276 // assert(getAddress() == address); 277 278 assert(getAddress().getLineAddress() == address.getLineAddress()); 279 assert(data != NULL); 280 281 DPRINTF(RubyTest, "RubyTester Callback\n"); 282 debugPrint(); 283 284 if (m_status == TesterStatus_Action_Pending) { 285 DPRINTF(RubyTest, "Action callback write value: %d, currently %d\n", 286 (m_value + m_store_count), data->getByte(0)); 287 // Perform store one byte at a time 288 data->setByte(0, (m_value + m_store_count)); 289 m_store_count++; 290 if (m_store_count == CHECK_SIZE) { 291 m_status = TesterStatus_Ready; 292 } else { 293 m_status = TesterStatus_Idle; 294 } 295 DPRINTF(RubyTest, "Action callback return data now %d\n", 296 data->getByte(0)); 297 } else if (m_status == TesterStatus_Check_Pending) { 298 DPRINTF(RubyTest, "Check callback\n"); 299 // Perform load/check 300 for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) { 301 if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) { 302 panic("Action/check failure: proc: %d address: %s data: %s " 303 "byte_number: %d m_value+byte_number: %d byte: %d %s" 304 "Time: %d\n", 305 proc, address, data, byte_number, 306 (int)m_value + byte_number, 307 (int)data->getByte(byte_number), *this, curTime); 308 } 309 } 310 DPRINTF(RubyTest, "Action/check success\n"); 311 debugPrint(); 312 313 // successful check complete, increment complete 314 m_tester_ptr->incrementCheckCompletions(); 315 316 m_status = TesterStatus_Idle; 317 pickValue(); 318 319 } else { 320 panic("Unexpected TesterStatus: %s proc: %d data: %s m_status: %s " 321 "time: %d\n", *this, proc, data, m_status, curTime); 322 } 323 324 DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc, 325 getAddress().getLineAddress()); 326 DPRINTF(RubyTest, "Callback done\n"); 327 debugPrint(); 328} 329 330void 331Check::changeAddress(const Address& address) 332{ 333 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready); 334 m_status = TesterStatus_Idle; 335 m_address = address; 336 m_store_count = 0; 337} 338 339void 340Check::pickValue() 341{ 342 assert(m_status == TesterStatus_Idle); 343 m_status = TesterStatus_Idle;
|
342 m_value = random() & 0xff; // One byte
| 344 m_value = random_mt.random(0, 0xff); // One byte
|
343 m_store_count = 0; 344} 345 346void 347Check::pickInitiatingNode() 348{ 349 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready); 350 m_status = TesterStatus_Idle;
| 345 m_store_count = 0; 346} 347 348void 349Check::pickInitiatingNode() 350{ 351 assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready); 352 m_status = TesterStatus_Idle;
|
351 m_initiatingNode = (random() % m_num_writers);
| 353 m_initiatingNode = (random_mt.random(0, m_num_writers - 1));
|
352 DPRINTF(RubyTest, "picked initiating node %d\n", m_initiatingNode); 353 m_store_count = 0; 354} 355 356void 357Check::print(std::ostream& out) const 358{ 359 out << "[" 360 << m_address << ", value: " 361 << (int)m_value << ", status: " 362 << m_status << ", initiating node: " 363 << m_initiatingNode << ", store_count: " 364 << m_store_count 365 << "]" << std::flush; 366} 367 368void 369Check::debugPrint() 370{ 371 DPRINTF(RubyTest, 372 "[%#x, value: %d, status: %s, initiating node: %d, store_count: %d]\n", 373 m_address.getAddress(), (int)m_value, 374 TesterStatus_to_string(m_status).c_str(), 375 m_initiatingNode, m_store_count); 376}
| 354 DPRINTF(RubyTest, "picked initiating node %d\n", m_initiatingNode); 355 m_store_count = 0; 356} 357 358void 359Check::print(std::ostream& out) const 360{ 361 out << "[" 362 << m_address << ", value: " 363 << (int)m_value << ", status: " 364 << m_status << ", initiating node: " 365 << m_initiatingNode << ", store_count: " 366 << m_store_count 367 << "]" << std::flush; 368} 369 370void 371Check::debugPrint() 372{ 373 DPRINTF(RubyTest, 374 "[%#x, value: %d, status: %s, initiating node: %d, store_count: %d]\n", 375 m_address.getAddress(), (int)m_value, 376 TesterStatus_to_string(m_status).c_str(), 377 m_initiatingNode, m_store_count); 378}
|