From: Tobias Platen Date: Tue, 30 Mar 2021 17:26:41 +0000 (+0200) Subject: add function _prtable_lookup and unit test X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5785c6948a5735d9568e3358798bb213de33d472;p=soc.git add function _prtable_lookup and unit test --- diff --git a/src/soc/decoder/isa/radixmmu.py b/src/soc/decoder/isa/radixmmu.py index 1c793941..d1894e7d 100644 --- a/src/soc/decoder/isa/radixmmu.py +++ b/src/soc/decoder/isa/radixmmu.py @@ -321,6 +321,18 @@ class RADIX: # index += 1 return data; + def _prtable_lookup(self, prtbl, addr, pid): + # v.shift := unsigned('0' & r.prtbl(4 downto 0)); + shift = prtbl[59:63] + print("shift",shift) + prtable_addr = self._get_prtable_addr(shift, prtbl, addr, pid) + print("prtable_addr",prtable_addr) + # TODO check and loop if needed + + assert(prtable_addr==0x1000000) + print("fetch data from PROCESS_TABLE_3") + return "TODO" + def _walk_tree(self, addr, pgbase, mode, mbits, shift, priv=1): """walk tree @@ -683,6 +695,17 @@ class TestRadixMMU(unittest.TestCase): print("ret=", ret) self.assertEqual(ret, 0, "pgtbl_addr should be 0") + def test_prtable_lookup(self): + + mem = None + caller = None + dut = RADIX(mem, caller) + + prtbl = SelectableInt(0x1000000,64) + addr = SelectableInt(0, 64) + pid = SelectableInt(0, 64) + ret = dut._prtable_lookup(prtbl, addr, pid) + def test_walk_tree_1(self): # test address as in