raise exc
code = """
-a <- ¬(RA)
+src <- [0]*64
+src[64-XLEN:63] <- (RS)
+result <- [0]*64
+do i = 0 to 1
+ n <- i * 32
+ result[n+0:n+7] <- 0
+ result[n+8:n+19] <- DPD_TO_BCD(src[n+12:n+21])
+ result[n+20:n+31] <- DPD_TO_BCD(src[n+22:n+31])
+RA <- result[64-XLEN:63]
+if a < b then RT <- (RA)
+else RT <- (RB)
"""
tree = parser.parse(code=code)
print(tree)
self[node].emit(stmt=stmt, level=level)
self[node].emit(f"}}")
+ @pc_util.Hook(pc_ast.IfExpr)
+ def IfExpr(self, node):
+ yield node
+ stmt = " ".join([
+ "if",
+ str(self[node.test]),
+ "{",
+ ])
+ self[node].emit(stmt=stmt)
+ for (level, stmt) in self[node.body]:
+ self[node].emit(stmt=stmt, level=level)
+ if node.orelse:
+ self[node].emit("} else {")
+ for (level, stmt) in self[node.orelse]:
+ self[node].emit(stmt=stmt, level=level)
+ self[node].emit("}")
+
@pc_util.Hook(pc_ast.Call.Name)
def CallName(self, node):
yield node