From 91b3f9682737d5c9adf8a6bfcd2be15ad8bf4465 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 9 Mar 2021 12:30:02 +0000 Subject: [PATCH] add pgtable and pte calculation to RADIX ISACaller --- src/soc/decoder/isa/caller.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 0e36a4c2..239865f9 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -443,27 +443,47 @@ class RADIX: effpid = self.pid[32:64] # TODO, check on this zero16 = SelectableInt(0, 16) zero4 = SelectableInt(0, 4) - rts = selectconcat(zero16, - prtbl[8:28], # - (prtbl[28:52] & ~finalmask24) | # - (effpid[0:24] & finalmask24), # + res = selectconcat(zero16, + prtbl[8:28], # + (prtbl[28:52] & ~finalmask24) | # + (effpid[0:24] & finalmask24), # effpid[24:32], zero4 ) - def _get_pgtable_addr(self): + return res + + def _get_pgtable_addr(self, mask_size, pgbase, addrsh): """ x"00" & r.pgbase(55 downto 19) & ((r.pgbase(18 downto 3) and not mask) or (addrsh and mask)) & "000"; """ + mask16 = genmask(mask_size+5, 16) + zero8 = SelectableInt(0, 8) + zero3 = SelectableInt(0, 3) + res = selectconcat(zero8, + pgbase[8:45], # + (prtbl[45:61] & ~mask16) | # + (addrsh & mask16), # + zero3 + ) + return res - def _get_pte(self): + def _get_pte(self, shift, addr, pde): """ x"00" & - ((r.pde(55 downto 12) and not finalmask) or + ((r.pde(55 downto 12) and not finalmask) or (r.addr(55 downto 12) and finalmask)) & r.pde(11 downto 0); """ + finalmask = genmask(shift, 44) + zero8 = SelectableInt(0, 8) + res = selectconcat(zero8, + (pde[8:52] & ~finalmask) | # + (addr[8:52] & finalmask), # + pde[52:64], + ) + return res class Mem: -- 2.30.2