Skip to content

Instantly share code, notes, and snippets.

@mikehearn
Last active September 24, 2018 07:40
Show Gist options
  • Save mikehearn/43d10fbdbf96c97686370a2c87afec3a to your computer and use it in GitHub Desktop.
Save mikehearn/43d10fbdbf96c97686370a2c87afec3a to your computer and use it in GitHub Desktop.
enum tinyram_opcode {
tinyram_opcode_AND = 0b00000,
tinyram_opcode_OR = 0b00001,
tinyram_opcode_XOR = 0b00010,
tinyram_opcode_NOT = 0b00011,
tinyram_opcode_ADD = 0b00100,
tinyram_opcode_SUB = 0b00101,
// Multiplications
tinyram_opcode_MULL = 0b00110,
tinyram_opcode_UMULH = 0b00111,
tinyram_opcode_SMULH = 0b01000,
// Division and bitshift
tinyram_opcode_UDIV = 0b01001,
tinyram_opcode_UMOD = 0b01010,
tinyram_opcode_SHL = 0b01011,
tinyram_opcode_SHR = 0b01100,
// Comparisons
tinyram_opcode_CMPE = 0b01101,
tinyram_opcode_CMPA = 0b01110,
tinyram_opcode_CMPAE = 0b01111,
tinyram_opcode_CMPG = 0b10000,
tinyram_opcode_CMPGE = 0b10001,
// Move between registers, conditional move
tinyram_opcode_MOV = 0b10010,
tinyram_opcode_CMOV = 0b10011,
// Jumps and conditional jumps
tinyram_opcode_JMP = 0b10100,
tinyram_opcode_CJMP = 0b10101,
tinyram_opcode_CNJMP = 0b10110,
// Undefined (causes a stall).
tinyram_opcode_10111 = 0b10111,
tinyram_opcode_11000 = 0b11000,
tinyram_opcode_11001 = 0b11001,
// Memory read/write, tape access, yield validity answer.
tinyram_opcode_STOREB = 0b11010,
tinyram_opcode_LOADB = 0b11011,
tinyram_opcode_STOREW = 0b11100,
tinyram_opcode_LOADW = 0b11101,
tinyram_opcode_READ = 0b11110,
tinyram_opcode_ANSWER = 0b11111
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment