add comments and more stub functions
[soc.git] / src / soc / decoder / isa / caller.py
index a90ebed7646c60127c58f998e5abd7d8bc4df25e..0925915b553a49eca3abe183d11fb2b75bb0e549 100644 (file)
@@ -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: