/** * Compiles the W1e LED and display family (`led`, `rgb_led`, `bicolor_led`, * `seg7_cc`, `seg7_ca` — codes 30-34) into v3 program records, exactly per * core/README.md's "LED and display records" and spec §6.5. Every resolved * value is classic's own expression, verbatim, reusing `specsForComponent` * (never re-derived) exactly as `stampShockleyJunction`/`bicolorLedModel`/ * `rgbLedModel`/`seg7Model` (devices/semiconductors.ts, * devices/digital-ics.ts) read it — this module only arranges those values * into the wire record's shape, and declines what classic itself would * stamp nothing for. * * PINS: * - `led` is POSITIONAL (`pins[0]` anode, `pins[1]` cathode, SC:356-357): * classic's `stampShockleyJunction` accesses `pins[0]`/`pins[1]` directly * and returns early when `pins.length < 2` (SC:355), so a `led` with fewer * than 2 DECLARED pins is a malformed-component rejection, exactly like * `spdt_switch`'s own declared-pin-count check (compile/passives.ts). * - `rgb_led` (`r_a`, `g_a`, `b_a`, `com_k`), `bicolor_led` (`a1`, `a2`, `k`) * and `seg7_cc`/`seg7_ca` (`a b c d e f g dp com com2`) are BY ID * (`pinByIdOrGround`, compile/passives.ts — reused, never copied). Classic's * `bicolorLedModel`/`rgbLedModel` stamps also return early on too few * DECLARED pins (`pins.length < 3` / `< 4`, SC:547/614), so `bicolor_led` * and `rgb_led` carry the same declared-pin-count decline as `led`; `seg7` * has no such gate in classic (DI:1195-1302) and none here — a missing by-id * pin simply resolves to node 0, open (the README's "Pins by id" rule). * * PARAMS resolve with the exact precedence core/README.md's "LED and display * records" table gives (params over specs over the literal for `led`/`seg7`; * params over the literal only for `rgb_led`/`bicolor_led`, which never read * specs): `specsForComponent(component)` backs every specs-aware default, * the same `ElectricalSpecs` classic's own stamp reads. `n` and the `Is` * override exist only on `led`; every other kind's junctions use `n = 2` and * derive `Is` from `(Vf, iRated)` always (kernel semantics point 2), so this * module carries no `n`/`Is` fields for them. * * DECLINES mirror core/README.md's per-param rules: a non-finite resolved * value is `malformed::non-finite-`, and `led`'s `n <= 0` is * `malformed::non-positive-n` (classic then divides by `n·Vt = 0`). * A `led` with a thermal identity compiles like any other: its heat is the * code 91 record compile/thermal.ts adds (W1g lifts LEDs point 3's * `led-thermal` decline). * * CHANNEL SLOTS (`rgb_led`: 3, `bicolor_led`: 2, `seg7_cc`/`seg7_ca`: 8) are * NOT allocated here — compile/index.ts owns slot allocation (the same split * compile/ics.ts uses for digital slots), consecutively per component, * through the existing `channelSlots` allocator, and assembles the final * `[channelBase]` blob. `led` publishes no channel and needs no blob at all. */ import type { SimCircuit } from "../../sim/engine/sim-engine.js"; import type { ProgramPinInput } from "../format.js"; import { type CoreNodeBuild } from "./topology.js"; type SimComponent = SimCircuit["components"][number]; export type LedCompileResult = { ok: true; pins: readonly ProgramPinInput[]; params: readonly number[]; } | { ok: false; reason: string; }; /** * `led` (code 30): positional pins, params `[vf, n, iRated, isSet, is, * burnt]` (CORE_LED_PARAM, kinds.ts) per core/README.md's table, SC:358, * 369-378. */ export declare function compileLed(built: CoreNodeBuild, openKeys: ReadonlySet, component: SimComponent): LedCompileResult; /** * `rgb_led` (code 31): by-id pins `r_a, g_a, b_a, com_k` (SC:618-623), params * `[vfR, vfG, vfB, iRated, ifMax, burnt]` (CORE_RGB_LED_PARAM). `vf_r`/`vf_g`/ * `vf_b`/`iRated` never read specs (SC:615-628); `ifMax` is the Q-O24 damage * limit and DOES read specs (SC:481) — the split the README calls out * explicitly, so an injected catalog with a non-default `if_max` makes * `iRated` and `ifMax` diverge whenever `params.iRated` is absent. */ export declare function compileRgbLed(built: CoreNodeBuild, openKeys: ReadonlySet, component: SimComponent): LedCompileResult; /** * `bicolor_led` (code 32): by-id pins `a1, a2, k` (SC:551-552), params * `[vf1, vf2, iRated, ifMax, burnt]` (CORE_BICOLOR_LED_PARAM). Same * specs-blind/specs-aware split as `rgb_led`, between `iRated` (SC:548-557) * and `ifMax` (SC:481). */ export declare function compileBicolorLed(built: CoreNodeBuild, openKeys: ReadonlySet, component: SimComponent): LedCompileResult; /** * `seg7_cc`/`seg7_ca` (codes 33, 34): by-id pins `a b c d e f g dp com com2` * (DI:1206), no pin-count gate (classic has none, DI:1195-1302), params * `[vf, iRated]` (CORE_SEG7_PARAM), both specs-aware (DI:1208-1210). No * `burnt`, no `ifMax`: `seg7` has no failure surface (Q-O22). */ export declare function compileSeg7(built: CoreNodeBuild, openKeys: ReadonlySet, component: SimComponent): LedCompileResult; export {};