def decode(self, registers: Registers, coprocessor: COProcessor, *args, **kwargs) -> str: ft_name = coprocessor.registers.get_register_name(self.ft_number) rs_number = self.base rs_name = registers.get_register_name(rs_number) offset = self.offset return f"{self.instruction_name} {ft_name}, {offset}({rs_name})"
def decode(self, registers: Registers, *args, **kwargs) -> str: if self.rd_number == 0 and self.rs_number == 0: return NopInstruction()(self.word).decode(registers) rd_name = registers.get_register_name(self.rd_number) rt_name = registers.get_register_name(self.rt_number) return (f"{self.instruction_name} " f"{rd_name}, {rt_name}, {self.shamt_value}")
def decode(self, registers: Registers, coprocessor: COProcessor, *args, **kwargs) -> str: fs_name = coprocessor.registers.get_register_name(self.fs_number) rt_name = registers.get_register_name(self.rt_number) return f"{self.instruction_name} {rt_name}, {fs_name}"
def decode(self, registers: Registers, *args, **kwargs) -> str: rs_name = registers.get_register_name(self.rs_number) rt_name = registers.get_register_name(self.rt_number) return f"{self.instruction_name} {rs_name}, {rt_name}"
def decode(self, registers: Registers, *args, **kwargs) -> str: rs_name = registers.get_register_name(self.rs_number) rt_name = registers.get_register_name(self.rt_number) immediate_value = self.imediate return f"{self.instruction_name} {rt_name}, {rs_name}, {immediate_value}" # noqa: E501
def decode(self, registers: Registers, *args, **kwargs) -> str: rs_name = registers.get_register_name(self.rs_number) rt_name = registers.get_register_name(self.rt_number) immediate_value = (((1 << 16) - 1) & (self.word.data >> (0))) return f"{self.instruction_name} {rt_name}, {rs_name}, {immediate_value}" # noqa: E501
def decode(self, registers: Registers, *args, **kwargs) -> str: rd_name = registers.get_register_name(self.rd_number) rt_name = registers.get_register_name(self.rt_number) return (f"{self.instruction_name} " f"{rd_name}, {rt_name}, {self.shamt_value}")
def test_register_name(self): register_name = "$a0" register_number = 4 registers = Registers() assert register_name == registers.get_register_name(register_number)