print(RS)
 """
 
+testcat = """
+RT <- (load_data[56:63] || load_data[48:55]
+    || load_data[40:47] || load_data[32:39]
+    || load_data[24:31] || load_data[16:23]
+    || load_data[8:15]  || load_data[0:7])
+"""
+
+testgpr = """
+GPR(5) <- x
+"""
 #code = testmul
-code = testgetzero
+#code = testgetzero
+#code = testcat
+code = testgpr
 #code = testreg
 #code = cnttzd
 #code = cmpi
 
             #p[0] = ast.Discard(p[1])
             p[0] = p[1]
         else:
+            name = None
             if isinstance(p[1], ast.Name):
                 name = p[1].id
             elif isinstance(p[1], ast.Subscript):
                 if name in self.gprs:
                     # add to list of uninitialised
                     self.uninit_regs.add(name)
+            elif isinstance(p[1], ast.Call) and p[1].func.id == 'GPR':
+                print(astor.dump_tree(p[1]))
+                # replace GPR(x) with GPR[x]
+                idx = p[1].args[0]
+                p[1] = ast.Subscript(p[1].func, idx)
+            else:
+                print ("help, help")
+                print(astor.dump_tree(p[1]))
             print("expr assign", name, p[1])
-            if name in self.gprs:
+            if name and name in self.gprs:
                 self.write_regs.add(name)  # add to list of regs to write
             p[0] = Assign(p[1], p[3])
 
 
 
 if __name__ == '__main__':
     isa = PyISAWriter()
+    isa.write_pysource('fixedload')
+    exit(0)
     isa.write_pysource('comparefixed')
     isa.write_pysource('fixedarith')