"""
-from nmigen import Const, Signal, Cat, Module
+from nmigen import Const, Signal, Cat, Module, Elaboratable
from nmigen.hdl.ast import ArrayProxy
from nmigen.cli import verilog, rtlil
from math import log2
LVL3 = Const(2, 2)
-class PTW:
+class PTW(Elaboratable):
def __init__(self, asid_width=8):
self.asid_width = asid_width
sys.path.append("../src")
sys.path.append("../../../TestUtil")
-from plru import PLRU
+from TLB.ariane.plru import PLRU
from nmigen.compat.sim import run_simulation
from TLB.ariane.ptw import PTW, PTE
-def testbench(dut):
+def tbench(dut):
addr = 0x8000000
yield
-
-if __name__ == "__main__":
+def test_ptw():
dut = PTW()
- run_simulation(dut, testbench(dut), vcd_name="test_ptw.vcd")
+ run_simulation(dut, tbench(dut), vcd_name="test_ptw.vcd")
print("PTW Unit Test Success")
+
+if __name__ == "__main__":
+ test_ptw()
yield dut.update_i.vpn.eq(addr>>12)
-def testbench(dut):
+def tbench(dut):
yield dut.lu_access_i.eq(1)
yield dut.lu_asid_i.eq(1)
yield dut.update_i.valid.eq(1)
if __name__ == "__main__":
dut = TLB()
- run_simulation(dut, testbench(dut), vcd_name="test_tlb.vcd")
+ run_simulation(dut, tbench(dut), vcd_name="test_tlb.vcd")
from nmigen.cli import verilog, rtlil
from nmigen.lib.coding import Encoder
-from ptw import TLBUpdate, PTE, ASID_WIDTH
-from plru import PLRU
-from tlb_content import TLBContent
+from TLB.ariane.ptw import TLBUpdate, PTE, ASID_WIDTH
+from TLB.ariane.plru import PLRU
+from TLB.ariane.tlb_content import TLBContent
TLB_ENTRIES = 8
-from nmigen import Signal, Module, Cat, Const
+from nmigen import Signal, Module, Cat, Const, Elaboratable
+
+from TLB.ariane.ptw import TLBUpdate, PTE
-from ptw import TLBUpdate, PTE
class TLBEntry:
def __init__(self, asid_width):
return [self.asid, self.vpn0, self.vpn1, self.vpn2,
self.is_2M, self.is_1G, self.valid]
-class TLBContent:
+class TLBContent(Elaboratable):
def __init__(self, pte_width, asid_width):
self.asid_width = asid_width
self.pte_width = pte_width