[libre-riscv-dev] UnusedElaboratable when running testbench

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Jul 24 22:58:31 BST 2019


@@ -426,7 +431,7 @@ class PTW(Elaboratable):
             with m.Else():
                 m.next = "PTE_LOOKUP"

-    def lookup(self, m, pte, ptw_lvl, ptw_lvl1, ptw_lvl2, ptw_lvl3,
+    def lookup(self, m, pte, ptw_lvl, ptw_lvl1, ptw_lvl2, ptw_lvl3,
ptw_lvl4, <---space on the end
                             data_rvalid, global_mapping,
                             is_instr_ptw, ptw_pptr):
         # temporaries


extra space on the end, there - watch out for that


@@ -513,22 +518,29 @@ class PTW(Elaboratable):
             # pointer to next level of page table
             with m.If (ptw_lvl1):
                 # we are in the second level now
-                pptr = Cat(Const(0, 3), self.dtlb_vaddr_i[21:30], pte.ppn)
+                pptr = Cat(Const(0, 3), self.dtlb_vaddr_i[30:39], pte.ppn)
                 m.d.sync += [ptw_pptr.eq(pptr),
                              ptw_lvl.eq(LVL2)
                             ]

this looks anomalous: i'd be very surprised if level 1 (and level 2,
and level 3) change their offsets, from sv39 to sv48.

figure 4.18 priv-arch v1.12-draft: VPN[0] 12..20, PPN[0] 12..20
VPN[1] 21..29, PPN[1] - 21..29
VPN[2] 30..38, PPN[2] - 30..55

then section 4.5.1, figure 4.21

VPN[0] - 12..20, PPN[0] 12..20 exactly the same
VPN1/PPN1 - exactly the same
VPN2/PPN2 - exactly the... no, PPN[2] is 30..38
VPN[3] is 39..48 and PPN[3] is 39..55

so PPN[3] is the "odd" one, however VPN[0/1/2] remain exactly the same.

can you think of a reason _why_ they would shift?

l.



More information about the libre-riscv-dev mailing list