Skip to content

Instantly share code, notes, and snippets.

@jamesacraig
Last active April 12, 2020 12:02
Show Gist options
  • Save jamesacraig/965963d371b27494fdd0191efef0b64c to your computer and use it in GitHub Desktop.
Save jamesacraig/965963d371b27494fdd0191efef0b64c to your computer and use it in GitHub Desktop.
# Table of instructions by opcode - name, addressing mode, cycles, bytes
_instruction_table = {
0x00: ["BRK", AddressingMode.IMPLIED, 7, 1],
0xA9: ["LDA", AddressingMode.I, 2, 2],
0x4C: ["JMP", AddressingMode.ABSOLUTE, 3, 3],
0xEA: ["NOP", AddressingMode.IMPLIED, 2, 1],
}
# Enum of all instruction names.
InstructionName = IntEnum("InstructionName", [(v[0], k) for k, v in _instruction_table.items()])
instr_name = Signal(shape=InstructionName, decoder=InstructionName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment