From 258118994fb3421fbe135a09fc6fa98f12bd37a8 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 5 Mar 2021 16:33:05 +0000 Subject: [PATCH] add comments and more stub functions --- src/soc/decoder/isa/caller.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index a90ebed7..0925915b 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -328,6 +328,9 @@ class RADIX: ----------------------------------------------- 0 1 2 3 4 55 56 58 59 63 """ + # note that SelectableInt does big-endian! so the indices + # below *directly* match the spec, unlike microwatt which + # has to turn them around (to LE) zero = SelectableInt(0, 1) rts = selectconcat(zero, data[56:59], # RTS2 @@ -354,8 +357,11 @@ class RADIX: else v.state := RADIX_LOOKUP; """ + # note that SelectableInt does big-endian! so the indices + # below *directly* match the spec, unlike microwatt which + # has to turn them around (to LE) mask = genmask(shift, 43) - nonzero = addr[1:32] & mask[12:43] + nonzero = addr[1:32] & mask[12:43] # mask 31 LSBs (BE numbered 12:43) print ("RADIX _segment_check nonzero", bin(nonzero.value)) print ("RADIX _segment_check addr[0-1]", addr[0].value, addr[1].value) if addr[0] != addr[1] or nonzero == 1: @@ -392,6 +398,33 @@ class RADIX: end if; """ + def _get_prtable_addr(self, prtbl, addr): + """ + if r.addr(63) = '1' then + effpid := x"00000000"; + else + effpid := r.pid; + end if; + prtable_addr := x"00" & r.prtbl(55 downto 36) & + ((r.prtbl(35 downto 12) and not finalmask(23 downto 0)) or + (effpid(31 downto 8) and finalmask(23 downto 0))) & + effpid(7 downto 0) & "0000"; + """ + + def _get_pgtable_addr(self): + """ + pgtable_addr := x"00" & r.pgbase(55 downto 19) & + ((r.pgbase(18 downto 3) and not mask) or (addrsh and mask)) & + "000"; + """ + + def _get_pte(self): + """ + pte := x"00" & + ((r.pde(55 downto 12) and not finalmask) or (r.addr(55 downto 12) and finalmask)) + & r.pde(11 downto 0); + """ + class Mem: -- 2.30.2