mackerel: don't generate read functions for write only registers
authorReto Achermann <reto.achermann@inf.ethz.ch>
Tue, 7 Mar 2017 08:27:41 +0000 (09:27 +0100)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Tue, 7 Mar 2017 08:27:41 +0000 (09:27 +0100)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

tools/mackerel/ShiftDriver.hs

index b4cd94e..4dbc014 100644 (file)
@@ -1018,10 +1018,15 @@ register_rawread_fn r =
                  (RT.name r) n)
        ]
      else
-       [
-       decl,
-       C.StaticInline rtn n args [ C.Return (loc_read r) ]
-       ]
+        if RT.is_readable r then 
+        [ 
+        decl,
+        C.StaticInline rtn n args [ C.Return (loc_read r) ]
+        ]
+        else 
+        [ 
+         C.Comment $ printf "Register %s is not readale" (RT.name r) 
+        ]
 
 --
 -- Read from the register, or from a shadow copy if it's not readable.