Guest User

Untitled

a guest
Oct 18th, 2019
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def is_Rtype(instruction):
  2. for i in R_Instuctions:
  3. if (i==instruction.split(' ')[0]):
  4. if (i=='sll' or i=='jr'):
  5. return 'extremes'
  6. elif (i == instruction.split(' ')[1]):
  7. return 'Label_detected'
  8. else:
  9. return 1
  10.  
  11.  
  12. if(is_Rtype(instruction)=='Label_detected'):
  13. instParts=instruction.replace(',','').split()
  14. op='000000'
  15. rs=Registers[instParts[3]]
  16. rt=Registers[instParts[4]]
  17. rd=Registers[instParts[2]]
  18. shamt='00000'
  19. funct=R_Funct[instParts[1]]
  20. return op + rs + rt + rd + shamt + funct
RAW Paste Data