summaryrefslogtreecommitdiff
path: root/examples/half.qua
blob: 8c2083ce6503d82ae35b6e1cf5f72c0772cf57e4 (plain)
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
x   y   speedX  speedY  color
# Re-route inputs
1   0   0       0       GA
0   1   0       0       GA
1   1   0       0       GA
# 2 duplicators create copies of 2 bits
-1  0   0       0       PU
2   0   0       0       PU
# What happens to the bottom copy (XOR)
-1  2   0       0       GA
2   3   0       0       GA
3   2   0       0       GA
4   3   0       0       GA
3   -1  0       0       GA
4   -2  0       0       GA
-3  -1  0       0       GA
-4  -2  0       0       GA
-4  3   0       0       !xor.qua # Outputs to 2, 15
# What happens to the top copy (AND)
-1  -3  0       0       GA
2   -4  0       0       GA
-9  -3  0       0       GA
-10 -4  0       0       GA
-9  -2  0       0       CY
-9  -1  0       0       CY
-10 15  0       0       !and.qua # Outputs to -10, 18
-10 22  0       0       GA
-5  22  0       0       PU
-5  21  0       0       RE
# Delay the top copy (so lines up with the bottom one)
-5  26  0       0       GA
1   26  0       0       GA
1   22  0       0       GA
-2  22  0       0       GA
-2  23  0       0       CY
-2  24  0       0       CY
-2  26  0       0       CY
# A HALF-ADDER B = (A AND B, A XOR B)
# Inputs:  0, 0
#          1, 0
# Outputs: -2, 26
#          -1, 26
# Time:    90