예제 #1
0
    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})"
예제 #2
0
    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}")
예제 #3
0
    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}"
예제 #4
0
    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}"
예제 #5
0
    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
예제 #6
0
 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
예제 #7
0
    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}")
예제 #8
0
    def test_register_name(self):
        register_name = "$a0"
        register_number = 4
        registers = Registers()

        assert register_name == registers.get_register_name(register_number)