gem5 v24.1.0.1
Loading...
Searching...
No Matches
TimerTable.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_TIMERTABLE_HH__
30#define __MEM_RUBY_STRUCTURES_TIMERTABLE_HH__
31
32#include <cassert>
33#include <iostream>
34#include <map>
35#include <string>
36
39
40namespace gem5
41{
42
43namespace ruby
44{
45
47{
48 public:
49 TimerTable();
50
51 void
52 setBlockSize(int block_size)
53 {
54 m_block_size_bits = floorLog2(block_size);
55 }
56
57 void
58 setConsumer(Consumer* consumer_ptr)
59 {
60 assert(m_consumer_ptr == NULL);
61 m_consumer_ptr = consumer_ptr;
62 }
63
64 void
65 setDescription(const std::string& name)
66 {
67 m_name = name;
68 }
69
70 bool isReady(Tick curTime) const;
71 Addr nextAddress() const;
72 bool isSet(Addr address) const { return !!m_map.count(address); }
73 void set(Addr address, Tick ready_time);
74 void unset(Addr address);
75 void print(std::ostream& out) const;
76
77 private:
78 void updateNext() const;
79
80 // Private copy constructor and assignment operator
83
84 // Data Members (m_prefix)
85
86 // use a std::map for the address map as this container is sorted
87 // and ensures a well-defined iteration order
88 typedef std::map<Addr, Tick> AddressMap;
90 mutable bool m_next_valid;
91 mutable Tick m_next_time; // Only valid if m_next_valid is true
92 mutable Addr m_next_address; // Only valid if m_next_valid is true
93
96
98
99 std::string m_name;
100};
101
102inline std::ostream&
103operator<<(std::ostream& out, const TimerTable& obj)
104{
105 obj.print(out);
106 out << std::flush;
107 return out;
108}
109
110} // namespace ruby
111} // namespace gem5
112
113#endif // __MEM_RUBY_STRUCTURES_TIMERTABLE_HH__
Consumer * m_consumer_ptr
Consumer to signal a wakeup()
Definition TimerTable.hh:95
TimerTable(const TimerTable &obj)
bool isReady(Tick curTime) const
Definition TimerTable.cc:48
bool isSet(Addr address) const
Definition TimerTable.hh:72
TimerTable & operator=(const TimerTable &obj)
void setBlockSize(int block_size)
Definition TimerTable.hh:52
void unset(Addr address)
Definition TimerTable.cc:88
void print(std::ostream &out) const
void setDescription(const std::string &name)
Definition TimerTable.hh:65
Addr nextAddress() const
Definition TimerTable.cc:61
void updateNext() const
std::map< Addr, Tick > AddressMap
Definition TimerTable.hh:88
void setConsumer(Consumer *consumer_ptr)
Definition TimerTable.hh:58
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
Definition intmath.hh:59
Bitfield< 12, 11 > set
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
uint64_t Tick
Tick count type.
Definition types.hh:58
std::ostream & operator<<(std::ostream &os, const BaseSemihosting::InPlaceArg &ipa)
const std::string & name()
Definition trace.cc:48

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