-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncs
54 lines (39 loc) · 1.51 KB
/
funcs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
all funcs are of the form myfunc(num1, num2).
num can refer either to a memory location, or a constant, if 'c' is appended.
saying the following:
loc myfunc(num1, num2)
places the value from myfunc() into 'loc'
unary operators should just ignore their second and third inputs.
binary operators should just ignore their third input.
the ternary "branching" operators should be fine.
program counter is maintained in at mem[2]
constant 0 is located at mem[0]
68-bit words.
lowest 4 bits for opcode (16 opcode)
60 / 4 = 15 bits each for parameter; 2^15 absolute-addressable memory locations.
Each parameter field and dest also needs one additional bit to indicate whether or not its an immediate.
For dest, if its not an immediate, it functions as a pointer.
format: location, z, y, x, opcode
opcode = 15
z = 11111111111111110000
----------------------------------------------------
nand
and
xor
or
not
mod
add x, y, z - if z's MSB is 0, add. if 1, sub.
cshift circular shift ( XOR z is 0 means right shift, 1 means left by that much)
shift regular shift (same as above)
padding - no, pointless. we have shifts
slicing operator(?)
addifeq(x,y,z) add z to memory if x == y this is a ternary operator. joy.
addifneq(x,y,z) add z to memory if x != y
addiflt(x,y,z) add z to memory if x < y
setifeq(x,y,z) set z = memory if x == y
setifneq(x,y,z) set z = memory if x != y
setiflt(x,y,z) set z = memory if x < y
nin x if LSB of x is 1, go forward (dump the next input block); otherwise, go backwards.
dumped input block is of size
halt