Deleted Added
sdiff udiff text old ( 11025:4872dbdea907 ) new ( 11266:452e10b868ea )
full compact
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)) {
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
196 DPRINTF(RubyTest, "data 0x%x check 0x%x\n",
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;
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
235 if (m_tester_ptr->isInstReadableCpuPort(index)) {
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
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;
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;
294 } else {
295 m_status = TesterStatus_Idle;
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;
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;
338 m_store_count = 0;
339}
340
341void
342Check::pickValue()
343{
344 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));
356 DPRINTF(RubyTest, "picked initiating node %d\n", 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 ---