# if Rc = 1 then store the result of comparing a and b to CR0
     if Rc = 1 then
         if a <u b then
-            CR0 <- 0b100 || XER[SO]
+            CR0 <- 0b100 || XER.SO
         if a = b then
-            CR0 <- 0b001 || XER[SO]
+            CR0 <- 0b001 || XER.SO
         if a >u b then
-            CR0 <- 0b010 || XER[SO]
+            CR0 <- 0b010 || XER.SO
     if MMM[2] then  # max mode
         # swap a and b to make the less than comparison do
         # greater than comparison of the original inputs
     # if Rc = 1 then store the result of comparing a and b to CR0
     # if Rc = 1 then
     #     if a <u b then
-    #         CR0 <- 0b100 || XER[SO]
+    #         CR0 <- 0b100 || XER.SO
     #     if a = b then
-    #         CR0 <- 0b001 || XER[SO]
+    #         CR0 <- 0b001 || XER.SO
     #     if a >u b then
-    #         CR0 <- 0b010 || XER[SO]
+    #         CR0 <- 0b010 || XER.SO
     if MMM[2] then  # max mode
         # swap a and b to make the less than comparison do
         # greater than comparison of the original inputs
 
     if      a < EXTS(SI) then c <- 0b100
     else if a > EXTS(SI) then c <- 0b010
     else                      c <- 0b001
-    CR[4*BF+32:4*BF+35] <- c || XER[SO]
+    CR[4*BF+32:4*BF+35] <- c || XER.SO
 
 Special Registers Altered:
 
     if      a < b then c <-  0b100
     else if a > b then c <-  0b010
     else               c <-  0b001
-    CR[4*BF+32:4*BF+35] <-  c || XER[SO]
+    CR[4*BF+32:4*BF+35] <-  c || XER.SO
 
 Special Registers Altered:
 
     if      a <u ([0]*(XLEN-16) || UI) then c <- 0b100
     else if a >u ([0]*(XLEN-16) || UI) then c <- 0b010
     else                             c <- 0b001
-    CR[4*BF+32:4*BF+35] <- c || XER[SO]
+    CR[4*BF+32:4*BF+35] <- c || XER.SO
 
 Special Registers Altered:
 
     if      a <u b then c <- 0b100
     else if a >u b then c <- 0b010
     else                c <-  0b001
-    CR[4*BF+32:4*BF+35] <- c || XER[SO]
+    CR[4*BF+32:4*BF+35] <- c || XER.SO
 
 Special Registers Altered:
 
 
 
 Pseudo-code:
 
-    CR[4*BF+32:4*BF+35] <-  XER[OV] || XER[OV32] || XER[CA] || XER[CA32]
+    CR[4*BF+32:4*BF+35] <-  XER.OV || XER.OV32 || XER.CA || XER.CA32
 
 Special Registers Altered:
 
 
 from openpower.decoder.selectable_int import (FieldSelectableInt,
                                               SelectableInt, selectconcat)
 from openpower.fpscr import FPSCRState
+from openpower.xer import XERState
 from openpower.util import LogKind, log
 
 instruction_info = namedtuple('instruction_info',
                 info = spr_dict[key]
             else:
                 info = spr_byname[key]
-            dict.__setitem__(self, key, SelectableInt(0, info.length))
+            self[key] = SelectableInt(0, info.length)
             res = dict.__getitem__(self, key)
         log("spr returning", key, res)
         return res
             self.__setitem__('SRR0', value)
         if key == 'HSRR1':  # HACK!
             self.__setitem__('SRR1', value)
+        if key == 1:
+            value = XERState(value)
         log("setting spr", key, value)
         dict.__setitem__(self, key, value)