save.json
contains the save fornandgame
- Only returns Negative (
0
) if both signals (AND
) are positive
Input A | Input B | Output |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
- Note: The "spinny magnetic field" is indeed a magnetic field that attracts when powered
Input | Output |
---|---|
0 | 1 |
1 | 0 |
- Only returns Positive (
1
) if both signals (AND
) are positive
Input A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
- Returns Positive (
1
) if either signals (OR
) are positive
Input A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
- We invert the inputs into
NAND
- Returns Positive (
1
) when the inputs are different
Input A | Input B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
- Sort of a "both gates must agree" to pass
- Adds
2
1-bit
numbers
A | B | Sum (High) | Sum (Low) |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 1 |
- Adds
3
1-bit
numbers into a2-bit
value
A | B | C_in | Sum (S) | Carry-out (C_out) |
---|---|---|---|---|
0 | 0 | 0 | 0 | 0 |
0 | 0 | 1 | 1 | 0 |
0 | 1 | 0 | 1 | 0 |
0 | 1 | 1 | 0 | 1 |
1 | 0 | 0 | 1 | 0 |
1 | 0 | 1 | 0 | 1 |
1 | 1 | 0 | 0 | 1 |
1 | 1 | 1 | 1 | 1 |
- Adding the
1-bit
numbers together (usingadd
) and handling the high-bit seperartely- will *trigger the output high-bit* either when either addition results in the addition high-bit being triggered.
- Adds 2
2-bit
numbers and 11-bit
carry to form a3-bit
number
- Combine the
1-bit
s to form a2-bit
number - We now have 3
2-bits
and 11-bit
(connect the1-bit
tos0
)- Sum the
2-bits
and treat the output as a3-bit
and2-bit
output
- Sum the
- Add
1
to a16-bit Number
- Simply use the carry-bit (
1
)
16-bit Unsigned Integer
range:0 <= x <= 65536
16-bit Signed Integer
range:-32767 <= x <= 32767
(because it uses half for the negative-signs)- In Decimal:
- Negative Numbers are represented as
65536 - Overflow
- E.g 65536 - 65535 = 1 - represents
-1
- Negative Numbers are represented as
- In Binary:
1111111111111110
(ifMSB
==1, it is a-ve
number)
- Note: We need to add
1
due to how the 2-complement inverting works:- When inverting
1111111111111110
, we get0000000000000001
- Afterwards, we add
1
and get0000000000000010
(2
)- This is part of a "Zero Balance"
- Taking into account the sign (
1
), it is a-ve
and we get-2
-
$\therefore$ We need to "balance it out" by adding1
afterwards
- When inverting
- Output
1
only if all inputs are0
- (is this even optimal?)
- Output
1
if the MSB (15th-bit
) is1
(indicates-ve
as noted in8.
)
- The
s
(Select
) bit selects which input to select.- If
s==0
, selectd0
, ifs==1
, selectd1
- If
S | D0 | D1 | Out |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 0 | 1 | 0 |
0 | 1 | 0 | 1 |
0 | 1 | 1 | 1 |
1 | 0 | 0 | 0 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
- Use 2
AND
to conditionally select, but invert thes==0
- The
s
(Switch
) bit selects which output to output to.- If
s==0
, output toc0
, ifs==1
, output toc1
- If
S | In | D0 | D1 |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 |
1 | 1 | 0 | 1 |
- Select between 4 Logic Operations depending on
op0
andop1
op1 | op0 | Operation |
---|---|---|
0 | 0 | X AND Y |
0 | 1 | X OR Y |
1 | 0 | X XOR Y |
1 | 1 | Invert X |
- (optimal is 7 components, but this uses 8)
- Select between 4 Arithmetic Operations depending on
op0
andop1
op1 | op0 | Operation |
---|---|---|
0 | 0 | X + Y |
1 | 0 | X - Y |
0 | 1 | X + 1 |
1 | 1 | X - 1 |
- Select between 9 Arithmetic Operations depending on
op0
,op1
andu
- Also provides 2 additional flags:
- When
sw
flag is1
,X
andY
are swapped - When
zx
flag is1
, left operand is set to0
- When
u | op1 | op0 | Operation |
---|---|---|---|
0 | 0 | 0 | X AND Y |
0 | 0 | 1 | X OR Y |
0 | 1 | 0 | X XOR Y |
0 | 1 | 1 | Invert X |
1 | 0 | 0 | X + Y |
1 | 1 | 0 | X - Y |
1 | 0 | 1 | X + 1 |
1 | 1 | 1 | X - 1 |
zx | sw | Effective Operation |
---|---|---|
0 | 0 | X - Y |
0 | 1 | Y - X |
1 | 0 | 0 - Y |
1 | 1 | 0 - X |
- Given 3 flags below which each represent a condition:
Flag | Condition |
---|---|
lt | Less than zero |
eq | Equal to zero |
gt | Greater than zero |
- We want to output when 1:
lt | eq | gt | Output 1 When |
---|---|---|---|
0 | 0 | 0 | Never |
0 | 0 | 1 | X > 0 |
0 | 1 | 0 | X = 0 |
0 | 1 | 1 | X ≥ 0 |
1 | 0 | 0 | X < 0 |
1 | 0 | 1 | X ≠ 0 |
1 | 1 | 0 | X ≤ 0 |
1 | 1 | 1 | Always |
-
s=1
(set) sets output to1
-
r=1
(reset) sets output to0
-
When both
s=1,r=1
, the output takes the Previous Output
s | r | Output |
---|---|---|
1 | 0 | 1 |
0 | 1 | 0 |
1 | 1 | Previous output |
0 | 0 | Not used |
- Behaviour when we activate
r
thens
(output is0
)- When
r
is activated,Left-Nand
b=1
is set which causesLeft-Nand
to output0
and setRight-Nand
a=0
- When
s
is activated, it setsRight-Nand
b=1
. But this is not enough to change anything sinceRight-Nand
'sa=0
already
- When
- Behaviour when we activate
s
thenr
(output is1
)- When
s
is activated,Right-Nand
b=1
is set which causesRight-Nand
to output0
and setLeft-Nand
'sa=0
- When
r
is activated, it setsLeft-Nand
'sb=1
. But this is not enough to change anything sinceLeft-Nand
'sa=0
already.
- When