From 916a3a02e296815ac527f8c6233d7fb01af9de70 Mon Sep 17 00:00:00 2001 From: Tobias Platen Date: Sun, 11 Apr 2021 08:45:06 +0200 Subject: [PATCH] radixmmu: more work on segment check --- src/soc/decoder/isa/radixmmu.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/soc/decoder/isa/radixmmu.py b/src/soc/decoder/isa/radixmmu.py index f0647d27..12946570 100644 --- a/src/soc/decoder/isa/radixmmu.py +++ b/src/soc/decoder/isa/radixmmu.py @@ -438,22 +438,23 @@ class RADIX: print("calling segment_check") mbits = selectconcat(SelectableInt(0,1), mask_size) - new_shift = self._segment_check(addr, mbits, shift) - print("new_shift",new_shift) + shift = self._segment_check(addr, mbits, shift) + print("shift",shift) # v.pgbase := pgtbl(55 downto 8) & x"00"; leftzeros = SelectableInt(0,15) pgbase = selectconcat(leftzeros,pgtbl[8:55],SelectableInt(0,2)) - # FIXME number of bits is wrong, assertion fails - print("pgbase",pgbase) - print("pgbase[8:45]",pgbase[8:45]) - print("pgbase[45:61]",pgbase[45:61]) - #addr_next = self._get_pgtable_addr(mask_size, pgbase, new_shift) - #print("DONE ",addr_next) - return None - - #addr_next = SelectableInt(0x30000,64) # radix root for testing - # this needs to be calculated using the code above + + addrsh = addrshift(addr,shift) + print("addrsh",addrsh) + + # TODO verify + addr_next = self._get_pgtable_addr(mask_size, pgbase, addrsh) + print("DONE addr_next",addr_next) + + # wrong '0b000000011000000000' + # right '0b110000000000000000' + assert(addr_next==0x30000) # walk tree starts on prtbl while True: -- 2.30.2