ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
RV32IMACFDArchSpecificImp.h
Go to the documentation of this file.
1
11#ifndef ETISS_RV32IMACFDArch_RV32IMACFDARCHSPECIFICIMP_H_
12#define ETISS_RV32IMACFDArch_RV32IMACFDARCHSPECIFICIMP_H_
13
14#include <cstdint>
15#include "etiss/Instruction.h"
16#include "etiss/VirtualStruct.h"
17#include "etiss/jit/CPU.h"
18#include "RV32IMACFD.h"
19#include "RV32IMACFDFuncs.h"
20
29{
30 private:
31 const unsigned gprid_;
32
33 public:
35 // clang-format off
36 : Field(
37 parent,
38 std::string("X") + etiss::toString(gprid),
39 std::string("X") + etiss::toString(gprid),
40 R|W,
41 4
42 ),
43 // clang-format on
44 gprid_(gprid)
45 {
46 }
47
48 RegField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
49 // clang-format off
50 : Field(
51 parent,
52 name,
53 name,
54 R|W,
55 4
56 ),
57 // clang-format on
58 gprid_(gprid)
59 {
60 }
61
63
64 protected:
65 virtual uint64_t _read(size_t offset) const
66 {
67 // clang-format off
68 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
70 // clang-format on
71 }
72
73 virtual void _write(uint64_t val, size_t offset)
74 {
75 // clang-format off
76 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
77 etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
79 // clang-format on
80 }
81};
82
84{
85 private:
86 const unsigned gprid_;
87
88 public:
90 // clang-format off
91 : Field(parent,
92 std::string("F")+etiss::toString(gprid),
93 std::string("F")+etiss::toString(gprid),
94 R|W,
95 8
96 ),
97 gprid_(gprid)
98 // clang-format on
99 {
100 }
101
102 FloatRegField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
103 // clang-format off
104 : Field(parent,
105 name,
106 name,
107 R|W,
108 8
109 ),
110 gprid_(gprid)
111 // clang-format on
112 {
113 }
114
116
117 protected:
118 virtual uint64_t _read(size_t offset) const
119 {
120 // clang-format off
121 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
122 return (uint64_t) *((RV32IMACFD*)parent_.structure_)->F[gprid_];
123 // clang-format on
124 }
125
126 virtual void _write(uint64_t val, size_t offset)
127 {
128 // clang-format off
129 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
130 etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
132 // clang-format on
133 }
134};
135
136
138{
139 private:
140 const unsigned gprid_;
141
142 public:
144 // clang-format off
145 : Field(parent,
146 std::string("CSR")+etiss::toString(gprid),
147 std::string("CSR")+etiss::toString(gprid),
148 R|W,
149 4
150 ),
151 gprid_(gprid)
152 // clang-format on
153 {
154 }
155
156 CSRField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
157 // clang-format off
158 : Field(parent,
159 name,
160 name,
161 R|W,
162 4
163 ),
164 gprid_(gprid)
165 // clang-format on
166 {
167 }
168
170
171 protected:
172 virtual uint64_t _read(size_t offset) const
173 {
174 // clang-format off
175 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
177 // clang-format on
178 }
179
180 virtual void _write(uint64_t val, size_t offset)
181 {
182 // clang-format off
183 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
184 etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
186 // clang-format on
187 }
188};
189
190
192{
193 public:
195 // clang-format off
196 : Field(
197 parent,
198 "instructionPointer",
199 "instructionPointer",
200 R|W,
201 4
202 )
203 // clang-format on
204 {
205 }
206
208
209 protected:
210 virtual uint64_t _read(size_t offset) const
211 {
212 // clang-format off
213 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
214 return (uint64_t) ((ETISS_CPU *)parent_.structure_)->instructionPointer;
215 // clang-format on
216 }
217
218 virtual void _write(uint64_t val, size_t offset)
219 {
220 // clang-format off
221 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
222 etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
223 ((ETISS_CPU *)parent_.structure_)->instructionPointer = (etiss_uint32) val;
224 // clang-format on
225 }
226};
227
228#endif
contains container classes to store instruction definitions + translation functions and build a trans...
void RV32IMACFD_csr_write(ETISS_CPU *const cpu, ETISS_System *const system, void *const *const plugin_pointers, etiss_uint32 csr, etiss_uint32 val)
etiss_uint32 RV32IMACFD_csr_read(ETISS_CPU *const cpu, ETISS_System *const system, void *const *const plugin_pointers, etiss_uint32 csr)
static __inline__ uint64_t
Definition arm_cde.h:31
uint64_t etiss_uint64
Definition types.h:58
uint32_t etiss_uint32
Definition types.h:55
virtual uint64_t _read(size_t offset) const
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
CSRField_RV32IMACFD(etiss::VirtualStruct &parent, unsigned gprid)
CSRField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
virtual void _write(uint64_t val, size_t offset)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
virtual uint64_t _read(size_t offset) const
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
virtual void _write(uint64_t val, size_t offset)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
FloatRegField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
FloatRegField_RV32IMACFD(etiss::VirtualStruct &parent, unsigned gprid)
Generated on Fri, 19 Jun 2026 11:48:00 +0000.
virtual uint64_t _read(size_t offset) const
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
RegField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
virtual void _write(uint64_t val, size_t offset)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
RegField_RV32IMACFD(etiss::VirtualStruct &parent, unsigned gprid)
a Field instance represents e.g.
static const int W
write flag
Field(VirtualStruct &parent, const std::string &name, const std::string &prettyname, int flags, size_t width, size_t bitwidth=0)
const std::string name_
name of the field.
VirtualStruct & parent_
reference to parent virtual struct
static const int R
read flag
const size_t bitwidth_
width in bits
abstract representation of an module of a simulation which could be a embedded device of the cpu of a...
pcField_RV32IMACFD(etiss::VirtualStruct &parent)
virtual void _write(uint64_t val, size_t offset)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
virtual uint64_t _read(size_t offset) const
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
forwards: include/jit/*
Definition Benchmark.h:17
@ VERBOSE
Definition Misc.h:88
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition Misc.cpp:94
STL namespace.
basic cpu state structure needed for execution of any cpu architecture.
Definition CPU.h:51
Generated on Fri, 19 Jun 2026 11:48:00 +0000.
Definition RV32IMACFD.h:17