gem5 v24.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PersistentTable.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __MEM_RUBY_STRUCTURES_PERSISTENTTABLE_HH__
30#define __MEM_RUBY_STRUCTURES_PERSISTENTTABLE_HH__
31
32#include <iostream>
33#include <unordered_map>
34
38#include "mem/ruby/protocol/AccessType.hh"
39
40namespace gem5
41{
42
43namespace ruby
44{
45
56
58{
59 public:
60 // Constructors
62
63 // Destructor
65
66 void
67 setBlockSize(int block_size)
68 {
69 m_block_size_bits = floorLog2(block_size);
70 }
71
72 // Public Methods
73 void persistentRequestLock(Addr address, MachineID locker,
74 AccessType type);
75 void persistentRequestUnlock(Addr address, MachineID unlocker);
76 bool okToIssueStarving(Addr address, MachineID machID) const;
77 MachineID findSmallest(Addr address) const;
78 AccessType typeOfSmallest(Addr address) const;
79 void markEntries(Addr address);
80 bool isLocked(Addr addr) const;
83
84 void print(std::ostream& out) const;
85
86 private:
87 // Private copy constructor and assignment operator
90
92
93 // Data Members (m_prefix)
94 typedef std::unordered_map<Addr, PersistentTableEntry> AddressMap;
96
97 Addr
102};
103
104inline std::ostream&
105operator<<(std::ostream& out, const PersistentTable& obj)
106{
107 obj.print(out);
108 out << std::flush;
109 return out;
110}
111
112inline std::ostream&
113operator<<(std::ostream& out, const PersistentTableEntry& obj)
114{
115 obj.print(out);
116 out << std::flush;
117 return out;
118}
119
120} // namespace ruby
121} // namespace gem5
122
123#endif // __MEM_RUBY_STRUCTURES_PERSISTENTTABLE_HH__
void print(std::ostream &out) const
void persistentRequestLock(Addr address, MachineID locker, AccessType type)
void persistentRequestUnlock(Addr address, MachineID unlocker)
PersistentTable(const PersistentTable &obj)
int countReadStarvingForAddress(Addr addr) const
AccessType typeOfSmallest(Addr address) const
MachineID findSmallest(Addr address) const
bool isLocked(Addr addr) const
std::unordered_map< Addr, PersistentTableEntry > AddressMap
bool okToIssueStarving(Addr address, MachineID machID) const
void print(std::ostream &out) const
int countStarvingForAddress(Addr addr) const
Addr makeLineAddress(Addr addr) const
void setBlockSize(int block_size)
PersistentTable & operator=(const PersistentTable &obj)
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
Definition intmath.hh:59
Bitfield< 3 > addr
Definition types.hh:84
Addr makeLineAddress(Addr addr, int cacheLineBits)
Definition Address.cc:61
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
std::ostream & operator<<(std::ostream &os, const BaseSemihosting::InPlaceArg &ipa)

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