{
  "schema": "aisic.digital-design/1",
  "id": "logic-mux2",
  "name": "2:1 multiplexer",
  "domain": "digital",
  "technology": "IHP SG13G2 130 nm",
  "summary": "Select one of two inputs; a basic element of datapaths and control logic.",
  "lesson": {
    "idea": "S=0 selects A0; S=1 selects A1. A mux selects data, but its select input is itself a timing path.",
    "steps": [
      "Test all eight input combinations.",
      "Use one IHP multiplexer cell.",
      "Compare data and select transitions in the live traces."
    ],
    "tradeoffs": [
      "A select transition can glitch if data inputs also change; settled truth-table correctness is not glitch freedom.",
      "Transistor-level simulation models propagation and glitches; it is slower than event-driven gate simulation."
    ],
    "exercise": "Hold A0=0 and A1=1. How does the output relate to S? Then swap A0 and A1."
  },
  "stages": [
    {
      "id": "logic",
      "label": "Logic check",
      "status": "available",
      "reason": "Fast ideal zero-delay evaluation of the published explicit cell connections and testbench checks. No synthesis, RTL interpretation, transistor voltages, device corners or physical delay is modeled.",
      "artifacts": [
        {
          "kind": "verilog",
          "label": "Structural cell example",
          "url": "/digital/logic-mux2/cells.v"
        },
        {
          "kind": "json",
          "label": "Stimuli and assertions",
          "url": "/digital/logic-mux2/testbench.json"
        }
      ]
    },
    {
      "id": "transistor",
      "label": "Cell transistors",
      "status": "available",
      "reason": "Live browser ngspice/WebAssembly transient simulation of IHP standard-cell transistors. The included example netlist is hand-written; a separate browser Yosys run generates the post-synthesis netlist. No routed parasitics, static timing closure, DRC/LVS or silicon proof.",
      "artifacts": [
        {
          "kind": "verilog",
          "label": "Structural cell example",
          "url": "/digital/logic-mux2/cells.v"
        },
        {
          "kind": "json",
          "label": "Stimuli and assertions",
          "url": "/digital/logic-mux2/testbench.json"
        }
      ],
      "corners": [
        {
          "id": "typ",
          "label": "typ: 1.2 V, 25 \u00b0C"
        },
        {
          "id": "slow",
          "label": "slow: 1.08 V, 125 \u00b0C"
        },
        {
          "id": "fast",
          "label": "fast: 1.32 V, -40 \u00b0C"
        }
      ]
    },
    {
      "id": "rtl",
      "label": "RTL",
      "status": "unavailable",
      "reason": "Synthesizable source is provided. No standalone browser RTL event simulator is bundled.",
      "artifacts": [
        {
          "kind": "verilog",
          "label": "RTL source",
          "url": "/digital/logic-mux2/rtl.v"
        }
      ]
    },
    {
      "id": "gate-delay",
      "label": "Gate delays",
      "status": "available",
      "reason": "Event-driven simulation of the synthesized cells with IHP Liberty delay-table interpolation, fanout capacitance and external output loads. Fixed slew at all cell inputs; maximum delay over arcs per output, not sensitized-path timing. No wire delays, setup/hold checks, SDF annotation or STA.",
      "artifacts": [
        {
          "kind": "verilog",
          "label": "RTL source",
          "url": "/digital/logic-mux2/rtl.v"
        }
      ],
      "corners": [
        {
          "id": "typ",
          "label": "typ: 1.2 V, 25 \u00b0C"
        },
        {
          "id": "slow",
          "label": "slow: 1.08 V, 125 \u00b0C"
        },
        {
          "id": "fast",
          "label": "fast: 1.32 V, -40 \u00b0C"
        }
      ]
    },
    {
      "id": "timing",
      "label": "SPICE \u00b7 mapped cells",
      "status": "available",
      "reason": "After the separate browser Yosys synthesis action, ngspice simulates the mapped IHP cell transistors. Every simulation runs fresh; the mapping stays in this tab. Detailed runs may take tens of seconds. Not SDF simulation, STA or post-layout timing.",
      "artifacts": [
        {
          "kind": "verilog",
          "label": "Synthesizable RTL",
          "url": "/digital/logic-mux2/rtl.v"
        }
      ],
      "corners": [
        {
          "id": "typ",
          "label": "typ: 1.2 V, 25 \u00b0C"
        },
        {
          "id": "slow",
          "label": "slow: 1.08 V, 125 \u00b0C"
        },
        {
          "id": "fast",
          "label": "fast: 1.32 V, -40 \u00b0C"
        }
      ]
    }
  ],
  "cells": [
    {
      "name": "sg13g2_mux2_1",
      "count": 1
    }
  ],
  "cellCount": 1,
  "cellAreaUm2": 18.144,
  "instances": [
    {
      "type": "sg13g2_mux2_1",
      "name": "u_mux",
      "connections": {
        "X": "Y",
        "A0": "A0",
        "A1": "A1",
        "S": "S"
      }
    }
  ],
  "simulation": {
    "inputs": [
      {
        "name": "A0",
        "transitions": [
          [
            0,
            0
          ],
          [
            40,
            1
          ],
          [
            80,
            0
          ],
          [
            120,
            1
          ]
        ]
      },
      {
        "name": "A1",
        "transitions": [
          [
            0,
            0
          ],
          [
            20,
            1
          ],
          [
            40,
            0
          ],
          [
            60,
            1
          ],
          [
            80,
            0
          ],
          [
            100,
            1
          ],
          [
            120,
            0
          ],
          [
            140,
            1
          ]
        ]
      },
      {
        "name": "S",
        "transitions": [
          [
            0,
            0
          ],
          [
            10,
            1
          ],
          [
            20,
            0
          ],
          [
            30,
            1
          ],
          [
            40,
            0
          ],
          [
            50,
            1
          ],
          [
            60,
            0
          ],
          [
            70,
            1
          ],
          [
            80,
            0
          ],
          [
            90,
            1
          ],
          [
            100,
            0
          ],
          [
            110,
            1
          ],
          [
            120,
            0
          ],
          [
            130,
            1
          ],
          [
            140,
            0
          ],
          [
            150,
            1
          ]
        ]
      }
    ],
    "output": "Y",
    "outputWidth": 1,
    "endTimeNs": 160,
    "transitionNs": 0.1,
    "outputLoadFf": 10,
    "maxStepNs": 0.005,
    "checks": [
      {
        "timeNs": 2,
        "expected": "0"
      },
      {
        "timeNs": 12,
        "expected": "0"
      },
      {
        "timeNs": 22,
        "expected": "0"
      },
      {
        "timeNs": 32,
        "expected": "1"
      },
      {
        "timeNs": 42,
        "expected": "1"
      },
      {
        "timeNs": 52,
        "expected": "0"
      },
      {
        "timeNs": 62,
        "expected": "1"
      },
      {
        "timeNs": 72,
        "expected": "1"
      },
      {
        "timeNs": 82,
        "expected": "0"
      },
      {
        "timeNs": 92,
        "expected": "0"
      },
      {
        "timeNs": 102,
        "expected": "0"
      },
      {
        "timeNs": 112,
        "expected": "1"
      },
      {
        "timeNs": 122,
        "expected": "1"
      },
      {
        "timeNs": 132,
        "expected": "0"
      },
      {
        "timeNs": 142,
        "expected": "1"
      },
      {
        "timeNs": 152,
        "expected": "1"
      }
    ]
  },
  "top": "logic_mux2_rtl",
  "rtl": "// AiSIC synthesizable teaching RTL.\n`timescale 1ns/1ps\nmodule logic_mux2_rtl (input A0, A1, S, output Y);\n  assign Y = S ? A1 : A0;\nendmodule\n",
  "cellNetlist": "// Hand-written IHP structural example; not a synthesis output.\nmodule logic_mux2_cells (input A0, A1, S, output Y);\n\n  sg13g2_mux2_1 u_mux (.X(Y), .A0(A0), .A1(A1), .S(S));\nendmodule\n",
  "resources": {
    "record": "/digital/logic-mux2/design.json",
    "rtl": "/digital/logic-mux2/rtl.v",
    "testbench": "/digital/logic-mux2/testbench.json",
    "netlist": "/digital/logic-mux2/cells.v",
    "page": "/digital.html#logic-mux2",
    "schema": "/schemas/digital-design.schema.json",
    "urlBase": "Resource URLs start at this site's root."
  },
  "evidence": {
    "pdkCommit": "68c1265b1c4e5e1b4613bef34b9ce7bfe4b2c957",
    "libraryFiles": {
      "typ": {
        "url": "/digital/library/sg13g2_stdcell_typ_1p20V_25C.lib",
        "sha256": "7677a8918689f452e80405ad16a83e744709342574f2aedcc507c2758986b396",
        "voltage": 1.2,
        "temperatureC": 25
      },
      "slow": {
        "url": "/digital/library/sg13g2_stdcell_slow_1p08V_125C.lib",
        "sha256": "1ac6a0301184b3a8aa1a4a01910967f624c8e869517777f529985f11f04588c3",
        "voltage": 1.08,
        "temperatureC": 125
      },
      "fast": {
        "url": "/digital/library/sg13g2_stdcell_fast_1p32V_m40C.lib",
        "sha256": "f191a3132d0f2f59ca2721884cdb1d8360c8fbf3e0012056af62583dd69ae701",
        "voltage": 1.32,
        "temperatureC": -40
      }
    },
    "sourceHashes": {
      "rtl.v": "52f910c510fc9d285c2e84c622a431b4150c37b2efcefec2651088274f6e8ee8",
      "cells.v": "d0f59794acd76842e6d9fc47f99d83cb67fce7b31f8d7dbf6054d0d874465aff",
      "testbench.json": "edd26906c1a46494ce8d8e0de3b653d2622d48481c4a2f7b904201c7ab8976bb"
    }
  },
  "qualification": {
    "status": "demonstration-tests-only",
    "analogStudyIncluded": false,
    "delayLimits": "informational",
    "note": "Each browser run checks its finite truth-table or sequence. These new digital designs have not completed the 11-corner and 40-seed analog qualification protocol."
  },
  "boundary": "Fast mode checks ideal zero-delay behavior of the published explicit cells; it is not RTL simulation or physical timing. Detailed modes simulate IHP cell transistors, directly or after browser Yosys synthesis. No routed parasitics, static timing closure, DRC/LVS or silicon proof.",
  "recordVersion": 1,
  "entryType": "library-block",
  "group": "Digital logic",
  "subgroup": "Combinational logic",
  "kind": "combinational",
  "reference": null,
  "implementation": {
    "kind": "standard-cell-reference",
    "evidence": "transistor-simulation",
    "purpose": "A small digital block for learning, reuse and retargeting; not a claim of optimal implementation.",
    "netlistBoundary": "The included structural example is hand-written. Browser synthesis generates a separate cell netlist, and simulation adds ideal stimuli, supply and loads.",
    "physicalSignoff": "No placed/routed layout, extracted interconnect, DRC/LVS or silicon measurements."
  },
  "diagram": {
    "schema": "aisic.diagram/1",
    "kind": "cell-connectivity",
    "representation": "explicit-cell-example",
    "ports": [
      {
        "id": "A0",
        "name": "A0",
        "direction": "input",
        "width": 1,
        "nets": [
          "A0"
        ]
      },
      {
        "id": "A1",
        "name": "A1",
        "direction": "input",
        "width": 1,
        "nets": [
          "A1"
        ]
      },
      {
        "id": "S",
        "name": "S",
        "direction": "input",
        "width": 1,
        "nets": [
          "S"
        ]
      },
      {
        "id": "Y",
        "name": "Y",
        "direction": "output",
        "width": 1,
        "nets": [
          "Y"
        ]
      }
    ],
    "nodes": [
      {
        "id": "u_mux",
        "kind": "logic-cell",
        "cell": "sg13g2_mux2_1",
        "family": "mux2",
        "sequential": false,
        "ports": [
          {
            "name": "X",
            "direction": "output",
            "net": "Y"
          },
          {
            "name": "A0",
            "direction": "input",
            "net": "A0"
          },
          {
            "name": "A1",
            "direction": "input",
            "net": "A1"
          },
          {
            "name": "S",
            "direction": "input",
            "net": "S"
          }
        ],
        "powerPorts": [
          {
            "name": "VDD",
            "net": "vdd"
          },
          {
            "name": "VSS",
            "net": "0"
          }
        ]
      }
    ],
    "nets": [
      {
        "id": "A0",
        "endpoints": [
          {
            "node": "$ports",
            "port": "A0",
            "bit": 0,
            "role": "driver"
          },
          {
            "node": "u_mux",
            "port": "A0",
            "role": "sink"
          }
        ]
      },
      {
        "id": "A1",
        "endpoints": [
          {
            "node": "$ports",
            "port": "A1",
            "bit": 0,
            "role": "driver"
          },
          {
            "node": "u_mux",
            "port": "A1",
            "role": "sink"
          }
        ]
      },
      {
        "id": "S",
        "endpoints": [
          {
            "node": "$ports",
            "port": "S",
            "bit": 0,
            "role": "driver"
          },
          {
            "node": "u_mux",
            "port": "S",
            "role": "sink"
          }
        ]
      },
      {
        "id": "Y",
        "endpoints": [
          {
            "node": "$ports",
            "port": "Y",
            "bit": 0,
            "role": "sink"
          },
          {
            "node": "u_mux",
            "port": "X",
            "role": "driver"
          }
        ]
      }
    ],
    "powerNets": [
      {
        "id": "vdd",
        "role": "supply"
      },
      {
        "id": "0",
        "role": "ground"
      }
    ],
    "scope": "Logical connectivity of the explicit cell example; power connections are listed separately. Not the synthesized result or a physical layout."
  },
  "ports": [
    {
      "id": "A0",
      "name": "A0",
      "direction": "input",
      "width": 1,
      "nets": [
        "A0"
      ]
    },
    {
      "id": "A1",
      "name": "A1",
      "direction": "input",
      "width": 1,
      "nets": [
        "A1"
      ]
    },
    {
      "id": "S",
      "name": "S",
      "direction": "input",
      "width": 1,
      "nets": [
        "S"
      ]
    },
    {
      "id": "Y",
      "name": "Y",
      "direction": "output",
      "width": 1,
      "nets": [
        "Y"
      ]
    }
  ],
  "authoring": {
    "schema": "aisic.authoring/1",
    "source": "/digital/logic-mux2/design.json",
    "canonicalFields": [
      "name",
      "summary",
      "lesson",
      "boundary",
      "group",
      "subgroup",
      "reference",
      "implementation",
      "qualification"
    ],
    "explanationField": "lesson",
    "unknownFields": "preserved",
    "generatedFields": [
      "schema",
      "recordVersion",
      "entryType",
      "id",
      "domain",
      "technology",
      "kind",
      "ports",
      "stages",
      "cells",
      "cellCount",
      "cellAreaUm2",
      "instances",
      "simulation",
      "top",
      "rtl",
      "cellNetlist",
      "resources",
      "evidence",
      "diagram",
      "authoring",
      "generated"
    ],
    "generatedStageFields": [
      "id",
      "status",
      "artifacts",
      "corners"
    ],
    "generatedResourceFields": [
      "record",
      "page",
      "rtl",
      "testbench",
      "netlist",
      "schema",
      "urlBase"
    ],
    "note": "Edit the lesson only here; it is the explanation used by people and AI. The data builder preserves authored fields and unknown extensions. Numerical recipes remain in tools/digital_flow.py."
  },
  "generated": {
    "schema": "aisic.generated/1",
    "builder": "tools/digital_flow.py",
    "builderSha256": "3aa880c92a73d16c6e3e2787d6a6145aa2705f273c8664493eb627c67c127a6a",
    "authoredSha256": "2058d9d89dacdd6308290592f4104fdbfc8d6d1f8696aba9bfdb7ae6819f3f61",
    "diagramSha256": "c37bdaac36e3ebd6f657e735df1c0116a9c6d0bc842640b020ce47260b1f7158",
    "numericalSha256": "f5f7c5e3b244614ae236dc940054129d1f962e369a4230becdc72bed87452eb6",
    "evidencePolicy": "This data build does not run simulations or certify existing evidence. Compare source fingerprints before reusing results."
  }
}
