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;
130 delete pkt->req;
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,
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);
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;
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,
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;
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 ---