34 #define MAX_ADR_LENGTH 20U
36 #define PHYSADR_SP_LENGTH 10U
37 #define PHYSADR_LENGTH 20U
39 #define VIRTADR_SP_LENGTH 10U
40 #define VIRTADR_LENGTH 20U
42 #define TAG_SP_LENGTH (PHYSADR_SP_LENGTH - CFG_MMU_TLB_WAYS_LD)
43 #define TAG_LENGTH (PHYSADR_LENGTH - CFG_MMU_TLB_WAYS_LD)
45 #define CFG_MMU_TLB_CNTR_LENGTH (CFG_MMU_TLB_REPLACE_LRU ? (6 + CFG_MMU_SP_TLB_WAYS_LD) : (6 + CFG_MMU_TLB_WAYS_LD))
46 #define CFG_MMU_SP_TLB_CNTR_LENGTH (CFG_MMU_SP_TLB_REPLACE_LRU ? (6 + CFG_MMU_TLB_WAYS_LD) : (6 + CFG_MMU_SP_TLB_WAYS_LD))
48 #define CNTR_LENGTH MAX(CFG_MMU_TLB_CNTR_LENGTH, CFG_MMU_SP_TLB_CNTR_LENGTH)
71 sc_uint<20>
vpn () {
return (this->vpn1, this->vpn0); }
79 vpn1 = data.range (31, 22);
80 vpn0 = data.range (21, 12);
123 sc_uint<32>
page_frame() {
return (this->ppn1.range(9, 0), this->ppn0, sc_uint<12>(0)); }
125 sc_uint<32>
table_pointer() {
return (this->ppn1.range(9, 0), this->ppn0, sc_uint<12>(0)); }
127 operator sc_uint<32>()
129 return (
ppn1,
ppn0,
reserved_for_software,
d,
a,
g,
u,
x,
w,
r,
v);
139 ppn1 = data.range (31, 20);
140 ppn0 = data.range (19, 10);
161 os <<
"ppn1=" << t.
ppn1 <<
",ppn0=" << t.
ppn0
163 <<
"v=" << t.
v <<
",g=" << t.
g <<
"," <<
",d:" << t.
d <<
",a:" << t.
a <<
",g:" << t.
g
164 <<
",u:" << t.
u <<
",x:" << t.
x <<
",w:" << t.
w <<
",r:" << t.
r <<
",v:" << t.
v;
168 #ifndef __SYNTHESIS__
195 sc_out<bool> wb_cyc_o;
196 sc_out<bool> wb_stb_o;
197 sc_out<bool> wb_we_o;
198 sc_out<sc_uint<3> > wb_cti_o;
199 sc_out<sc_uint<2> > wb_bte_o;
201 sc_out<sc_uint<32> > wb_adr_o;
202 sc_out<sc_uint<CFG_MEMU_BUSIF_WIDTH> > wb_dat_o;
204 sc_in<bool> wb_ack_i;
205 sc_in<sc_uint<CFG_MEMU_BUSIF_WIDTH> > wb_dat_i;
209 sc_in<sc_uint<20> > memu_root_ppn;
212 sc_in<bool> busif_req;
213 sc_out<bool> busif_ack;
214 sc_in<sc_uint<32> > busif_virt_adr;
215 sc_out<sc_uint<32> > busif_phys_adr;
216 sc_out<bool> busif_ac_r;
217 sc_out<bool> busif_ac_w;
218 sc_out<bool> busif_ac_x;
219 sc_out<bool> busif_ac_u;
220 sc_out<bool> busif_ac_d;
221 sc_out<bool> busif_ac_a;
224 sc_out<bool> tlb_req, tlb_wr;
225 sc_out<sc_uint<20> > tlb_va_o;
226 sc_out<sc_uint<20> > tlb_pa_o;
227 sc_out<bool> tlb_superpage_o;
228 sc_out<bool> tlb_ac_r_o;
229 sc_out<bool> tlb_ac_w_o;
230 sc_out<bool> tlb_ac_x_o;
231 sc_out<bool> tlb_ac_u_o;
232 sc_out<bool> tlb_ac_d_o;
233 sc_out<bool> tlb_ac_a_o;
235 sc_in<bool> tlb_superpage_i;
236 sc_in<sc_uint<20> > tlb_adr_i;
238 sc_in<bool> tlb_miss;
240 sc_in<bool> tlb_ac_r_i;
241 sc_in<bool> tlb_ac_w_i;
242 sc_in<bool> tlb_ac_x_i;
243 sc_in<bool> tlb_ac_u_i;
244 sc_in<bool> tlb_ac_d_i;
245 sc_in<bool> tlb_ac_a_i;
247 SC_HAS_PROCESS(MPtw);
248 MPtw(sc_module_name name)
251 SC_METHOD(OutputMethod);
252 sensitive << pte << state << virtadr;
253 SC_METHOD(TransitionMethod);
254 sensitive <<
clk.pos ();
257 void Trace(sc_trace_file *
tf,
int level = 1);
261 void TransitionMethod();
263 sc_signal<sc_uint<32> > pte;
264 sc_signal<sc_uint<32> > virtadr;
265 sc_signal<sc_uint<4> > state;
267 sc_signal<int> state_trace;
Helpers, Makros and performance measuring Classes used in most ParaNut files.
sc_signal< bool > reset
Definition: dm_tb.cpp:54
sc_signal< bool > clk
Definition: dm_tb.cpp:54
#define CFG_MEMU_BUSIF_WIDTH
Busif Data Width.
Definition: paranut-config.h:228
#define C(MEMBER)
Convenient macro to compare a member variable with the member of input t.
Definition: base.h:158
#define PN_TRACE_R(TF, OBJ, MEMBER, STR)
Helper macro for recursively calling sc_trace in own types/structs.
Definition: base.h:255
Configuration Makros used in most ParaNut files.
EPtwState
Definition: ptw.h:51
@ MmuSuccessPage
Definition: ptw.h:62
@ MmuTlbLookup
Definition: ptw.h:53
@ MmuReqPte2
Definition: ptw.h:58
@ MmuValidate2
Definition: ptw.h:59
@ MmuTlbHit
Definition: ptw.h:54
@ MmuTlbHitSuperpage
Definition: ptw.h:55
@ MmuReqPte1
Definition: ptw.h:56
@ MmuSuccessSuperpage
Definition: ptw.h:61
@ MmuFault
Definition: ptw.h:60
@ MmuIdle
Definition: ptw.h:52
@ MmuValidate1
Definition: ptw.h:57
SPte operator=(const sc_uint< 32 > &data)
Definition: ptw.h:137
bool r
Definition: ptw.h:116
bool v
Definition: ptw.h:114
bool d
Definition: ptw.h:121
sc_uint< 20 > page_frame_number()
Definition: ptw.h:124
bool g
Definition: ptw.h:115
bool x
Definition: ptw.h:119
friend ostream & operator<<(ostream &os, const SPte &t)
Definition: ptw.h:159
sc_uint< 32 > table_pointer()
Definition: ptw.h:125
friend void sc_trace(sc_trace_file *tf, const SPte &t, const std::string &name)
Definition: ptw.h:170
bool is_misaligned_superpage()
Definition: ptw.h:133
sc_uint< 2 > reserved_for_software
Definition: ptw.h:113
sc_uint< 10 > ppn0
Definition: ptw.h:112
bool w
Definition: ptw.h:117
bool u
Definition: ptw.h:118
bool is_aligned_superpage()
Definition: ptw.h:134
bool operator==(const SPte &t) const
Definition: ptw.h:154
bool is_leaf_pte()
Definition: ptw.h:135
sc_uint< 12 > ppn1
Definition: ptw.h:111
bool a
Definition: ptw.h:120
sc_uint< 32 > page_frame()
Definition: ptw.h:123
bool is_invalid()
Definition: ptw.h:132
sc_uint< 12 > page_table_offset_vpn0()
Definition: ptw.h:74
sc_uint< 20 > vpn()
Definition: ptw.h:71
sc_uint< 10 > vpn0
Definition: ptw.h:68
sc_uint< 22 > superpage_offset()
Definition: ptw.h:72
sc_uint< 10 > vpn1
Definition: ptw.h:67
sc_uint< 12 > page_offset
Definition: ptw.h:69
friend ostream & operator<<(ostream &os, const SVirtAdr &t)
Definition: ptw.h:91
friend void sc_trace(sc_trace_file *tf, const SVirtAdr &t, const std::string &name)
Definition: ptw.h:99
bool operator==(const SVirtAdr &t) const
Definition: ptw.h:86
sc_uint< 12 > page_table_offset_vpn1()
Definition: ptw.h:73
SVirtAdr operator=(const sc_uint< 32 > &data)
Definition: ptw.h:77
sc_trace_file * tf
Definition: tlb_tb.cpp:94