Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- regs:
- instr ptr (ip)
- stack ptr (sp)
- alternative input (ai)
- instructions:
- arith:
- | immediate operand
- || clear input
- ||| flip input
- |||| offset (from sp)
- 00xxx fCFddddd iCFss2ss iCFss1ss
- op ||| flip ai (before performing the arith computation)
- || clear ai (same as above)
- | flip output (that gets written to the dest)
- b = ai & 1
- dst,ai = 0x1234DEAD is the same as dst = 0x1234, ai = 0xDEAD
- 000: dst,ai = s1 + s2 + b
- 001: dst,ai = s1 * s2 + r
- 010: dst,ai = s1 << s2 | ai
- 011: dst,ai = s1 >> s2 | ai
- 100: dst = s1 & s2
- 101: dst = s1 ^ s2
- 110: dst,ai = s1 / s2
- 111: dst,ai = r,s1
- mem:
- 01wxx fCFddddd iCFss2ss iCFss1ss
- | read/write
- 0xx: d = mem[s1 + ai << x], ai++
- 1xx: mem[s1 + ai << x] = s2, ai++
- flow:
- 10sxx fCFddddd iCFss2ss iCFss1ss
- | set dest register to the computed address
- addr = s1 + s2 << x
- if(s) dst = addr;
- if(b) ip = addr
- stack:
- //im not too sure what kinds of instructions i should have here
- 11000 -------- -------- aaaaaaaa | sp += a;
- 1111- iiiiiiii iiiiiiii aaaaaaaa | sp += a; mem[sp] = ip; ip = i //behaves similarly to a call instr
- 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