ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
PTEFormatBuilder.h
Go to the documentation of this file.
1 
45 #ifndef ETISS_INCLUDE_MM_PTEFORMATBUILDER_H_
46 #define ETISS_INCLUDE_MM_PTEFORMATBUILDER_H_
47 
48 #include <iostream>
49 #include <map>
50 #include <memory>
51 
52 #include "etiss/mm/PTEFormat.h"
53 
54 namespace etiss
55 {
56 namespace mm
57 {
58 
63 {
64  public:
69  {
70  static std::shared_ptr<PTEFormatBuilder> builder(new PTEFormatBuilder((PTEFormat::Instance())));
71  return *builder;
72  }
73 
78  {
79  format_.AddBitField("PPN", begin, end);
80  return *this;
81  }
82 
88  {
89  format_.AddBitField("PAGEOFFSET", begin, end);
90  return *this;
91  }
92 
96  PTEFormatBuilder &AddFlag(std::string name, uint32_t begin, uint32_t end)
97  {
98  format_.AddBitField(name, begin, end);
99  return *this;
100  }
101 
105  PTEFormatBuilder &AddFlag(std::string name, uint32_t pos)
106  {
107  format_.AddBitField(name, pos, pos);
108  return *this;
109  }
110 
111  private:
112  PTEFormatBuilder(PTEFormat &format) : format_(format) {}
113 
115 
116  friend class PTEFormat;
117 };
118 
119 } // namespace mm
120 } // namespace etiss
121 
122 #endif
static __inline__ uint32_t
Definition: arm_cde.h:25
Sigleton builder utility to build up customized PTE format.
PTEFormatBuilder & AddFlag(std::string name, uint32_t begin, uint32_t end)
Add optional bit field for protection flag in PTE.
PTEFormatBuilder & AddFlag(std::string name, uint32_t pos)
Add optional bit field for protection flag in PTE.
PTEFormatBuilder(PTEFormat &format)
PTEFormatBuilder & AddPageOffset(uint32_t begin, uint32_t end)
Add mandatory bit field for page size offset (Not included in PTE neither in PTE format)
PTEFormatBuilder & AddPPNBitField(uint32_t begin, uint32_t end)
Add mandatory bit field, Physical Page Number (PPN), for PTE.
static PTEFormatBuilder & Instance()
Get the singleton instance.
static PTEFormat & Instance()
Get the singleton instance.
Definition: PTEFormat.h:70
void AddBitField(std::string name, uint32_t begin, uint32_t end)
Called only by PTEFormatBuilder.
Definition: PTEFormat.cpp:57
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53