ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
RV32IMACFDArchSpecificImp.h
Go to the documentation of this file.
1 
11 #ifndef ETISS_RV32IMACFDArch_RV32IMACFDARCHSPECIFICIMP_H_
12 #define ETISS_RV32IMACFDArch_RV32IMACFDARCHSPECIFICIMP_H_
13 
22 private:
23  const unsigned gprid_;
24 public:
25  RegField_RV32IMACFD(etiss::VirtualStruct & parent,unsigned gprid)
26  : Field(parent,
27  std::string("X")+etiss::toString(gprid),
28  std::string("X")+etiss::toString(gprid),
29  R|W,
30  4
31  ),
32  gprid_(gprid)
33  {}
34 
35  RegField_RV32IMACFD(etiss::VirtualStruct & parent, std::string name, unsigned gprid)
36  : Field(parent,
37  name,
38  name,
39  R|W,
40  4
41  ),
42  gprid_(gprid)
43  {}
44 
46 
47 protected:
48  virtual uint64_t _read() const {
49  return (uint64_t) *((RV32IMACFD*)parent_.structure_)->X[gprid_];
50  }
51 
52  virtual void _write(uint64_t val) {
53  etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
55  }
56 };
57 
59 public:
61  : Field(parent,
62  "instructionPointer",
63  "instructionPointer",
64  R|W,
65  4
66  )
67  {}
68 
69  virtual ~pcField_RV32IMACFD(){}
70 
71 protected:
72  virtual uint64_t _read() const {
73  return (uint64_t) ((ETISS_CPU *)parent_.structure_)->instructionPointer;
74  }
75 
76  virtual void _write(uint64_t val) {
77  etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val);
78  ((ETISS_CPU *)parent_.structure_)->instructionPointer = (etiss_uint32) val;
79  }
80 };
81 
82 #endif
static __inline__ uint64_t
Definition: arm_cde.h:31
uint32_t etiss_uint32
Definition: types.h:93
Generated on Thu, 24 Oct 2024 10:16:12 +0200.
virtual void _write(uint64_t val)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
RegField_RV32IMACFD(etiss::VirtualStruct &parent, std::string name, unsigned gprid)
virtual uint64_t _read() const
override this function to implement reads 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
abstract representation of an module of a simulation which could be a embedded device of the cpu of a...
void *const structure_
virtual uint64_t _read() const
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
virtual void _write(uint64_t val)
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
pcField_RV32IMACFD(etiss::VirtualStruct &parent)
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53
std::string toString(const T &val)
conversion of type T to std::string.
Definition: Misc.h:174
@ VERBOSE
Definition: Misc.h:130
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition: Misc.cpp:125
basic cpu state structure needed for execution of any cpu architecture.
Definition: CPU.h:89
Generated on Thu, 24 Oct 2024 10:16:12 +0200.
Definition: RV32IMACFD.h:16