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
137{
138 private:
139 const unsigned gprid_;
140
141 public:
143 // clang-format off
144 : Field(parent,
145 std::string("CSR")+etiss::toString(gprid),
146 std::string("CSR")+etiss::toString(gprid),
147 R|W,
148 4
149 ),
150 gprid_(gprid)
151 // clang-format on
152 {
153 }
154
155 CSRField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
156 // clang-format off
157 : Field(parent,
158 name,
159 name,
160 R|W,
161 4
162 ),
163 gprid_(gprid)
164 // clang-format on
165 {
166 }
167
169
170 protected:
171 virtual uint64_t _read(size_t offset) const
172 {
173 // clang-format off
174 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
176 // clang-format on
177 }
178
179 virtual void _write(uint64_t val, size_t offset)
180 {
181 // clang-format off
182 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
183 etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
185 // clang-format on
186 }
187};
188
190{
191 public:
193 // clang-format off
194 : Field(
195 parent,
196 "instructionPointer",
197 "instructionPointer",
198 R|W,
199 4
200 )
201 // clang-format on
202 {
203 }
204
206
207 protected:
208 virtual uint64_t _read(size_t offset) const
209 {
210 // clang-format off
211 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
212 return (uint64_t) ((ETISS_CPU *)parent_.structure_)->instructionPointer;
213 // clang-format on
214 }
215
216 virtual void _write(uint64_t val, size_t offset)
217 {
218 // clang-format off
219 assert((offset == 0 || (offset < (bitwidth_ / sizeof(uint64_t)))) && "Virtualstruct field offset out of range");
220 etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
221 ((ETISS_CPU *)parent_.structure_)->instructionPointer = (etiss_uint32) val;
222 // clang-format on
223 }
224};
225
226#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 Wed, 28 Oct 2026 07:21:01 +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 Wed, 28 Oct 2026 07:21:01 +0000.
Definition RV32IMACFD.h:17