logigate/tests/fixtures/v1-project.json

3424 lines
45 KiB
JSON
Raw Permalink Normal View History

{
"version": 1,
"name": "Compat fixture",
"components": [
{
"symbol": "box",
"id": "main",
"name": "Main",
"nodes": [
{
"id": "n1",
"kind": "note",
"x": 0,
"y": -4,
"label": "Click a switch to flip it. NAND is the only gate:\nbuild the rest from it and save them as components."
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 0,
"label": "A",
"on": true
},
{
"id": "n3",
"kind": "input",
"x": 0,
"y": 2,
"label": "B"
},
{
"id": "n4",
"kind": "nand",
"x": 5,
"y": 0
},
{
"id": "n7",
"kind": "lamp",
"x": 12,
"y": 1
}
],
"wires": [
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "a"
},
"pts": [
[
3,
0
],
[
3,
-2
],
[
4,
-2
],
[
4,
0
]
]
},
{
"id": "w6",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "b"
},
"color": "orange"
},
{
"id": "w8",
"from": {
"node": "n4",
"pin": "q"
},
"to": {
"node": "n7",
"pin": "a"
}
}
],
"face": true
},
{
"symbol": "not",
"id": "ex-not",
"name": "NOT",
"group": "Gates",
"description": "Inverter: a NAND with both inputs tied together.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 1,
"label": "A"
},
{
"id": "n2",
"kind": "nand",
"x": 5,
"y": 0
},
{
"id": "n5",
"kind": "output",
"x": 11,
"y": 1,
"label": "Q"
}
],
"wires": [
{
"id": "w3",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n2",
"pin": "a"
}
},
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n2",
"pin": "b"
}
},
{
"id": "w6",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n5",
"pin": "a"
}
}
]
},
{
"symbol": "and",
"id": "ex-and",
"name": "AND",
"group": "Gates",
"description": "NAND followed by NOT.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 2,
"label": "B"
},
{
"id": "n3",
"kind": "nand",
"x": 5,
"y": 0
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-not",
"x": 11,
"y": 1
},
{
"id": "n8",
"kind": "output",
"x": 16,
"y": 1,
"label": "Q"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "a"
}
},
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "b"
}
},
{
"id": "w7",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w9",
"from": {
"node": "n6",
"pin": "n5"
},
"to": {
"node": "n8",
"pin": "a"
}
}
]
},
{
"symbol": "or",
"id": "ex-or",
"name": "OR",
"group": "Gates",
"description": "De Morgan: NAND of the inverted inputs.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 4,
"label": "B"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-not",
"x": 5,
"y": 0
},
{
"id": "n5",
"kind": "chip",
"chip": "ex-not",
"x": 5,
"y": 4
},
{
"id": "n7",
"kind": "nand",
"x": 11,
"y": 1
},
{
"id": "n10",
"kind": "output",
"x": 17,
"y": 2,
"label": "Q"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w6",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n5",
"pin": "n1"
}
},
{
"id": "w8",
"from": {
"node": "n3",
"pin": "n5"
},
"to": {
"node": "n7",
"pin": "a"
}
},
{
"id": "w9",
"from": {
"node": "n5",
"pin": "n5"
},
"to": {
"node": "n7",
"pin": "b"
}
},
{
"id": "w11",
"from": {
"node": "n7",
"pin": "q"
},
"to": {
"node": "n10",
"pin": "a"
}
}
]
},
{
"symbol": "nor",
"id": "ex-nor",
"name": "NOR",
"group": "Gates",
"description": "OR followed by NOT.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 2,
"label": "B"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-or",
"x": 5,
"y": 0
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-not",
"x": 11,
"y": 1
},
{
"id": "n8",
"kind": "output",
"x": 16,
"y": 1,
"label": "Q"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n2"
}
},
{
"id": "w7",
"from": {
"node": "n3",
"pin": "n10"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w9",
"from": {
"node": "n6",
"pin": "n5"
},
"to": {
"node": "n8",
"pin": "a"
}
}
]
},
{
"symbol": "xor",
"id": "ex-xor",
"name": "XOR",
"group": "Gates",
"description": "Exclusive OR from four NANDs: 1 when exactly one input is 1.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 1,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 7,
"label": "B"
},
{
"id": "n3",
"kind": "nand",
"x": 5,
"y": 3
},
{
"id": "n6",
"kind": "nand",
"x": 12,
"y": 1
},
{
"id": "n9",
"kind": "nand",
"x": 12,
"y": 5
},
{
"id": "n12",
"kind": "nand",
"x": 19,
"y": 3
},
{
"id": "n15",
"kind": "output",
"x": 25,
"y": 4,
"label": "Q"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "a"
}
},
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "b"
}
},
{
"id": "w7",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "a"
}
},
{
"id": "w8",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "b"
}
},
{
"id": "w10",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n9",
"pin": "a"
}
},
{
"id": "w11",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n9",
"pin": "b"
}
},
{
"id": "w13",
"from": {
"node": "n6",
"pin": "q"
},
"to": {
"node": "n12",
"pin": "a"
}
},
{
"id": "w14",
"from": {
"node": "n9",
"pin": "q"
},
"to": {
"node": "n12",
"pin": "b"
}
},
{
"id": "w16",
"from": {
"node": "n12",
"pin": "q"
},
"to": {
"node": "n15",
"pin": "a"
}
}
]
},
{
"symbol": "xnor",
"id": "ex-xnor",
"name": "XNOR",
"group": "Gates",
"description": "XOR followed by NOT: 1 when both inputs are equal.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 2,
"label": "B"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-xor",
"x": 5,
"y": 0
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-not",
"x": 11,
"y": 1
},
{
"id": "n8",
"kind": "output",
"x": 16,
"y": 1,
"label": "Q"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n2"
}
},
{
"id": "w7",
"from": {
"node": "n3",
"pin": "n15"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w9",
"from": {
"node": "n6",
"pin": "n5"
},
"to": {
"node": "n8",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-mux",
"name": "Mux",
"group": "Routing",
"description": "Selector: Q = A when S is 0, Q = B when S is 1.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 4,
"label": "B"
},
{
"id": "n3",
"kind": "input",
"x": 0,
"y": 8,
"label": "S"
},
{
"id": "n4",
"kind": "chip",
"chip": "ex-not",
"x": 4,
"y": 8
},
{
"id": "n6",
"kind": "nand",
"x": 10,
"y": 0
},
{
"id": "n9",
"kind": "nand",
"x": 10,
"y": 4
},
{
"id": "n12",
"kind": "nand",
"x": 17,
"y": 2
},
{
"id": "n15",
"kind": "output",
"x": 23,
"y": 3,
"label": "Q"
}
],
"wires": [
{
"id": "w5",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "n1"
}
},
{
"id": "w7",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "a"
}
},
{
"id": "w8",
"from": {
"node": "n4",
"pin": "n5"
},
"to": {
"node": "n6",
"pin": "b"
}
},
{
"id": "w10",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n9",
"pin": "a"
}
},
{
"id": "w11",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n9",
"pin": "b"
},
"pts": [
[
3,
8
],
[
3,
6
]
]
},
{
"id": "w13",
"from": {
"node": "n6",
"pin": "q"
},
"to": {
"node": "n12",
"pin": "a"
}
},
{
"id": "w14",
"from": {
"node": "n9",
"pin": "q"
},
"to": {
"node": "n12",
"pin": "b"
}
},
{
"id": "w16",
"from": {
"node": "n12",
"pin": "q"
},
"to": {
"node": "n15",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-ha",
"name": "Half Adder",
"group": "Arithmetic",
"description": "Adds two bits: S is the sum bit, C the carry.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 2,
"label": "B"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-xor",
"x": 6,
"y": 0
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-and",
"x": 6,
"y": 5
},
{
"id": "n9",
"kind": "output",
"x": 13,
"y": 1,
"label": "S"
},
{
"id": "n11",
"kind": "output",
"x": 13,
"y": 6,
"label": "C"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n2"
}
},
{
"id": "w7",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n1"
},
"pts": [
[
3,
0
],
[
3,
5
]
]
},
{
"id": "w8",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n2"
},
"pts": [
[
4,
2
],
[
4,
7
]
]
},
{
"id": "w10",
"from": {
"node": "n3",
"pin": "n15"
},
"to": {
"node": "n9",
"pin": "a"
}
},
{
"id": "w12",
"from": {
"node": "n6",
"pin": "n8"
},
"to": {
"node": "n11",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-fa",
"name": "Full Adder",
"group": "Arithmetic",
"description": "Adds three bits (A, B and carry in) with two half adders.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 2,
"label": "B"
},
{
"id": "n3",
"kind": "input",
"x": 0,
"y": 6,
"label": "Cin"
},
{
"id": "n4",
"kind": "chip",
"chip": "ex-ha",
"x": 5,
"y": 0
},
{
"id": "n7",
"kind": "chip",
"chip": "ex-ha",
"x": 16,
"y": 3
},
{
"id": "n10",
"kind": "chip",
"chip": "ex-or",
"x": 26,
"y": 5
},
{
"id": "n13",
"kind": "output",
"x": 33,
"y": 3,
"label": "S"
},
{
"id": "n15",
"kind": "output",
"x": 33,
"y": 6,
"label": "Cout"
}
],
"wires": [
{
"id": "w5",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "n1"
}
},
{
"id": "w6",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "n2"
}
},
{
"id": "w8",
"from": {
"node": "n4",
"pin": "n9"
},
"to": {
"node": "n7",
"pin": "n1"
}
},
{
"id": "w9",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n7",
"pin": "n2"
}
},
{
"id": "w11",
"from": {
"node": "n4",
"pin": "n11"
},
"to": {
"node": "n10",
"pin": "n1"
},
"pts": [
[
15,
1
],
[
15,
5
]
]
},
{
"id": "w12",
"from": {
"node": "n7",
"pin": "n11"
},
"to": {
"node": "n10",
"pin": "n2"
}
},
{
"id": "w14",
"from": {
"node": "n7",
"pin": "n9"
},
"to": {
"node": "n13",
"pin": "a"
}
},
{
"id": "w16",
"from": {
"node": "n10",
"pin": "n10"
},
"to": {
"node": "n15",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-sr",
"name": "SR Latch",
"group": "Memory",
"description": "Stores one bit. S sets Q to 1, R resets it to 0; with both at 0 it remembers.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "S"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 7,
"label": "R"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-not",
"x": 4,
"y": 0
},
{
"id": "n5",
"kind": "chip",
"chip": "ex-not",
"x": 4,
"y": 7
},
{
"id": "n7",
"kind": "nand",
"x": 10,
"y": 5
},
{
"id": "n8",
"kind": "nand",
"x": 10,
"y": 0
},
{
"id": "n13",
"kind": "output",
"x": 19,
"y": 1,
"label": "Q"
},
{
"id": "n15",
"kind": "output",
"x": 19,
"y": 6,
"label": "Q̄"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w6",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n5",
"pin": "n1"
}
},
{
"id": "w9",
"from": {
"node": "n3",
"pin": "n5"
},
"to": {
"node": "n8",
"pin": "a"
}
},
{
"id": "w10",
"from": {
"node": "n7",
"pin": "q"
},
"to": {
"node": "n8",
"pin": "b"
},
"pts": [
[
15,
6
],
[
15,
4
],
[
8,
4
],
[
8,
2
]
]
},
{
"id": "w11",
"from": {
"node": "n8",
"pin": "q"
},
"to": {
"node": "n7",
"pin": "a"
},
"pts": [
[
16,
1
],
[
16,
3
],
[
9,
3
],
[
9,
5
]
]
},
{
"id": "w12",
"from": {
"node": "n5",
"pin": "n5"
},
"to": {
"node": "n7",
"pin": "b"
}
},
{
"id": "w14",
"from": {
"node": "n8",
"pin": "q"
},
"to": {
"node": "n13",
"pin": "a"
}
},
{
"id": "w16",
"from": {
"node": "n7",
"pin": "q"
},
"to": {
"node": "n15",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-dlatch",
"name": "D Latch",
"group": "Memory",
"description": "While E is 1, Q follows D. When E drops to 0, Q keeps the last value.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "D"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 4,
"label": "E"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-and",
"x": 8,
"y": 0
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-not",
"x": 4,
"y": 8
},
{
"id": "n8",
"kind": "chip",
"chip": "ex-and",
"x": 8,
"y": 6
},
{
"id": "n11",
"kind": "chip",
"chip": "ex-sr",
"x": 15,
"y": 1
},
{
"id": "n14",
"kind": "output",
"x": 25,
"y": 1,
"label": "Q"
},
{
"id": "n16",
"kind": "output",
"x": 25,
"y": 3,
"label": "Q̄"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n2"
}
},
{
"id": "w7",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w9",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n8",
"pin": "n1"
}
},
{
"id": "w10",
"from": {
"node": "n6",
"pin": "n5"
},
"to": {
"node": "n8",
"pin": "n2"
}
},
{
"id": "w12",
"from": {
"node": "n3",
"pin": "n8"
},
"to": {
"node": "n11",
"pin": "n1"
}
},
{
"id": "w13",
"from": {
"node": "n8",
"pin": "n8"
},
"to": {
"node": "n11",
"pin": "n2"
}
},
{
"id": "w15",
"from": {
"node": "n11",
"pin": "n13"
},
"to": {
"node": "n14",
"pin": "a"
}
},
{
"id": "w17",
"from": {
"node": "n11",
"pin": "n15"
},
"to": {
"node": "n16",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-dff",
"name": "D Flip-Flop",
"group": "Memory",
"description": "Takes over D at the rising edge of CLK and holds it until the next rising edge. Two D latches (master, slave).",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "D"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 4,
"label": "CLK"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-not",
"x": 5,
"y": 4
},
{
"id": "n5",
"kind": "chip",
"chip": "ex-dlatch",
"x": 11,
"y": 0
},
{
"id": "n8",
"kind": "chip",
"chip": "ex-dlatch",
"x": 21,
"y": 0
},
{
"id": "n11",
"kind": "output",
"x": 30,
"y": 0,
"label": "Q"
},
{
"id": "n13",
"kind": "output",
"x": 30,
"y": 2,
"label": "Q̄"
}
],
"wires": [
{
"id": "w4",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n3",
"pin": "n1"
}
},
{
"id": "w6",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n5",
"pin": "n1"
}
},
{
"id": "w7",
"from": {
"node": "n3",
"pin": "n5"
},
"to": {
"node": "n5",
"pin": "n2"
}
},
{
"id": "w9",
"from": {
"node": "n5",
"pin": "n14"
},
"to": {
"node": "n8",
"pin": "n1"
}
},
{
"id": "w10",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n8",
"pin": "n2"
},
"pts": [
[
3,
6
],
[
19,
6
]
]
},
{
"id": "w12",
"from": {
"node": "n8",
"pin": "n14"
},
"to": {
"node": "n11",
"pin": "a"
}
},
{
"id": "w14",
"from": {
"node": "n8",
"pin": "n16"
},
"to": {
"node": "n13",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-reg4",
"name": "Register 4",
"group": "Memory",
"description": "Four D flip-flops on one clock: stores a 4-bit number.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "D0"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 4,
"label": "D1"
},
{
"id": "n3",
"kind": "input",
"x": 0,
"y": 8,
"label": "D2"
},
{
"id": "n4",
"kind": "input",
"x": 0,
"y": 12,
"label": "D3"
},
{
"id": "n5",
"kind": "input",
"x": 0,
"y": 16,
"label": "CLK"
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-dff",
"x": 6,
"y": 0
},
{
"id": "n9",
"kind": "output",
"x": 18,
"y": 0,
"label": "Q0"
},
{
"id": "n11",
"kind": "chip",
"chip": "ex-dff",
"x": 6,
"y": 4
},
{
"id": "n14",
"kind": "output",
"x": 18,
"y": 4,
"label": "Q1"
},
{
"id": "n16",
"kind": "chip",
"chip": "ex-dff",
"x": 6,
"y": 8
},
{
"id": "n19",
"kind": "output",
"x": 18,
"y": 8,
"label": "Q2"
},
{
"id": "n21",
"kind": "chip",
"chip": "ex-dff",
"x": 6,
"y": 12
},
{
"id": "n24",
"kind": "output",
"x": 18,
"y": 12,
"label": "Q3"
}
],
"wires": [
{
"id": "w7",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w8",
"from": {
"node": "n5",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n2"
}
},
{
"id": "w10",
"from": {
"node": "n6",
"pin": "n11"
},
"to": {
"node": "n9",
"pin": "a"
}
},
{
"id": "w12",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n11",
"pin": "n1"
}
},
{
"id": "w13",
"from": {
"node": "n5",
"pin": "q"
},
"to": {
"node": "n11",
"pin": "n2"
}
},
{
"id": "w15",
"from": {
"node": "n11",
"pin": "n11"
},
"to": {
"node": "n14",
"pin": "a"
}
},
{
"id": "w17",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n16",
"pin": "n1"
}
},
{
"id": "w18",
"from": {
"node": "n5",
"pin": "q"
},
"to": {
"node": "n16",
"pin": "n2"
}
},
{
"id": "w20",
"from": {
"node": "n16",
"pin": "n11"
},
"to": {
"node": "n19",
"pin": "a"
}
},
{
"id": "w22",
"from": {
"node": "n4",
"pin": "q"
},
"to": {
"node": "n21",
"pin": "n1"
}
},
{
"id": "w23",
"from": {
"node": "n5",
"pin": "q"
},
"to": {
"node": "n21",
"pin": "n2"
}
},
{
"id": "w25",
"from": {
"node": "n21",
"pin": "n11"
},
"to": {
"node": "n24",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-inc4",
"name": "Increment 4",
"group": "Arithmetic",
"description": "Adds 1 to a 4-bit number with a chain of half adders.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A0"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 4,
"label": "A1"
},
{
"id": "n3",
"kind": "input",
"x": 0,
"y": 8,
"label": "A2"
},
{
"id": "n4",
"kind": "input",
"x": 0,
"y": 12,
"label": "A3"
},
{
"id": "n5",
"kind": "high",
"x": 3,
"y": 1
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-ha",
"x": 6,
"y": 0
},
{
"id": "n9",
"kind": "output",
"x": 43,
"y": 0,
"label": "S0"
},
{
"id": "n11",
"kind": "chip",
"chip": "ex-ha",
"x": 15,
"y": 4
},
{
"id": "n14",
"kind": "output",
"x": 43,
"y": 4,
"label": "S1"
},
{
"id": "n16",
"kind": "chip",
"chip": "ex-ha",
"x": 24,
"y": 8
},
{
"id": "n19",
"kind": "output",
"x": 43,
"y": 8,
"label": "S2"
},
{
"id": "n21",
"kind": "chip",
"chip": "ex-ha",
"x": 33,
"y": 12
},
{
"id": "n24",
"kind": "output",
"x": 43,
"y": 12,
"label": "S3"
},
{
"id": "n26",
"kind": "output",
"x": 43,
"y": 16,
"label": "Cout"
}
],
"wires": [
{
"id": "w7",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w8",
"from": {
"node": "n5",
"pin": "q"
},
"to": {
"node": "n6",
"pin": "n2"
}
},
{
"id": "w10",
"from": {
"node": "n6",
"pin": "n9"
},
"to": {
"node": "n9",
"pin": "a"
}
},
{
"id": "w12",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n11",
"pin": "n1"
}
},
{
"id": "w13",
"from": {
"node": "n6",
"pin": "n11"
},
"to": {
"node": "n11",
"pin": "n2"
}
},
{
"id": "w15",
"from": {
"node": "n11",
"pin": "n9"
},
"to": {
"node": "n14",
"pin": "a"
}
},
{
"id": "w17",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n16",
"pin": "n1"
}
},
{
"id": "w18",
"from": {
"node": "n11",
"pin": "n11"
},
"to": {
"node": "n16",
"pin": "n2"
}
},
{
"id": "w20",
"from": {
"node": "n16",
"pin": "n9"
},
"to": {
"node": "n19",
"pin": "a"
}
},
{
"id": "w22",
"from": {
"node": "n4",
"pin": "q"
},
"to": {
"node": "n21",
"pin": "n1"
}
},
{
"id": "w23",
"from": {
"node": "n16",
"pin": "n11"
},
"to": {
"node": "n21",
"pin": "n2"
}
},
{
"id": "w25",
"from": {
"node": "n21",
"pin": "n9"
},
"to": {
"node": "n24",
"pin": "a"
}
},
{
"id": "w27",
"from": {
"node": "n21",
"pin": "n11"
},
"to": {
"node": "n26",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-add4",
"name": "Adder 4",
"group": "Arithmetic",
"description": "Adds two 4-bit numbers with four full adders (ripple carry).",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 0,
"label": "A0"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 2,
"label": "A1"
},
{
"id": "n3",
"kind": "input",
"x": 0,
"y": 4,
"label": "A2"
},
{
"id": "n4",
"kind": "input",
"x": 0,
"y": 6,
"label": "A3"
},
{
"id": "n5",
"kind": "input",
"x": 0,
"y": 8,
"label": "B0"
},
{
"id": "n6",
"kind": "input",
"x": 0,
"y": 10,
"label": "B1"
},
{
"id": "n7",
"kind": "input",
"x": 0,
"y": 12,
"label": "B2"
},
{
"id": "n8",
"kind": "input",
"x": 0,
"y": 14,
"label": "B3"
},
{
"id": "n9",
"kind": "input",
"x": 0,
"y": 16,
"label": "Cin"
},
{
"id": "n10",
"kind": "chip",
"chip": "ex-fa",
"x": 14,
"y": 20
},
{
"id": "n14",
"kind": "output",
"x": 28,
"y": 20,
"label": "S0"
},
{
"id": "n16",
"kind": "chip",
"chip": "ex-fa",
"x": 14,
"y": 24
},
{
"id": "n20",
"kind": "output",
"x": 28,
"y": 24,
"label": "S1"
},
{
"id": "n22",
"kind": "chip",
"chip": "ex-fa",
"x": 14,
"y": 28
},
{
"id": "n26",
"kind": "output",
"x": 28,
"y": 28,
"label": "S2"
},
{
"id": "n28",
"kind": "chip",
"chip": "ex-fa",
"x": 14,
"y": 32
},
{
"id": "n32",
"kind": "output",
"x": 28,
"y": 32,
"label": "S3"
},
{
"id": "n34",
"kind": "output",
"x": 28,
"y": 36,
"label": "Cout"
}
],
"wires": [
{
"id": "w11",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n10",
"pin": "n1"
},
"pts": [
[
3,
0
],
[
3,
20
]
]
},
{
"id": "w12",
"from": {
"node": "n5",
"pin": "q"
},
"to": {
"node": "n10",
"pin": "n2"
},
"pts": [
[
8,
8
],
[
8,
21
]
]
},
{
"id": "w13",
"from": {
"node": "n9",
"pin": "q"
},
"to": {
"node": "n10",
"pin": "n3"
},
"pts": [
[
13,
16
],
[
13,
22
]
]
},
{
"id": "w15",
"from": {
"node": "n10",
"pin": "n13"
},
"to": {
"node": "n14",
"pin": "a"
}
},
{
"id": "w17",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n16",
"pin": "n1"
},
"pts": [
[
4,
2
],
[
4,
24
]
]
},
{
"id": "w18",
"from": {
"node": "n6",
"pin": "q"
},
"to": {
"node": "n16",
"pin": "n2"
},
"pts": [
[
9,
10
],
[
9,
25
]
]
},
{
"id": "w19",
"from": {
"node": "n10",
"pin": "n15"
},
"to": {
"node": "n16",
"pin": "n3"
},
"pts": [
[
24,
21
],
[
24,
23
],
[
12,
23
],
[
12,
26
]
]
},
{
"id": "w21",
"from": {
"node": "n16",
"pin": "n13"
},
"to": {
"node": "n20",
"pin": "a"
}
},
{
"id": "w23",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n22",
"pin": "n1"
},
"pts": [
[
5,
4
],
[
5,
28
]
]
},
{
"id": "w24",
"from": {
"node": "n7",
"pin": "q"
},
"to": {
"node": "n22",
"pin": "n2"
},
"pts": [
[
10,
12
],
[
10,
29
]
]
},
{
"id": "w25",
"from": {
"node": "n16",
"pin": "n15"
},
"to": {
"node": "n22",
"pin": "n3"
},
"pts": [
[
24,
25
],
[
24,
27
],
[
12,
27
],
[
12,
30
]
]
},
{
"id": "w27",
"from": {
"node": "n22",
"pin": "n13"
},
"to": {
"node": "n26",
"pin": "a"
}
},
{
"id": "w29",
"from": {
"node": "n4",
"pin": "q"
},
"to": {
"node": "n28",
"pin": "n1"
},
"pts": [
[
6,
6
],
[
6,
32
]
]
},
{
"id": "w30",
"from": {
"node": "n8",
"pin": "q"
},
"to": {
"node": "n28",
"pin": "n2"
},
"pts": [
[
11,
14
],
[
11,
33
]
]
},
{
"id": "w31",
"from": {
"node": "n22",
"pin": "n15"
},
"to": {
"node": "n28",
"pin": "n3"
},
"pts": [
[
24,
29
],
[
24,
31
],
[
12,
31
],
[
12,
34
]
]
},
{
"id": "w33",
"from": {
"node": "n28",
"pin": "n13"
},
"to": {
"node": "n32",
"pin": "a"
}
},
{
"id": "w35",
"from": {
"node": "n28",
"pin": "n15"
},
"to": {
"node": "n34",
"pin": "a"
}
}
]
},
{
"symbol": "box",
"id": "ex-cnt4",
"name": "Counter 4",
"group": "Memory",
"description": "Counts 0 to 15 on each rising clock edge. RST = 1 sets it back to 0 at the next edge. Its display shows on the box.",
"nodes": [
{
"id": "n1",
"kind": "input",
"x": 0,
"y": 21,
"label": "CLK"
},
{
"id": "n2",
"kind": "input",
"x": 0,
"y": 24,
"label": "RST"
},
{
"id": "n3",
"kind": "chip",
"chip": "ex-inc4",
"x": 6,
"y": 0
},
{
"id": "n4",
"kind": "chip",
"chip": "ex-not",
"x": 4,
"y": 24
},
{
"id": "n6",
"kind": "chip",
"chip": "ex-and",
"x": 22,
"y": 0
},
{
"id": "n9",
"kind": "chip",
"chip": "ex-and",
"x": 22,
"y": 5
},
{
"id": "n12",
"kind": "chip",
"chip": "ex-and",
"x": 22,
"y": 10
},
{
"id": "n15",
"kind": "chip",
"chip": "ex-and",
"x": 22,
"y": 15
},
{
"id": "n18",
"kind": "chip",
"chip": "ex-reg4",
"x": 32,
"y": 0
},
{
"id": "n25",
"kind": "output",
"x": 52,
"y": 0,
"label": "Q0"
},
{
"id": "n28",
"kind": "output",
"x": 52,
"y": 2,
"label": "Q1"
},
{
"id": "n31",
"kind": "output",
"x": 52,
"y": 4,
"label": "Q2"
},
{
"id": "n34",
"kind": "output",
"x": 52,
"y": 6,
"label": "Q3"
},
{
"id": "n36",
"kind": "hex",
"x": 47,
"y": 8,
"label": "count"
}
],
"wires": [
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "n1"
}
},
{
"id": "w7",
"from": {
"node": "n3",
"pin": "n9"
},
"to": {
"node": "n6",
"pin": "n1"
}
},
{
"id": "w8",
"from": {
"node": "n4",
"pin": "n5"
},
"to": {
"node": "n6",
"pin": "n2"
},
"pts": [
[
20,
24
],
[
20,
2
]
]
},
{
"id": "w10",
"from": {
"node": "n3",
"pin": "n14"
},
"to": {
"node": "n9",
"pin": "n1"
},
"pts": [
[
17,
1
],
[
17,
5
]
]
},
{
"id": "w11",
"from": {
"node": "n4",
"pin": "n5"
},
"to": {
"node": "n9",
"pin": "n2"
},
"pts": [
[
20,
24
],
[
20,
7
]
]
},
{
"id": "w13",
"from": {
"node": "n3",
"pin": "n19"
},
"to": {
"node": "n12",
"pin": "n1"
},
"pts": [
[
18,
2
],
[
18,
10
]
]
},
{
"id": "w14",
"from": {
"node": "n4",
"pin": "n5"
},
"to": {
"node": "n12",
"pin": "n2"
},
"pts": [
[
20,
24
],
[
20,
12
]
]
},
{
"id": "w16",
"from": {
"node": "n3",
"pin": "n24"
},
"to": {
"node": "n15",
"pin": "n1"
},
"pts": [
[
19,
3
],
[
19,
15
]
]
},
{
"id": "w17",
"from": {
"node": "n4",
"pin": "n5"
},
"to": {
"node": "n15",
"pin": "n2"
},
"pts": [
[
20,
24
],
[
20,
17
]
]
},
{
"id": "w19",
"from": {
"node": "n6",
"pin": "n8"
},
"to": {
"node": "n18",
"pin": "n1"
},
"pts": [
[
27,
1
],
[
27,
0
]
]
},
{
"id": "w20",
"from": {
"node": "n9",
"pin": "n8"
},
"to": {
"node": "n18",
"pin": "n2"
},
"pts": [
[
28,
6
],
[
28,
1
]
]
},
{
"id": "w21",
"from": {
"node": "n12",
"pin": "n8"
},
"to": {
"node": "n18",
"pin": "n3"
},
"pts": [
[
29,
11
],
[
29,
2
]
]
},
{
"id": "w22",
"from": {
"node": "n15",
"pin": "n8"
},
"to": {
"node": "n18",
"pin": "n4"
},
"pts": [
[
30,
16
],
[
30,
3
]
]
},
{
"id": "w23",
"from": {
"node": "n1",
"pin": "q"
},
"to": {
"node": "n18",
"pin": "n5"
},
"pts": [
[
31,
21
],
[
31,
4
]
]
},
{
"id": "w24",
"from": {
"node": "n18",
"pin": "n9"
},
"to": {
"node": "n3",
"pin": "n1"
},
"pts": [
[
41,
0
],
[
41,
-1
],
[
5,
-1
],
[
5,
0
]
]
},
{
"id": "w26",
"from": {
"node": "n18",
"pin": "n9"
},
"to": {
"node": "n25",
"pin": "a"
}
},
{
"id": "w27",
"from": {
"node": "n18",
"pin": "n14"
},
"to": {
"node": "n3",
"pin": "n2"
},
"pts": [
[
42,
1
],
[
42,
-2
],
[
4,
-2
],
[
4,
1
]
]
},
{
"id": "w29",
"from": {
"node": "n18",
"pin": "n14"
},
"to": {
"node": "n28",
"pin": "a"
},
"pts": [
[
49,
1
],
[
49,
2
]
]
},
{
"id": "w30",
"from": {
"node": "n18",
"pin": "n19"
},
"to": {
"node": "n3",
"pin": "n3"
},
"pts": [
[
43,
2
],
[
43,
-3
],
[
3,
-3
],
[
3,
2
]
]
},
{
"id": "w32",
"from": {
"node": "n18",
"pin": "n19"
},
"to": {
"node": "n31",
"pin": "a"
},
"pts": [
[
48,
2
],
[
48,
4
]
]
},
{
"id": "w33",
"from": {
"node": "n18",
"pin": "n24"
},
"to": {
"node": "n3",
"pin": "n4"
},
"pts": [
[
44,
3
],
[
44,
-4
],
[
2,
-4
],
[
2,
3
]
]
},
{
"id": "w35",
"from": {
"node": "n18",
"pin": "n24"
},
"to": {
"node": "n34",
"pin": "a"
},
"pts": [
[
47,
3
],
[
47,
6
]
]
},
{
"id": "w37",
"from": {
"node": "n18",
"pin": "n9"
},
"to": {
"node": "n36",
"pin": "b0"
},
"pts": [
[
41,
0
],
[
41,
8
]
]
},
{
"id": "w38",
"from": {
"node": "n18",
"pin": "n14"
},
"to": {
"node": "n36",
"pin": "b1"
},
"pts": [
[
42,
1
],
[
42,
9
]
]
},
{
"id": "w39",
"from": {
"node": "n18",
"pin": "n19"
},
"to": {
"node": "n36",
"pin": "b2"
},
"pts": [
[
43,
2
],
[
43,
10
]
]
},
{
"id": "w40",
"from": {
"node": "n18",
"pin": "n24"
},
"to": {
"node": "n36",
"pin": "b3"
},
"pts": [
[
44,
3
],
[
44,
11
]
]
}
]
},
{
"symbol": "box",
"id": "ex-demo-counter",
"name": "Demo: Counter",
"group": "Demos",
"description": "A clock drives the 4-bit counter; the hex display shows the count.",
"nodes": [
{
"id": "n1",
"kind": "note",
"x": 0,
"y": -3,
"label": "The clock drives a 4-bit counter.\nHold Reset during a tick to go back to 0."
},
{
"id": "n2",
"kind": "clock",
"x": 0,
"y": 2
},
{
"id": "n3",
"kind": "button",
"x": 0,
"y": 6,
"label": "Reset"
},
{
"id": "n4",
"kind": "chip",
"chip": "ex-cnt4",
"x": 8,
"y": 2
},
{
"id": "n7",
"kind": "hex",
"x": 24,
"y": 2
}
],
"wires": [
{
"id": "w5",
"from": {
"node": "n2",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "n1"
}
},
{
"id": "w6",
"from": {
"node": "n3",
"pin": "q"
},
"to": {
"node": "n4",
"pin": "n2"
}
},
{
"id": "w8",
"from": {
"node": "n4",
"pin": "n25"
},
"to": {
"node": "n7",
"pin": "b0"
}
},
{
"id": "w9",
"from": {
"node": "n4",
"pin": "n28"
},
"to": {
"node": "n7",
"pin": "b1"
}
},
{
"id": "w10",
"from": {
"node": "n4",
"pin": "n31"
},
"to": {
"node": "n7",
"pin": "b2"
}
},
{
"id": "w11",
"from": {
"node": "n4",
"pin": "n34"
},
"to": {
"node": "n7",
"pin": "b3"
}
}
]
},
{
"id": "cnco3azcm",
"name": "My AND",
"symbol": "and",
"description": "Q is 1 only when A and B are both 1.",
"challenge": "and",
"nodes": [
{
"id": "n7a7wi4n6",
"kind": "input",
"x": 0,
"y": 0,
"label": "A"
},
{
"id": "nn9hpmgie",
"kind": "input",
"x": 0,
"y": 3,
"label": "B"
},
{
"id": "n5mge9udp",
"kind": "output",
"x": 24,
"y": 0,
"label": "Q"
}
],
"wires": []
}
],
"openId": "main",
"settings": {
"symbols": "ansi",
"flow": true
},
"solved": [
"not"
]
}