gem5 v24.0.0.0
Loading...
Searching...
No Matches
InvalidateGenerator.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{
43 //
44 // First, issue loads to bring the block into S state
45 //
46 m_status = ruby::InvalidateGeneratorStatus_Load_Waiting;
49 m_address = 0x0;
50 m_addr_increment_size = p.addr_increment_size;
51}
52
56
57bool
59{
60 RequestPort* port;
62 PacketPtr pkt;
64
65 // For simplicity, requests are assumed to be 1 byte-sized
66 RequestPtr req = std::make_shared<Request>(m_address, 1, flags,
68
69 //
70 // Based on the current state, issue a load or a store
71 //
72 if (m_status == ruby::InvalidateGeneratorStatus_Load_Waiting) {
73 DPRINTF(DirectedTest, "initiating read\n");
74 cmd = MemCmd::ReadReq;
76 pkt = new Packet(req, cmd);
77 } else if (m_status == ruby::InvalidateGeneratorStatus_Inv_Waiting) {
78 DPRINTF(DirectedTest, "initiating invalidating write\n");
79 cmd = MemCmd::WriteReq;
81 pkt = new Packet(req, cmd);
82 } else {
83 panic("initiate was unexpectedly called\n");
84 }
85 pkt->allocate();
86
87 if (port->sendTimingReq(pkt)) {
88 DPRINTF(DirectedTest, "initiating request - successful\n");
89 if (m_status == ruby::InvalidateGeneratorStatus_Load_Waiting) {
90 m_status = ruby::InvalidateGeneratorStatus_Load_Pending;
91 } else {
92 m_status = ruby::InvalidateGeneratorStatus_Inv_Pending;
93 }
94 return true;
95 } else {
96 // If the packet did not issue, must delete
97 // Note: No need to delete the data, the packet destructor
98 // will delete it
99 delete pkt;
100
101 DPRINTF(DirectedTest, "failed to issue request - sequencer not ready\n");
102 return false;
103 }
104}
105
106void
108{
109 assert(m_address == address);
110
111 if (m_status == ruby::InvalidateGeneratorStatus_Load_Pending) {
112 assert(m_active_read_node == proc);
114 //
115 // Once all cpus have the block in S state, issue the invalidate
116 //
118 m_status = ruby::InvalidateGeneratorStatus_Inv_Waiting;
120 } else {
121 m_status = ruby::InvalidateGeneratorStatus_Load_Waiting;
122 }
123 } else if (m_status == ruby::InvalidateGeneratorStatus_Inv_Pending) {
124 assert(m_active_inv_node == proc);
129 }
130 //
131 // Invalidate completed, send that info to the tester and restart
132 // the cycle
133 //
135 m_status = ruby::InvalidateGeneratorStatus_Load_Waiting;
136 }
137
138}
139
140} // namespace gem5
#define DPRINTF(x,...)
Definition trace.hh:210
RubyDirectedTester * m_directed_tester
ruby::InvalidateGeneratorStatus m_status
InvalidateGeneratorParams Params
void performCallback(uint32_t proc, Addr address)
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)
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:188
uint8_t flags
Definition helpers.cc:87
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria 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 Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0