gem5 v24.0.0.0
Loading...
Searching...
No Matches
clint.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Huawei International
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef __DEV_RISCV_CLINT_HH__
39#define __DEV_RISCV_CLINT_HH__
40
42#include "dev/intpin.hh"
43#include "dev/io_device.hh"
44#include "dev/mc146818.hh"
45#include "dev/reg_bank.hh"
46#include "mem/packet.hh"
47#include "mem/packet_access.hh"
48#include "params/Clint.hh"
49#include "sim/system.hh"
50
51namespace gem5
52{
53
54using namespace RiscvISA;
55
70class Clint : public BasicPioDevice
71{
72 // Params
73 protected:
77
78 public:
79 typedef ClintParams Params;
80 Clint(const Params &params);
81
82 // RTC Signal
83 public:
89 void raiseInterruptPin(int id);
90 void lowerInterruptPin(int id) {}
91
92 // Register bank
93 public:
94
124
126
127 uint32_t readMSIP(Register32& reg, const int thread_id);
128 void writeMSIP(Register32& reg, const uint32_t& data, const int thread_id);
129
130 // External API
131 public:
135 Tick read(PacketPtr pkt) override;
136 Tick write(PacketPtr pkt) override;
137
141 void init() override;
142 Port & getPort(const std::string &if_name,
143 PortID idx=InvalidPortID) override;
144 void serialize(CheckpointOut &cp) const override;
145 void unserialize(CheckpointIn &cp) override;
146
147};
148
149} // namespace gem5
150
151#endif // __DEV_RISCV_CLINT_HH__
const char data[]
MMIO Registers 0x0000 - 0x3FFF: msip (write-through to misc reg file) ...: reserved[0] 0x4000 - 0xBFF...
Definition clint.hh:104
ClintRegisters(const std::string &name, Addr base, Clint *clint)
Definition clint.hh:115
std::vector< Register64 > mtimecmp
Definition clint.hh:111
std::vector< RegisterRaz > reserved
Definition clint.hh:113
std::vector< Register32 > msip
Definition clint.hh:110
NOTE: This implementation of CLINT is based on the SiFive U54MC datasheet: https://sifive....
Definition clint.hh:71
void raiseInterruptPin(int id)
Timer tick callback.
Definition clint.cc:62
Clint(const Params &params)
Definition clint.cc:52
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition clint.cc:208
System * system
Definition clint.hh:74
void init() override
SimObject functions.
Definition clint.cc:201
int nThread
Definition clint.hh:75
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition clint.cc:187
ClintRegisters::Register32 Register32
Definition clint.hh:125
IntSinkPin< Clint > signal
Definition clint.hh:76
void lowerInterruptPin(int id)
Definition clint.hh:90
void writeMSIP(Register32 &reg, const uint32_t &data, const int thread_id)
Definition clint.cc:148
gem5::Clint::ClintRegisters registers
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition clint.cc:229
ClintParams Params
Definition clint.hh:79
Tick read(PacketPtr pkt) override
PioDevice interface functions.
Definition clint.cc:165
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition clint.cc:217
uint32_t readMSIP(Register32 &reg, const int thread_id)
Definition clint.cc:137
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Ports are used to interface objects to each other.
Definition port.hh:62
const std::string & name() const
Definition reg_bank.hh:1026
STL vector class.
Definition stl.hh:37
const Params & params() const
Bitfield< 5, 3 > reg
Definition types.hh:92
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
Declaration of the Packet class.

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