# OPCODE DECLRACTION
# 0 IS FOR NON MRI INSTRUCTIONS 
# 1 IS FOR MRI INSTRUCTIONS

NON_MRI_INSTRUCTION = 0
MRI_INSTRUCTION = 1

# TUPLE IN OPCODE DEFINES ABOUT THE OPCODE (OPCODE,TYPE, NUMBER OF OPERANDS, DEFINES_VARIABLE OR NOT,TAKES VARIABLE AS INPUT OR NOT)
Opcodes = {"CLA" : ("0000",NON_MRI_INSTRUCTION,0,False,False),
"LAC" : ("0001",MRI_INSTRUCTION,1,False,True),
"SAC" : ("0010",MRI_INSTRUCTION,1,True,True),
"ADD" : ("0011",MRI_INSTRUCTION,1,False,True),
"SUB" : ("0100",MRI_INSTRUCTION,1,False,True),
"BRZ" : ("0101",MRI_INSTRUCTION,1,False,False),
"BRN" : ("0110",MRI_INSTRUCTION,1,False,False),
"BRP" : ("0111",MRI_INSTRUCTION,1,False,False),
"INP" : ("1000",MRI_INSTRUCTION,1,True,True),
"DSP" : ("1001",MRI_INSTRUCTION,1,False,True),
"MUL" : ("1010",MRI_INSTRUCTION,1,False,True),
"DIV" : ("1011",MRI_INSTRUCTION,1,False,True),
"STP" : ("1100",NON_MRI_INSTRUCTION,0,False,False)}


# Checks if input is correct opcode or not
def CheckOpcode(opcode):
	if opcode not in Opcodes:
		return ((),-1)
	else:
		return (Opcodes[opcode],0)
