gem5 v24.1.0.1
Loading...
Searching...
No Matches
SeriesRequestGenerator.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * Copyright (c) 2009-2010 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
31
32#include "base/trace.hh"
35#include "debug/DirectedTest.hh"
36
37namespace gem5
38{
39
42 m_addr_increment_size(p.addr_increment_size),
43 m_percent_writes(p.percent_writes)
44{
45 m_status = ruby::SeriesRequestGeneratorStatus_Thinking;
46 m_active_node = 0;
47 m_address = 0x0;
48}
49
53
54bool
56{
57 DPRINTF(DirectedTest, "initiating request\n");
58 assert(m_status == ruby::SeriesRequestGeneratorStatus_Thinking);
59
61
63
64 // For simplicity, requests are assumed to be 1 byte-sized
65 RequestPtr req = std::make_shared<Request>(m_address, 1, flags,
67
69 bool do_write = (rng->random(0, 100) < m_percent_writes);
70 if (do_write) {
71 cmd = MemCmd::WriteReq;
72 } else {
73 cmd = MemCmd::ReadReq;
74 }
75
76 PacketPtr pkt = new Packet(req, cmd);
77 pkt->allocate();
78
79 if (port->sendTimingReq(pkt)) {
80 DPRINTF(DirectedTest, "initiating request - successful\n");
81 m_status = ruby::SeriesRequestGeneratorStatus_Request_Pending;
82 return true;
83 } else {
84 // If the packet did not issue, must delete
85 // Note: No need to delete the data, the packet destructor
86 // will delete it
87 delete pkt;
88
89 DPRINTF(DirectedTest, "failed to initiate request - sequencer not ready\n");
90 return false;
91 }
92}
93
94void
96{
97 assert(m_active_node == proc);
98 assert(m_address == address);
99 assert(m_status == ruby::SeriesRequestGeneratorStatus_Request_Pending);
100
101 m_status = ruby::SeriesRequestGeneratorStatus_Thinking;
103 if (m_active_node == m_num_cpus) {
104 //
105 // Cycle of requests completed, increment cycle completions and restart
106 // at cpu zero
107 //
110 m_active_node = 0;
111 }
112}
113
114} // namespace gem5
#define DPRINTF(x,...)
Definition trace.hh:209
RubyDirectedTester * m_directed_tester
Command
List of all commands associated with a packet.
Definition packet.hh:85
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
void allocate()
Allocate memory for the packet.
Definition packet.hh:1367
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
Definition port.hh:603
RequestPort * getCpuPort(int idx)
ruby::SeriesRequestGeneratorStatus m_status
void performCallback(uint32_t proc, Addr address)
SeriesRequestGeneratorParams Params
uint8_t flags
Definition helpers.cc:87
Bitfield< 0 > p
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Mon Jan 13 2025 04:28:32 for gem5 by doxygen 1.9.8