Go to the documentation of this file.
41 #include "debug/Clint.hh"
44 #include "params/Clint.hh"
50 using namespace RiscvISA;
55 nThread(params.num_threads),
56 signal(params.
name +
".signal", 0, this),
57 registers(params.
name +
".registers", params.pio_addr, this)
68 for (
int context_id = 0; context_id <
nThread; context_id++) {
73 ISA* isa =
dynamic_cast<ISA*
>(tc->getIsaPtr());
74 if (isa->rvType() ==
RV32) {
83 if (mtime >= mtimecmp) {
84 if (mtime == mtimecmp) {
86 "MTIP posted - thread: %d, mtime: %d, mtimecmp: %d\n",
87 context_id, mtime, mtimecmp);
89 tc->getCpuPtr()->postInterrupt(tc->threadId(),
92 tc->getCpuPtr()->clearInterrupt(tc->threadId(),
101 using namespace std::placeholders;
105 reserved.emplace_back(
"reserved0", reserved0_size);
108 reserved.emplace_back(
"reserved1", reserved1_size);
122 msip[
i].reader(read_cb);
124 msip[
i].writer(write_cb);
154 DPRINTF(
Clint,
"MSIP posted - thread: %d\n", thread_id);
155 tc->getCpuPtr()->postInterrupt(tc->threadId(),
158 DPRINTF(
Clint,
"MSIP cleared - thread: %d\n", thread_id);
159 tc->getCpuPtr()->clearInterrupt(tc->threadId(),
170 "Read request - addr: %#x, size: %#x, atomic:%d\n",
190 "Write request - addr: %#x, size: %#x\n",
210 if (if_name ==
"int_pin")
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void addRegister(RegisterAdder reg)
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void writeMSIP(Register32 ®, const uint32_t &data, const int thread_id)
gem5::Clint::ClintRegisters registers
void unserialize(CheckpointIn &cp) override
Unserialize an object.
IntSinkPin< Clint > signal
const std::string to_string(sc_enc enc)
virtual void write(Addr addr, const void *buf, Addr bytes)
constexpr enums::RiscvType RV32
std::vector< RegisterRaz > reserved
void init() override
SimObject functions.
std::vector< Register64 > mtimecmp
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Clint(const Params ¶ms)
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
NOTE: This implementation of CLINT is based on the SiFive U54MC datasheet: https://sifive....
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
ClintRegisters::Register32 Register32
uint64_t Tick
Tick count type.
Tick read(PacketPtr pkt) override
PioDevice interface functions.
Tick pioDelay
Delay that the device experinces on an access.
void serialize(CheckpointOut &cp) const override
Serialize an object.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
MemCmd cmd
The command field of the packet.
const std::string & name()
virtual void read(Addr addr, void *buf, Addr bytes)
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
Ports are used to interface objects to each other.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
Addr pioSize
Size that the device's address range.
std::ostream CheckpointOut
uint32_t readMSIP(Register32 ®, const int thread_id)
void raiseInterruptPin(int id)
Timer tick callback.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::vector< Register32 > msip
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
T * getPtr()
get a pointer to the data ptr.
Generated on Sun Jul 30 2023 01:56:56 for gem5 by doxygen 1.8.17