Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. regs:
  2. instr ptr (ip)
  3. stack ptr (sp)
  4. alternative input (ai)
  5.  
  6. instructions:
  7. arith:
  8.  
  9. | immediate operand
  10. || clear input
  11. ||| flip input
  12. |||| offset (from sp)
  13. 00xxx fCFddddd iCFss2ss iCFss1ss
  14. op ||| flip ai (before performing the arith computation)
  15. || clear ai (same as above)
  16. | flip output (that gets written to the dest)
  17.  
  18. b = ai & 1
  19.  
  20. dst,ai = 0x1234DEAD is the same as dst = 0x1234, ai = 0xDEAD
  21.  
  22. 000: dst,ai = s1 + s2 + b
  23. 001: dst,ai = s1 * s2 + r
  24. 010: dst,ai = s1 << s2 | ai
  25. 011: dst,ai = s1 >> s2 | ai
  26. 100: dst = s1 & s2
  27. 101: dst = s1 ^ s2
  28. 110: dst,ai = s1 / s2
  29. 111: dst,ai = r,s1
  30.  
  31. mem:
  32. 01wxx fCFddddd iCFss2ss iCFss1ss
  33. | read/write
  34.  
  35. 0xx: d = mem[s1 + ai << x], ai++
  36. 1xx: mem[s1 + ai << x] = s2, ai++
  37.  
  38. flow:
  39. 10sxx fCFddddd iCFss2ss iCFss1ss
  40. | set dest register to the computed address
  41.  
  42. addr = s1 + s2 << x
  43. if(s) dst = addr;
  44. if(b) ip = addr
  45.  
  46. stack:
  47. //im not too sure what kinds of instructions i should have here
  48. 11000 -------- -------- aaaaaaaa | sp += a;
  49. 1111- iiiiiiii iiiiiiii aaaaaaaa | sp += a; mem[sp] = ip; ip = i //behaves similarly to a call instr
  50. 11001 -------- -------- aaaaaaaa | sp += a; ip = mem[sp]; //behaves similarly to a ret instr when a = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement