Merge branch 'master' of ssh://git.libre-riscv.org:922/soc
authorTobias Platen <tplaten@posteo.de>
Tue, 30 Mar 2021 18:45:52 +0000 (20:45 +0200)
committerTobias Platen <tplaten@posteo.de>
Tue, 30 Mar 2021 18:45:52 +0000 (20:45 +0200)
libreriscv
src/soc/decoder/isa/radixmmu.py
src/soc/decoder/pseudo/pagereader.py

index 59c4a072402ffaf98cb43fc2a33084e7bf1f1a6b..bde364f71cf05e81b1e6adecad777d187b6c31da 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 59c4a072402ffaf98cb43fc2a33084e7bf1f1a6b
+Subproject commit bde364f71cf05e81b1e6adecad777d187b6c31da
index 2da2cd96a2c1e0657511e6ef8806461eff57abb4..accb78dbe240532c0f596fe7eb909871cb03cd9e 100644 (file)
@@ -285,8 +285,8 @@ class RADIX:
 
         pte = self._walk_tree(addr, pgbase, mode, mbits, shift, priv)
 
-        # use pte to caclculate phys address
-        return self.mem.ld(address, width, swap, check_in_mem)
+        # use pte to load from phys address
+        return self.mem.ld(pte.value, width, swap, check_in_mem)
 
         # XXX set SPRs on error
 
@@ -300,8 +300,8 @@ class RADIX:
         (shift, mbits, pgbase) = self._decode_prte(addr)
         pte = self._walk_tree(addr, pgbase, mode, mbits, shift, priv)
 
-        # use pte to caclculate phys address (addr)
-        return self.mem.st(addr.value, v, width, swap)
+        # use pte to store at phys address
+        return self.mem.st(pte.value, v, width, swap)
 
         # XXX set SPRs on error
 
@@ -312,6 +312,7 @@ class RADIX:
     def _next_level(self, addr, entry_width, swap, check_in_mem):
         # implement read access to mmu mem here
 
+        # DO NOT perform byte-swapping: load 8 bytes (that's the entry size)
         value = self.mem.ld(addr.value, 8, False, check_in_mem)
         assert(value is not None, "address lookup %x not found" % addr.value)
 
index 8e9b0be39b66cc70afd45cbe09cca793c03a901c..ea1b6653f40765c5b5a0878fea6456c28aa52a62 100644 (file)
@@ -97,8 +97,14 @@ class ISA:
             # <!-- line 1 comment -->
             # <!-- line 2 comment -->
             if l.startswith('<!--'):
-                print ("skipping comment", l)
+                # print ("skipping comment", l)
+                l = lines.pop(0).rstrip()  # get first line
                 continue
+
+            # Ignore blank lines before the first #
+            if len(l.strip()) == 0:
+                continue
+
             # expect get heading
             assert l.startswith('#'), ("# not found in line %s" % l)
 
@@ -158,7 +164,7 @@ class ISA:
             while lines:
                 l = lines.pop(0).rstrip()
                 rewrite.append(l)
-                if len(l) != 0:
+                if len(l) != 0 and not l.startswith('<!--'):
                     break
 
         return rewrite
@@ -179,8 +185,23 @@ class ISA:
         l = lines.pop(0).rstrip()  # get first line
         while lines:
             print(l)
+            # look for HTML comment, if starting, skip line.
+            # XXX this is braindead!  it doesn't look for the end
+            # so please put ending of comments on one line:
+            # <!-- line 1 comment -->
+            # <!-- line 2 comment -->
+            if l.startswith('<!--'):
+                # print ("skipping comment", l)
+                l = lines.pop(0).rstrip()  # get next line
+                continue
+
+            # Ignore blank lines before the first #
+            if len(l) == 0:
+                l = lines.pop(0).rstrip()  # get next line
+                continue
+
             # expect get heading
-            assert l.startswith('#'), ("# not found in line %s" % l)
+            assert l.startswith('#'), ("# not found in line '%s'" % l)
             d['desc'] = l[1:].strip()
 
             # whitespace expected
@@ -255,7 +276,7 @@ class ISA:
             # expect and drop whitespace
             while lines:
                 l = lines.pop(0).rstrip()
-                if len(l) != 0:
+                if len(l) != 0 and not l.startswith('<!--'):
                     break
 
     def add_op(self, o, d):