{
  "schema": "digital-logic-sim-web/chip/1",
  "name": "ALU 4-BIT",
  "updatedAt": "2026-08-10T12:00:00.000Z",
  "description": {
    "id": "chip-alu-4-bit",
    "name": "ALU 4-BIT",
    "type": "custom",
    "kind": "custom",
    "size": {
      "x": 1900,
      "y": 700
    },
    "colour": "#7358ad",
    "nameLocation": "top",
    "inputPins": [
      {
        "id": "a",
        "name": "A[3:0]",
        "bits": 4,
        "direction": "input",
        "x": -2480,
        "y": -240,
        "valueDisplay": "off",
        "colour": "gray"
      },
      {
        "id": "b",
        "name": "B[3:0]",
        "bits": 4,
        "direction": "input",
        "x": -2480,
        "y": -120,
        "valueDisplay": "off",
        "colour": "gray"
      },
      {
        "id": "cin",
        "name": "CIN",
        "bits": 1,
        "direction": "input",
        "x": -2480,
        "y": 0,
        "valueDisplay": "off",
        "colour": "gray"
      },
      {
        "id": "s0",
        "name": "OP0",
        "bits": 1,
        "direction": "input",
        "x": -2480,
        "y": 120,
        "valueDisplay": "off",
        "colour": "gray"
      },
      {
        "id": "s1",
        "name": "OP1",
        "bits": 1,
        "direction": "input",
        "x": -2480,
        "y": 240,
        "valueDisplay": "off",
        "colour": "gray"
      }
    ],
    "outputPins": [
      {
        "id": "result",
        "name": "RESULT[3:0]",
        "bits": 4,
        "direction": "output",
        "x": 2480,
        "y": -180,
        "valueDisplay": "off",
        "colour": "green"
      },
      {
        "id": "carry",
        "name": "CARRY",
        "bits": 1,
        "direction": "output",
        "x": 2480,
        "y": -60,
        "valueDisplay": "off",
        "colour": "green"
      },
      {
        "id": "zero",
        "name": "ZERO",
        "bits": 1,
        "direction": "output",
        "x": 2480,
        "y": 60,
        "valueDisplay": "off",
        "colour": "green"
      },
      {
        "id": "overflow",
        "name": "OVERFLOW",
        "bits": 1,
        "direction": "output",
        "x": 2480,
        "y": 180,
        "valueDisplay": "off",
        "colour": "green"
      }
    ],
    "instances": [
      {
        "id": "split-a",
        "name": "4-1BIT",
        "position": {
          "x": -2190,
          "y": -60
        },
        "rotation": 0,
        "label": "A bits",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "split-b",
        "name": "4-1BIT",
        "position": {
          "x": -2190,
          "y": 60
        },
        "rotation": 0,
        "label": "B bits",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "alu0",
        "name": "ALU 1-BIT",
        "position": {
          "x": -1120,
          "y": -800
        },
        "rotation": 0,
        "label": "BIT 0 (LSB)",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "alu1",
        "name": "ALU 1-BIT",
        "position": {
          "x": -1120,
          "y": 800
        },
        "rotation": 0,
        "label": "BIT 1",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "alu2",
        "name": "ALU 1-BIT",
        "position": {
          "x": 800,
          "y": -800
        },
        "rotation": 0,
        "label": "BIT 2",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "alu3",
        "name": "ALU 1-BIT",
        "position": {
          "x": 800,
          "y": 800
        },
        "rotation": 0,
        "label": "BIT 3 (MSB)",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "merge-result",
        "name": "1-4BIT",
        "position": {
          "x": 1870,
          "y": -120
        },
        "rotation": 0,
        "label": "RESULT",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "or01",
        "name": "OR",
        "position": {
          "x": 1870,
          "y": 0
        },
        "rotation": 0,
        "label": "RESULT 0/1",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "or23",
        "name": "OR",
        "position": {
          "x": 1870,
          "y": 120
        },
        "rotation": 0,
        "label": "RESULT 2/3",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "or-all",
        "name": "OR",
        "position": {
          "x": 2060,
          "y": -60
        },
        "rotation": 0,
        "label": "ANY RESULT",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "not-zero",
        "name": "NOT",
        "position": {
          "x": 2060,
          "y": 60
        },
        "rotation": 0,
        "label": "ZERO",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "xor-overflow",
        "name": "XOR",
        "position": {
          "x": 2220,
          "y": -120
        },
        "rotation": 0,
        "label": "CARRY IN/OUT",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "overflow-op1",
        "name": "AND",
        "position": {
          "x": 2220,
          "y": 0
        },
        "rotation": 0,
        "label": "OVERFLOW & OP1",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "overflow-op",
        "name": "AND",
        "position": {
          "x": 2220,
          "y": 120
        },
        "rotation": 0,
        "label": "OVERFLOW & ADD",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": null,
        "outputPinColours": {}
      },
      {
        "id": "interface-input-a",
        "name": "IN-4",
        "position": {
          "x": -2380,
          "y": -240
        },
        "rotation": 0,
        "label": "A[3:0]",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "a",
        "outputPinColours": {}
      },
      {
        "id": "interface-input-b",
        "name": "IN-4",
        "position": {
          "x": -2380,
          "y": -120
        },
        "rotation": 0,
        "label": "B[3:0]",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "b",
        "outputPinColours": {}
      },
      {
        "id": "interface-input-cin",
        "name": "IN-1",
        "position": {
          "x": -2380,
          "y": 0
        },
        "rotation": 0,
        "label": "CIN",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "cin",
        "outputPinColours": {}
      },
      {
        "id": "interface-input-s0",
        "name": "IN-1",
        "position": {
          "x": -2380,
          "y": 120
        },
        "rotation": 0,
        "label": "OP0",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "s0",
        "outputPinColours": {}
      },
      {
        "id": "interface-input-s1",
        "name": "IN-1",
        "position": {
          "x": -2380,
          "y": 240
        },
        "rotation": 0,
        "label": "OP1",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "s1",
        "outputPinColours": {}
      },
      {
        "id": "interface-output-result",
        "name": "OUT-4",
        "position": {
          "x": 2380,
          "y": -180
        },
        "rotation": 0,
        "label": "RESULT[3:0]",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "result",
        "outputPinColours": {}
      },
      {
        "id": "interface-output-carry",
        "name": "OUT-1",
        "position": {
          "x": 2380,
          "y": -60
        },
        "rotation": 0,
        "label": "CARRY",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "carry",
        "outputPinColours": {}
      },
      {
        "id": "interface-output-zero",
        "name": "OUT-1",
        "position": {
          "x": 2380,
          "y": 60
        },
        "rotation": 0,
        "label": "ZERO",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "zero",
        "outputPinColours": {}
      },
      {
        "id": "interface-output-overflow",
        "name": "OUT-1",
        "position": {
          "x": 2380,
          "y": 180
        },
        "rotation": 0,
        "label": "OVERFLOW",
        "internalData": {},
        "linkedBusPairId": null,
        "interfaceId": "overflow",
        "outputPinColours": {}
      }
    ],
    "wires": [
      {
        "id": "root-a",
        "source": {
          "owner": "interface-input-a",
          "pin": "0"
        },
        "target": {
          "owner": "split-a",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "root-b",
        "source": {
          "owner": "interface-input-b",
          "pin": "0"
        },
        "target": {
          "owner": "split-b",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "a0",
        "source": {
          "owner": "split-a",
          "pin": "4"
        },
        "target": {
          "owner": "alu0",
          "pin": "a"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "a1",
        "source": {
          "owner": "split-a",
          "pin": "3"
        },
        "target": {
          "owner": "alu1",
          "pin": "a"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "a2",
        "source": {
          "owner": "split-a",
          "pin": "2"
        },
        "target": {
          "owner": "alu2",
          "pin": "a"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "a3",
        "source": {
          "owner": "split-a",
          "pin": "1"
        },
        "target": {
          "owner": "alu3",
          "pin": "a"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "b0",
        "source": {
          "owner": "split-b",
          "pin": "4"
        },
        "target": {
          "owner": "alu0",
          "pin": "b"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "b1",
        "source": {
          "owner": "split-b",
          "pin": "3"
        },
        "target": {
          "owner": "alu1",
          "pin": "b"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "b2",
        "source": {
          "owner": "split-b",
          "pin": "2"
        },
        "target": {
          "owner": "alu2",
          "pin": "b"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "b3",
        "source": {
          "owner": "split-b",
          "pin": "1"
        },
        "target": {
          "owner": "alu3",
          "pin": "b"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "cin0",
        "source": {
          "owner": "interface-input-cin",
          "pin": "0"
        },
        "target": {
          "owner": "alu0",
          "pin": "cin"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "carry0",
        "source": {
          "owner": "alu0",
          "pin": "carry"
        },
        "target": {
          "owner": "alu1",
          "pin": "cin"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "carry1",
        "source": {
          "owner": "alu1",
          "pin": "carry"
        },
        "target": {
          "owner": "alu2",
          "pin": "cin"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "carry2",
        "source": {
          "owner": "alu2",
          "pin": "carry"
        },
        "target": {
          "owner": "alu3",
          "pin": "cin"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op0-0",
        "source": {
          "owner": "interface-input-s0",
          "pin": "0"
        },
        "target": {
          "owner": "alu0",
          "pin": "s0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op0-1",
        "source": {
          "owner": "interface-input-s0",
          "pin": "0"
        },
        "target": {
          "owner": "alu1",
          "pin": "s0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op0-2",
        "source": {
          "owner": "interface-input-s0",
          "pin": "0"
        },
        "target": {
          "owner": "alu2",
          "pin": "s0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op0-3",
        "source": {
          "owner": "interface-input-s0",
          "pin": "0"
        },
        "target": {
          "owner": "alu3",
          "pin": "s0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op1-0",
        "source": {
          "owner": "interface-input-s1",
          "pin": "0"
        },
        "target": {
          "owner": "alu0",
          "pin": "s1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op1-1",
        "source": {
          "owner": "interface-input-s1",
          "pin": "0"
        },
        "target": {
          "owner": "alu1",
          "pin": "s1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op1-2",
        "source": {
          "owner": "interface-input-s1",
          "pin": "0"
        },
        "target": {
          "owner": "alu2",
          "pin": "s1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "op1-3",
        "source": {
          "owner": "interface-input-s1",
          "pin": "0"
        },
        "target": {
          "owner": "alu3",
          "pin": "s1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "sum0",
        "source": {
          "owner": "alu0",
          "pin": "result"
        },
        "target": {
          "owner": "merge-result",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "sum1",
        "source": {
          "owner": "alu1",
          "pin": "result"
        },
        "target": {
          "owner": "merge-result",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "sum2",
        "source": {
          "owner": "alu2",
          "pin": "result"
        },
        "target": {
          "owner": "merge-result",
          "pin": "2"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "sum3",
        "source": {
          "owner": "alu3",
          "pin": "result"
        },
        "target": {
          "owner": "merge-result",
          "pin": "3"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "result-out",
        "source": {
          "owner": "merge-result",
          "pin": "4"
        },
        "target": {
          "owner": "interface-output-result",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "bit0-or",
        "source": {
          "owner": "alu0",
          "pin": "result"
        },
        "target": {
          "owner": "or01",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "bit1-or",
        "source": {
          "owner": "alu1",
          "pin": "result"
        },
        "target": {
          "owner": "or01",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "bit2-or",
        "source": {
          "owner": "alu2",
          "pin": "result"
        },
        "target": {
          "owner": "or23",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "bit3-or",
        "source": {
          "owner": "alu3",
          "pin": "result"
        },
        "target": {
          "owner": "or23",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "or01-all",
        "source": {
          "owner": "or01",
          "pin": "2"
        },
        "target": {
          "owner": "or-all",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "or23-all",
        "source": {
          "owner": "or23",
          "pin": "2"
        },
        "target": {
          "owner": "or-all",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "any-not",
        "source": {
          "owner": "or-all",
          "pin": "2"
        },
        "target": {
          "owner": "not-zero",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "zero-out",
        "source": {
          "owner": "not-zero",
          "pin": "1"
        },
        "target": {
          "owner": "interface-output-zero",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "carry3-out",
        "source": {
          "owner": "alu3",
          "pin": "carry"
        },
        "target": {
          "owner": "interface-output-carry",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "carry-in-msb",
        "source": {
          "owner": "alu2",
          "pin": "carry"
        },
        "target": {
          "owner": "xor-overflow",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "carry-out-msb",
        "source": {
          "owner": "alu3",
          "pin": "carry"
        },
        "target": {
          "owner": "xor-overflow",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "overflow-op1-in",
        "source": {
          "owner": "xor-overflow",
          "pin": "2"
        },
        "target": {
          "owner": "overflow-op1",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "s1-overflow",
        "source": {
          "owner": "interface-input-s1",
          "pin": "0"
        },
        "target": {
          "owner": "overflow-op1",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "overflow-op1-out",
        "source": {
          "owner": "overflow-op1",
          "pin": "2"
        },
        "target": {
          "owner": "overflow-op",
          "pin": "0"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "s0-overflow",
        "source": {
          "owner": "interface-input-s0",
          "pin": "0"
        },
        "target": {
          "owner": "overflow-op",
          "pin": "1"
        },
        "points": [],
        "colour": null
      },
      {
        "id": "overflow-out",
        "source": {
          "owner": "overflow-op",
          "pin": "2"
        },
        "target": {
          "owner": "interface-output-overflow",
          "pin": "0"
        },
        "points": [],
        "colour": null
      }
    ],
    "junctions": [],
    "displays": [],
    "annotations": [],
    "interfaceBindings": {
      "inputs": [
        {
          "publicId": "a",
          "instanceId": "interface-input-a",
          "pinId": "0",
          "direction": "input"
        },
        {
          "publicId": "b",
          "instanceId": "interface-input-b",
          "pinId": "0",
          "direction": "input"
        },
        {
          "publicId": "cin",
          "instanceId": "interface-input-cin",
          "pinId": "0",
          "direction": "input"
        },
        {
          "publicId": "s0",
          "instanceId": "interface-input-s0",
          "pinId": "0",
          "direction": "input"
        },
        {
          "publicId": "s1",
          "instanceId": "interface-input-s1",
          "pinId": "0",
          "direction": "input"
        }
      ],
      "outputs": [
        {
          "publicId": "result",
          "instanceId": "interface-output-result",
          "pinId": "0",
          "direction": "output"
        },
        {
          "publicId": "carry",
          "instanceId": "interface-output-carry",
          "pinId": "0",
          "direction": "output"
        },
        {
          "publicId": "zero",
          "instanceId": "interface-output-zero",
          "pinId": "0",
          "direction": "output"
        },
        {
          "publicId": "overflow",
          "instanceId": "interface-output-overflow",
          "pinId": "0",
          "direction": "output"
        }
      ]
    },
    "fit": {
      "version": 1,
      "bounds": {
        "x": -2480,
        "y": -1620,
        "w": 4960,
        "h": 3240
      }
    }
  }
}
