diff options
Diffstat (limited to 'examples/half.qua')
-rw-r--r-- | examples/half.qua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/half.qua b/examples/half.qua new file mode 100644 index 0000000..eb23a6b --- /dev/null +++ b/examples/half.qua @@ -0,0 +1,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 !examples/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 !examples/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
\ No newline at end of file |