gem5 v24.0.0.0
Loading...
Searching...
No Matches
lupio_tmr.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 The Regents of the University of California
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 __DEV_LUPIO_LUPIO_TMR_HH__
30#define __DEV_LUPIO_LUPIO_TMR_HH__
31
33#include "dev/io_device.hh"
34#include "dev/platform.hh"
35#include "params/LupioTMR.hh"
36
37namespace gem5
38{
39
47{
48 private:
49 const ByteOrder byteOrder = ByteOrder::little;
53
54 // Register map
55 enum
56 {
61
62 // Max offset
64 };
65
67 {
68 Event *tmrEvent = nullptr;
69 uint64_t reload = 0;
70 bool ie = false; // Control
71 bool pd = false;
72 bool expired = false; // Status
74 };
75
77
82 uint64_t lupioTMRRead(const uint8_t addr, int size);
86 void lupioTMRWrite(const uint8_t addr, uint64_t val64, int size);
87
91 uint64_t lupioTMRCurrentTime();
95 void lupioTMRSet(int cpu);
99 void lupioTMRCallback(int cpu);
100
104 void updateIRQ(int level, int cpu);
105
106 public:
108 LupioTMR(const Params &params);
109 ~LupioTMR();
110
114 Tick read(PacketPtr pkt) override;
115 Tick write(PacketPtr pkt) override;
116};
117
118} // namespace gem5
119
120#endif // __DEV_LUPIO_LUPIO_TMR_HH_
LupioTMR: A virtual timer device which provides a real time counter, as well as a configurable timer ...
Definition lupio_tmr.hh:47
void updateIRQ(int level, int cpu)
Post or clear timer interrupts.
Definition lupio_tmr.cc:73
PARAMS(LupioTMR)
const ByteOrder byteOrder
Definition lupio_tmr.hh:49
std::vector< LupioTimer > timers
Definition lupio_tmr.hh:76
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition lupio_tmr.cc:214
void lupioTMRCallback(int cpu)
Process the timer's event.
Definition lupio_tmr.cc:107
uint64_t lupioTMRRead(const uint8_t addr, int size)
Function to return data pertaining to the timer, such as the simulated time in ticks.
Definition lupio_tmr.cc:122
System * system
Definition lupio_tmr.hh:50
LupioTMR(const Params &params)
Definition lupio_tmr.cc:46
void lupioTMRSet(int cpu)
Schedule the next timer event.
Definition lupio_tmr.cc:92
Tick read(PacketPtr pkt) override
Implement BasicPioDevice virtual functions.
Definition lupio_tmr.cc:198
uint64_t lupioTMRCurrentTime()
Return the simulated time.
Definition lupio_tmr.cc:86
void lupioTMRWrite(const uint8_t addr, uint64_t val64, int size)
Function to launch or stop the timer depending on the load value.
Definition lupio_tmr.cc:158
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
PioDeviceParams Params
Definition io_device.hh:134
STL vector class.
Definition stl.hh:37
const Params & params() const
Bitfield< 20 > level
Definition intmessage.hh:51
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58
Generic interface for platforms.

Generated on Tue Jun 18 2024 16:24:03 for gem5 by doxygen 1.11.0