{
  "schema": "aisic.digital-design/1",
  "id": "logic-dff",
  "name": "D flip-flop with reset",
  "domain": "digital",
  "technology": "IHP SG13G2 130 nm",
  "summary": "Capture one bit on a rising clock edge, with an active-low asynchronous reset.",
  "lesson": {
    "idea": "The output remembers D at the rising edge. Reset asserts asynchronously, independently of a clock edge.",
    "steps": [
      "Assert reset to establish a known state.",
      "Change D away from the active clock edge.",
      "Capture D and inspect the transistor-level clock-to-Q delay."
    ],
    "tradeoffs": [
      "Reset release must respect recovery/removal in a real system, often using synchronized deassertion.",
      "These runs do not validate setup, hold, recovery, removal or metastability."
    ],
    "exercise": "Explain why D changes between clock edges do not immediately change Q."
  },
  "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-dff/cells.v"
        },
        {
          "kind": "json",
          "label": "Stimuli and assertions",
          "url": "/digital/logic-dff/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-dff/cells.v"
        },
        {
          "kind": "json",
          "label": "Stimuli and assertions",
          "url": "/digital/logic-dff/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-dff/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-dff/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-dff/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_dfrbpq_1",
      "count": 1
    }
  ],
  "cellCount": 1,
  "cellAreaUm2": 48.9888,
  "instances": [
    {
      "type": "sg13g2_dfrbpq_1",
      "name": "u_ff",
      "connections": {
        "Q": "Q",
        "CLK": "CLK",
        "D": "D",
        "RESET_B": "RESET_B"
      }
    }
  ],
  "simulation": {
    "inputs": [
      {
        "name": "CLK",
        "transitions": [
          [
            0,
            0
          ],
          [
            8,
            1
          ],
          [
            20,
            0
          ],
          [
            30,
            1
          ],
          [
            40,
            0
          ],
          [
            54,
            1
          ],
          [
            64,
            0
          ],
          [
            70,
            1
          ],
          [
            80,
            0
          ],
          [
            86,
            1
          ],
          [
            96,
            0
          ],
          [
            102,
            1
          ],
          [
            106,
            0
          ],
          [
            120,
            1
          ]
        ]
      },
      {
        "name": "D",
        "transitions": [
          [
            0,
            0
          ],
          [
            4,
            1
          ],
          [
            16,
            0
          ],
          [
            24,
            1
          ],
          [
            34,
            0
          ],
          [
            44,
            1
          ],
          [
            48,
            0
          ],
          [
            58,
            1
          ]
        ]
      },
      {
        "name": "RESET_B",
        "transitions": [
          [
            0,
            1
          ],
          [
            1,
            0
          ],
          [
            12,
            1
          ],
          [
            74,
            0
          ],
          [
            90,
            1
          ],
          [
            110,
            0
          ],
          [
            114,
            1
          ]
        ]
      }
    ],
    "output": "Q",
    "outputWidth": 1,
    "endTimeNs": 126,
    "transitionNs": 0.1,
    "outputLoadFf": 10,
    "maxStepNs": 0.005,
    "checks": [
      {
        "timeNs": 3,
        "expected": "0",
        "label": "asynchronous reset without a clock"
      },
      {
        "timeNs": 6,
        "expected": "0",
        "label": "reset holds despite changed D"
      },
      {
        "timeNs": 10,
        "expected": "0",
        "label": "reset dominates an active clock edge"
      },
      {
        "timeNs": 14,
        "expected": "0",
        "label": "reset release while clock high does not capture D"
      },
      {
        "timeNs": 18,
        "expected": "0",
        "label": "high-phase storage after reset release"
      },
      {
        "timeNs": 22,
        "expected": "0",
        "label": "falling edge does not capture"
      },
      {
        "timeNs": 26,
        "expected": "0",
        "label": "low-phase D change is held until rising edge"
      },
      {
        "timeNs": 32,
        "expected": "1",
        "label": "rising edge captures one"
      },
      {
        "timeNs": 36,
        "expected": "1",
        "label": "high-phase D change retains one"
      },
      {
        "timeNs": 42,
        "expected": "1",
        "label": "falling edge retains one despite D zero"
      },
      {
        "timeNs": 46,
        "expected": "1",
        "label": "low-phase storage after D rises"
      },
      {
        "timeNs": 50,
        "expected": "1",
        "label": "low-phase D falls without changing Q"
      },
      {
        "timeNs": 56,
        "expected": "0",
        "label": "rising edge captures zero"
      },
      {
        "timeNs": 60,
        "expected": "0",
        "label": "high-phase D change retains zero"
      },
      {
        "timeNs": 66,
        "expected": "0",
        "label": "falling edge retains zero despite D one"
      },
      {
        "timeNs": 72,
        "expected": "1",
        "label": "later rising edge captures one"
      },
      {
        "timeNs": 76,
        "expected": "0",
        "label": "asynchronous reset clears one while clock high"
      },
      {
        "timeNs": 82,
        "expected": "0",
        "label": "reset remains active across falling edge"
      },
      {
        "timeNs": 88,
        "expected": "0",
        "label": "reset dominates another rising edge with D one"
      },
      {
        "timeNs": 92,
        "expected": "0",
        "label": "high-phase reset release does not restore old data"
      },
      {
        "timeNs": 98,
        "expected": "0",
        "label": "falling edge after reset release holds zero"
      },
      {
        "timeNs": 104,
        "expected": "1",
        "label": "first rising edge after release captures D"
      },
      {
        "timeNs": 112,
        "expected": "0",
        "label": "asynchronous reset clears one while clock low"
      },
      {
        "timeNs": 116,
        "expected": "0",
        "label": "low-phase reset release does not capture D"
      },
      {
        "timeNs": 122,
        "expected": "1",
        "label": "capture resumes only on the next rising edge"
      }
    ]
  },
  "top": "logic_dff_rtl",
  "rtl": "// AiSIC synthesizable teaching RTL.\n`timescale 1ns/1ps\nmodule logic_dff_rtl (input CLK, D, RESET_B, output reg Q);\n  always @(posedge CLK or negedge RESET_B) if (!RESET_B) Q <= 1'b0; else Q <= D;\nendmodule\n",
  "cellNetlist": "// Hand-written IHP structural example; not a synthesis output.\nmodule logic_dff_cells (input CLK, D, RESET_B, output wire Q);\n\n  sg13g2_dfrbpq_1 u_ff (.Q(Q), .CLK(CLK), .D(D), .RESET_B(RESET_B));\nendmodule\n",
  "resources": {
    "record": "/digital/logic-dff/design.json",
    "rtl": "/digital/logic-dff/rtl.v",
    "testbench": "/digital/logic-dff/testbench.json",
    "netlist": "/digital/logic-dff/cells.v",
    "page": "/digital.html#logic-dff",
    "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": "50bf6196f9d9b86572f494df654c6b0b999f69f1ddbafa85ec634192ead99241",
      "cells.v": "bd0e6e77009a2895ea0b6dfad5a5a1eed469bcb1be161da8d9959ad9b5e75cb2",
      "testbench.json": "d4fd4e3b1e9e16038858842a1a9cf186ef25ba8a91893a1f42d83477e53816d9"
    }
  },
  "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": "Sequential logic",
  "kind": "sequential",
  "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": "CLK",
        "name": "CLK",
        "direction": "input",
        "width": 1,
        "nets": [
          "CLK"
        ]
      },
      {
        "id": "D",
        "name": "D",
        "direction": "input",
        "width": 1,
        "nets": [
          "D"
        ]
      },
      {
        "id": "RESET_B",
        "name": "RESET_B",
        "direction": "input",
        "width": 1,
        "nets": [
          "RESET_B"
        ]
      },
      {
        "id": "Q",
        "name": "Q",
        "direction": "output",
        "width": 1,
        "nets": [
          "Q"
        ]
      }
    ],
    "nodes": [
      {
        "id": "u_ff",
        "kind": "logic-cell",
        "cell": "sg13g2_dfrbpq_1",
        "family": "dfrbpq",
        "sequential": true,
        "ports": [
          {
            "name": "Q",
            "direction": "output",
            "net": "Q"
          },
          {
            "name": "CLK",
            "direction": "input",
            "net": "CLK"
          },
          {
            "name": "D",
            "direction": "input",
            "net": "D"
          },
          {
            "name": "RESET_B",
            "direction": "input",
            "net": "RESET_B"
          }
        ],
        "powerPorts": [
          {
            "name": "VDD",
            "net": "vdd"
          },
          {
            "name": "VSS",
            "net": "0"
          }
        ]
      }
    ],
    "nets": [
      {
        "id": "CLK",
        "endpoints": [
          {
            "node": "$ports",
            "port": "CLK",
            "bit": 0,
            "role": "driver"
          },
          {
            "node": "u_ff",
            "port": "CLK",
            "role": "sink"
          }
        ]
      },
      {
        "id": "D",
        "endpoints": [
          {
            "node": "$ports",
            "port": "D",
            "bit": 0,
            "role": "driver"
          },
          {
            "node": "u_ff",
            "port": "D",
            "role": "sink"
          }
        ]
      },
      {
        "id": "RESET_B",
        "endpoints": [
          {
            "node": "$ports",
            "port": "RESET_B",
            "bit": 0,
            "role": "driver"
          },
          {
            "node": "u_ff",
            "port": "RESET_B",
            "role": "sink"
          }
        ]
      },
      {
        "id": "Q",
        "endpoints": [
          {
            "node": "$ports",
            "port": "Q",
            "bit": 0,
            "role": "sink"
          },
          {
            "node": "u_ff",
            "port": "Q",
            "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": "CLK",
      "name": "CLK",
      "direction": "input",
      "width": 1,
      "nets": [
        "CLK"
      ]
    },
    {
      "id": "D",
      "name": "D",
      "direction": "input",
      "width": 1,
      "nets": [
        "D"
      ]
    },
    {
      "id": "RESET_B",
      "name": "RESET_B",
      "direction": "input",
      "width": 1,
      "nets": [
        "RESET_B"
      ]
    },
    {
      "id": "Q",
      "name": "Q",
      "direction": "output",
      "width": 1,
      "nets": [
        "Q"
      ]
    }
  ],
  "authoring": {
    "schema": "aisic.authoring/1",
    "source": "/digital/logic-dff/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": "cd8183de74fd2de248647d72e47869e4061cede3ecf7cf75321adcd4eb348f4b",
    "diagramSha256": "c971eb29ded78271f9571351010287f7aa208d2ae8f3e29912d7641c2373716f",
    "numericalSha256": "77a3a504933e48ba1d7792de0784802ff1da61850c15555e52ace79fa7f9369a",
    "evidencePolicy": "This data build does not run simulations or certify existing evidence. Compare source fingerprints before reusing results."
  }
}
