mackerel: do not pre-read write only registers
authorReto Achermann <reto.achermann@inf.ethz.ch>
Thu, 16 Mar 2017 13:40:54 +0000 (14:40 +0100)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Thu, 16 Mar 2017 13:40:54 +0000 (14:40 +0100)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

tools/mackerel/ShiftDriver.hs

index c48f6ad..5d63420 100644 (file)
@@ -1122,6 +1122,7 @@ register_write_fn r =
                       C.SComment "No MB1 fields present"
                  ),
                  (if prsvmask /= 0 then
+                    (if RT.is_readable r then
                       (C.Ex $ C.Assignment 
                              (C.Variable cv_regval) 
                              (C.Binary C.BitwiseOr 
@@ -1129,6 +1130,9 @@ register_write_fn r =
                                     (C.Binary C.BitwiseAnd
                                           (C.HexConstant prsvmask)
                                           (loc_read r))))
+                      else 
+                      C.SComment "No pre-read. Register is write only."
+                  )
                   else
                       C.SComment "No pre-read of register required"
                  ),