def resolveLabels(self, instruction, func_addr, labels): data = instruction._inst_bld_tmp func_name = data[1] label = data[2] if label not in labels: return instruction label_address = labels[label] new_instruction = None if data[0] == 'jump': new_instruction = self.encoder(instruction._vm_asm, func_name, imm = u32(label_address >> 2), label = label, label_address = label_address) elif data[0] == 'branch': immediate_encoding = u32((label_address - func_addr + self.BRANCH_ENCODING_MOD) >> 2) new_instruction = self.encoder(instruction._vm_asm, func_name, s = data[3], t = data[4], imm = immediate_encoding, label = label, label_address = label_address) del instruction return new_instruction
def ins_sltu(self, args): """ Opcode: 000000 Fcode: 101001 Syntax: ArithLog """ return self.arith_TEMPLATE('sltu', args, lambda a, b: 1 if u32(a) < u32(b) else 0)
def ins_sltiu(self, args): """ Opcode: 001001 Syntax: ArithLogI """ return self.imm_TEMPLATE('sltiu', args, lambda a, b: 1 if u32(a) < b else 0)
def ins_addiu(self, args): """ Opcode: 001001 Syntax: ArithLogI """ return self.imm_TEMPLATE('addiu', args, lambda a, b: u32(a) + b)
def _asm_storeload(b): b.memory[(imm + u32(b[reg_s])), size] = b[reg_t]
def _asm_storeload(b): b[reg_t] = _sign_f(b.memory[(imm + u32(b[reg_s])), size], size)