From b7aad51f4f5a13a86f347d33abdac841d74a70bd Mon Sep 17 00:00:00 2001 From: Tobias Platen Date: Sun, 21 Jul 2019 18:09:19 +0200 Subject: [PATCH] TLB testbench WIP --- src/TLB/TLB.py | 8 ++++---- src/TLB/test/test_tlb.py | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/TLB/test/test_tlb.py diff --git a/src/TLB/TLB.py b/src/TLB/TLB.py index 3538bdc1..f2b7a925 100644 --- a/src/TLB/TLB.py +++ b/src/TLB/TLB.py @@ -5,13 +5,13 @@ * Tag (N - 79) / ASID (78 - 64) / PTE (63 - 0) """ -from nmigen import Memory, Module, Signal, Cat +from nmigen import Memory, Module, Signal, Cat, Elaboratable from nmigen.cli import main -from PermissionValidator import PermissionValidator -from Cam import Cam +from .PermissionValidator import PermissionValidator +from .Cam import Cam -class TLB(): +class TLB(Elaboratable): def __init__(self, asid_size, vma_size, pte_size, L1_size): """ Arguments * asid_size: Address Space IDentifier (ASID) typically 15 bits diff --git a/src/TLB/test/test_tlb.py b/src/TLB/test/test_tlb.py new file mode 100644 index 00000000..8e26130a --- /dev/null +++ b/src/TLB/test/test_tlb.py @@ -0,0 +1,21 @@ +import tracemalloc + +tracemalloc.start() + +from nmigen.compat.sim import run_simulation + +from TLB.TLB import TLB + +from TestUtil.test_helper import assert_op + +def tbench(dut): + pass + +def test_tlb(): + #FIXME UnusedElaboratable when the following line is uncommented + #dut = TLB(15,36,64,8) + #run_simulation(dut, tbench(dut), vcd_name="Waveforms/test_tlb.vcd") + print("TLB Unit Test TODO") + +if __name__ == "__main__": + test_tlb() -- 2.30.2