@@ -132,8 +132,8 @@ class MMUInterface(parameter: MMUParameter) extends Bundle {
132132@ instantiable
133133class MMU (val parameter : MMUParameter ) extends Module with SerializableModule [MMUParameter ] {
134134 val io = FlatIO (new MMUInterface (parameter))
135- if (parameter.enableDifftest){
136- io.out.bits.bits.tlbIndex.get := DontCare
135+ if (parameter.enableDifftest) {
136+ io.out.bits.bits.tlbIndex.get := DontCare
137137 io.out.bits.bits.csrEstate.get := DontCare
138138 }
139139
@@ -332,10 +332,10 @@ class MMU(val parameter: MMUParameter) extends Module with SerializableModule[MM
332332 io.in.bits.bits.func === TlbOp .Write .asUInt && io.in.bits.bits.exception.ecodes === ECodes .NONE ) {
333333 // [文档]执行 TLBWR 时,页表项写入 TLB 的位置是由 CSR.TLBIDX 的 Index 域的值指定的。
334334 tlbMem.writePorts(0 ).address := io.tlbidxIndexR
335- if (parameter.enableDifftest){
335+ if (parameter.enableDifftest) {
336336 io.out.bits.bits.tlbIndex.get := io.tlbidxIndexR
337337 }
338- tlbMem.writePorts(0 ).enable := true .B
338+ tlbMem.writePorts(0 ).enable := true .B
339339 // [文档]TLBWR 指令将 TLB 相关 CSR 中所存放的页表项信息写入到 TLB 的指定项。被填入的页表项信息来自于 CSR.TLBEHI、CSR.TLBELO0、CSR.TLBELO1 和 CSR.TLBIDX.PS。
340340 val tlbEntry = Wire (new TLBEntry )
341341 tlbEntry.vppn := io.tlbehiR(31 , 13 )
@@ -363,10 +363,10 @@ class MMU(val parameter: MMUParameter) extends Module with SerializableModule[MM
363363 io.in.bits.bits.func === TlbOp .Fill .asUInt && io.in.bits.bits.exception.ecodes === ECodes .NONE ) {
364364 // [文档]执行 TLBFILL 时,页表项被填入到 TLB 的哪一项,是由硬件随机选择的。
365365 tlbMem.writePorts(0 ).address := ramdom
366- if (parameter.enableDifftest){
366+ if (parameter.enableDifftest) {
367367 io.out.bits.bits.tlbIndex.get := ramdom
368368 }
369- tlbMem.writePorts(0 ).enable := true .B
369+ tlbMem.writePorts(0 ).enable := true .B
370370 // [文档]TLBWR 指令将 TLB 相关 CSR 中所存放的页表项信息写入到 TLB 的指定项。被填入的页表项信息来自于 CSR.TLBEHI、CSR.TLBELO0、CSR.TLBELO1 和 CSR.TLBIDX.PS。
371371 val tlbEntry = Wire (new TLBEntry )
372372 tlbEntry.vppn := io.tlbehiR(31 , 13 )
@@ -376,17 +376,17 @@ class MMU(val parameter: MMUParameter) extends Module with SerializableModule[MM
376376 // [文档]若此时CSR.ESTAT.Ecode=0x3F,即处于 TLB 重填例外处理过程中,那么 TLB 中总是填入一个有效项(即 TLB 项的E 位为1)。
377377 // 否则的话,就需要看 CSR.TLBIDX.NE 位的值。
378378 // 此时如果 CSR.TLBIDX.NE=1,那么 TLB 中会被填入一个无效TLB项;仅当 CSR.TLBIDX.NE=0 时,TLB 中才会被填入一个有效 TLB 项。
379- tlbExist(io.tlbidxIndexR ) := io.tlbidxNER === 0 .U || io.ecodesR === 0x3f .U
380- tlbEntry.ppn(0 ) := io.tlbelo0R(27 , 8 )
381- tlbEntry.ppn(1 ) := io.tlbelo1R(27 , 8 )
382- tlbEntry.plv(0 ) := io.tlbelo0R(3 , 2 )
383- tlbEntry.plv(1 ) := io.tlbelo1R(3 , 2 )
384- tlbEntry.mat(0 ) := TlbMatValue (io.tlbelo0R(5 , 4 ))
385- tlbEntry.mat(1 ) := TlbMatValue (io.tlbelo1R(5 , 4 ))
386- tlbEntry.d(0 ) := io.tlbelo0R(1 )
387- tlbEntry.d(1 ) := io.tlbelo1R(1 )
388- tlbEntry.v(0 ) := io.tlbelo0R(0 )
389- tlbEntry.v(1 ) := io.tlbelo1R(0 )
379+ tlbExist(ramdom ) := io.tlbidxNER === 0 .U || io.ecodesR === 0x3f .U
380+ tlbEntry.ppn(0 ) := io.tlbelo0R(27 , 8 )
381+ tlbEntry.ppn(1 ) := io.tlbelo1R(27 , 8 )
382+ tlbEntry.plv(0 ) := io.tlbelo0R(3 , 2 )
383+ tlbEntry.plv(1 ) := io.tlbelo1R(3 , 2 )
384+ tlbEntry.mat(0 ) := TlbMatValue (io.tlbelo0R(5 , 4 ))
385+ tlbEntry.mat(1 ) := TlbMatValue (io.tlbelo1R(5 , 4 ))
386+ tlbEntry.d(0 ) := io.tlbelo0R(1 )
387+ tlbEntry.d(1 ) := io.tlbelo1R(1 )
388+ tlbEntry.v(0 ) := io.tlbelo0R(0 )
389+ tlbEntry.v(1 ) := io.tlbelo1R(0 )
390390
391391 tlbMem.writePorts(0 ).data := tlbEntry
392392 }
0 commit comments