def bc1t(ir, instr, a, b): e = [] n = ExprId(ir.get_next_break_label(instr)) dst_o = ExprCond(a, b, n) e = [ExprAff(PC, dst_o)] e.append(ExprAff(ir.IRDst, dst_o)) return e, []
def bgtz(ir, instr, a, b): e = [] n = ExprId(ir.get_next_break_label(instr)) cond = ExprCond(a, ExprInt1(1), ExprInt1(0)) | a.msb() dst_o = ExprCond(cond, n, b) e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o)] return e, []
def jalr(ir, instr, a, b): e = [] n = ExprId(ir.get_next_break_label(instr)) e.append(ExprAff(PC, a)) e.append(ExprAff(ir.IRDst, a)) e.append(ExprAff(b, n)) return e, []
def bc1f(ir, instr, a, b): e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) dst_o = m2_expr.ExprCond(a, n, b) e = [m2_expr.ExprAff(PC, dst_o)] e.append(m2_expr.ExprAff(ir.IRDst, dst_o)) return e, []
def bal(ir, instr, a): e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) e.append(m2_expr.ExprAff(PC, a)) e.append(m2_expr.ExprAff(ir.IRDst, a)) e.append(m2_expr.ExprAff(RA, n)) return e, []
def bgez(ir, instr, a, b): e = [] n = ExprId(ir.get_next_break_label(instr)) dst_o = ExprCond(a.msb(), n, b) e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o) ] return e, []
def bne(ir, instr, a, b, c): e = [] n = ExprId(ir.get_next_break_label(instr)) dst_o = ExprCond(a-b, c, n) e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o) ] return e, []
def jal(ir, instr, a): "Jumps to the calculated address @a and stores the return address in $RA" e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) e.append(m2_expr.ExprAff(PC, a)) e.append(m2_expr.ExprAff(ir.IRDst, a)) e.append(m2_expr.ExprAff(RA, n)) return e, []
def bgtz(ir, instr, a, b): e = [] n = ExprId(ir.get_next_break_label(instr)) cond = ExprCond(a, ExprInt1(1), ExprInt1(0)) | a.msb() dst_o = ExprCond(cond, n, b) e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o) ] return e, []
def bltz(ir, instr, a, b): """Branches on @b if the register @a is less than zero""" e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) dst_o = m2_expr.ExprCond(a.msb(), b, n) e = [m2_expr.ExprAff(PC, dst_o), m2_expr.ExprAff(ir.IRDst, dst_o) ] return e, []
def jalr(ir, instr, a, b): """Jump to an address stored in a register @a, and store the return address in another register @b""" e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) e.append(m2_expr.ExprAff(PC, a)) e.append(m2_expr.ExprAff(ir.IRDst, a)) e.append(m2_expr.ExprAff(b, n)) return e, []
def beq(ir, instr, a, b, c): "Branches on @c if the quantities of two registers @a, @b are equal" e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) dst_o = m2_expr.ExprCond(a-b, n, c) e = [m2_expr.ExprAff(PC, dst_o), m2_expr.ExprAff(ir.IRDst, dst_o) ] return e, []
def bgez(ir, instr, a, b): """Branches on @b if the quantities of register @a is greater than or equal to zero""" e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) dst_o = m2_expr.ExprCond(a.msb(), n, b) e = [m2_expr.ExprAff(PC, dst_o), m2_expr.ExprAff(ir.IRDst, dst_o) ] return e, []
def bgtz(ir, instr, a, b): """Branches on @b if the register @a is greater than zero""" e = [] n = m2_expr.ExprId(ir.get_next_break_label(instr)) cond = m2_expr.ExprCond(a, m2_expr.ExprInt1(1), m2_expr.ExprInt1(0)) | a.msb() dst_o = m2_expr.ExprCond(cond, n, b) e = [m2_expr.ExprAff(PC, dst_o), m2_expr.ExprAff(ir.IRDst, dst_o) ] return e, []
def beq(arg1, arg2, arg3): "Branches on @arg3 if the quantities of two registers @arg1, @arg2 are eq" dst = ExprId(ir.get_next_break_label(instr)) if arg1 - arg2 else arg3 PC = dst ir.IRDst = dst
def bgez(arg1, arg2): """Branches on @arg2 if the quantities of register @arg1 is greater than or equal to zero""" dst = ExprId(ir.get_next_break_label(instr)) if arg1.msb() else arg2 PC = dst ir.IRDst = dst
def bne(arg1, arg2, arg3): """Branches on @arg3 if the quantities of two registers @arg1, @arg2 are NOT equal""" dst = arg3 if arg1 - arg2 else ExprId(ir.get_next_break_label(instr)) PC = dst ir.IRDst = dst
def bltz(arg1, arg2): """Branches on @arg2 if the register @arg1 is less than zero""" dst_o = arg2 if arg1.msb() else ExprId(ir.get_next_break_label(instr)) PC = dst_o ir.IRDst = dst_o
def bgtz(arg1, arg2): """Branches on @arg2 if the register @arg1 is greater than zero""" cond = (i1(1) if arg1 else i1(0)) | arg1.msb() dst_o = ExprId(ir.get_next_break_label(instr)) if cond else arg2 PC = dst_o ir.IRDst = dst_o
def bc1f(arg1, arg2): dst_o = ExprId(ir.get_next_break_label(instr)) if arg1 else arg2 PC = dst_o ir.IRDst = dst_o
def blez(arg1, arg2): """Branches on @arg2 if the register @arg1 is less than or equal to zero""" cond = (i1(1) if arg1 else i1(0)) | arg1.msb() dst_o = arg2 if cond else ExprId(ir.get_next_break_label(instr)) PC = dst_o ir.IRDst = dst_o
def bc1t(arg1, arg2): dst_o = arg2 if arg1 else ExprId(ir.get_next_break_label(instr)) PC = dst_o ir.IRDst = dst_o
def bgez(ir, instr, a, b): e = [] n = ExprId(ir.get_next_break_label(instr)) dst_o = ExprCond(a.msb(), n, b) e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o)] return e, []
def bal(arg1): PC = arg1 ir.IRDst = arg1 RA = ExprId(ir.get_next_break_label(instr))
def jalr(arg1, arg2): """Jump to an address stored in a register @arg1, and store the return address in another register @arg2""" PC = arg1 ir.IRDst = arg1 arg2 = ExprId(ir.get_next_break_label(instr))
def jal(arg1): "Jumps to the calculated address @arg1 and stores the return address in $RA" PC = arg1 ir.IRDst = arg1 RA = ExprId(ir.get_next_break_label(instr))
def bne(ir, instr, a, b, c): e = [] n = ExprId(ir.get_next_break_label(instr)) dst_o = ExprCond(a - b, c, n) e = [ExprAff(PC, dst_o), ExprAff(ir.IRDst, dst_o)] return e, []