tlb_content update test
authorTobias Platen <tplaten@posteo.de>
Tue, 10 Sep 2019 19:35:27 +0000 (21:35 +0200)
committerTobias Platen <tplaten@posteo.de>
Tue, 10 Sep 2019 19:35:27 +0000 (21:35 +0200)
src/TLB/ariane/ptw.py
src/TLB/ariane/test/test_tlb_content.py
src/TLB/ariane/tlb_content.py

index ce8c774f6ee6b485762660320a294392f8d89c79..4046c711ec9eaa29dab619760c4a3a5648f6ea14 100644 (file)
@@ -133,7 +133,7 @@ class TLBUpdate:
         self.is_2M = Signal()
         self.is_1G = Signal()
         self.is_512G = Signal()
-        self.vpn = Signal(27)
+        self.vpn = Signal(36)
         self.asid = Signal(asid_width)
         self.content = PTE()
 
index 2261329f01ccf00de31314c6b610a6156fc4b935..0da2aff500d8873a4afd76333970631a510ad8d6 100644 (file)
@@ -6,14 +6,17 @@ from nmigen.compat.sim import run_simulation
 
 from TLB.ariane.tlb_content import TLBContent
 
-#def set_vaddr(addr):
-#    yield dut.lu_vaddr_i.eq(addr)
-#    yield dut.update_i.vpn.eq(addr>>12)
-
+def update():
+    yield dut.replace_en_i.eq(1)
+    
 def tbench(dut):
+    yield dut.replace_en_i.eq(1)
+    yield dut.update_i.valid.eq(1)
+    yield dut.update_i.is_512G.eq(1)
+    yield dut.update_i.vpn.eq(0xFFFFFFFF)
     yield
     yield
-    yield
+    
 
 if __name__ == "__main__":
     dut = TLBContent(4,4)
index 4ffd919eb3800750ffc2c23006342f16fae80071..4010e3775e4a980f19beeb9cd55425f773c50a89 100644 (file)
@@ -5,17 +5,17 @@ from TLB.ariane.ptw import TLBUpdate, PTE
 
 class TLBEntry:
     def __init__(self, asid_width):
-        self.asid = Signal(asid_width)
+        self.asid = Signal(asid_width,name="ent_asid")
         # SV48 defines four levels of page tables
-        self.vpn0 = Signal(9)
-        self.vpn1 = Signal(9)
-        self.vpn2 = Signal(9)
-        self.vpn3 = Signal(9)
-        self.is_2M = Signal()
-        self.is_1G = Signal()
-        self.is_512G = Signal()
-        self.valid = Signal()
-
+        self.vpn0 = Signal(9,name="ent_vpn0")
+        self.vpn1 = Signal(9,name="ent_vpn1")
+        self.vpn2 = Signal(9,name="ent_vpn2")
+        self.vpn3 = Signal(9,name="ent_vpn3")
+        self.is_2M = Signal(name="ent_is_2M")
+        self.is_1G = Signal(name="ent_is_1G")
+        self.is_512G = Signal(name="ent_is_512G")
+        self.valid = Signal(name="ent_valid")
+        
     def flatten(self):
         return Cat(*self.ports())
 
@@ -25,6 +25,7 @@ class TLBEntry:
     def ports(self):
         return [self.asid, self.vpn0, self.vpn1, self.vpn2,
                 self.is_2M, self.is_1G, self.valid]
+        
 
 class TLBContent(Elaboratable):
     def __init__(self, pte_width, asid_width):
@@ -33,6 +34,7 @@ class TLBContent(Elaboratable):
         self.flush_i = Signal()  # Flush signal
         # Update TLB
         self.update_i = TLBUpdate(asid_width)
+        self.vpn3 = Signal(9)
         self.vpn2 = Signal(9)
         self.vpn1 = Signal(9)
         self.vpn0 = Signal(9)
@@ -50,6 +52,11 @@ class TLBContent(Elaboratable):
         m = Module()
 
         tags = TLBEntry(self.asid_width)
+        #TODO signal names, RecordObject
+        print("TAGS:")
+        #print(tags)
+        
+        
         content = Signal(self.pte_width)
 
         m.d.comb += [self.lu_hit_o.eq(0),
@@ -113,6 +120,7 @@ class TLBContent(Elaboratable):
         with m.Elif(replace_valid):
             m.d.sync += [ # update tag array
                           tags.asid.eq(self.update_i.asid),
+                          tags.vpn3.eq(self.update_i.vpn[27:36]),
                           tags.vpn2.eq(self.update_i.vpn[18:27]),
                           tags.vpn1.eq(self.update_i.vpn[9:18]),
                           tags.vpn0.eq(self.update_i.vpn[0:9]),