53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
/**
|
||
* Chip pin drive registry — the bridge between a custom-chip's WASM-driven
|
||
* output pins and the SPICE electrical engine.
|
||
*
|
||
* When a custom-chip drives an OUTPUT pin (ChipRuntime), it records the pin's
|
||
* voltage here keyed by `${chipId}:${pinName}`. The SPICE netlist builder's
|
||
* `custom-chip` mapper (spice/componentToSpice) reads these to emit a DC
|
||
* voltage source on the chip pin's net, exactly like a board GPIO. That makes
|
||
* the chip drive LEDs, resistors and any analog part wired to it through
|
||
* ngspice, in addition to the digital PinManager path.
|
||
*
|
||
* Presence of a key == that pin is a driven output. Absence == input / Hi-Z.
|
||
*/
|
||
|
||
const drives = new Map<string, number>();
|
||
|
||
function key(chipId: string, pinName: string): string {
|
||
return `${chipId} |