/** * Compiles the three W1d memory ICs (core/README.md's "Kind codes and * records", codes 80-82: 74ls189, 28c16, 28c256) into v2 program records. * Structure mirrors compile/registers.ts's `compileRegisterIc` (itself a * mirror of compile/ics.ts's `compileCombinationalIc`) — same decline rule, * same params-7-9-forced-to-0 rule, same "reuse classic's own helpers" * stance. What's specific to this file: none of the three kinds has an * icPinMap entry (so every pin order is hardcoded from the README's own * table), the EEPROMs carry two more params (`tWC`, `sdp`) after their delay * tail, and the EEPROMs' blob carries the ROM image words after the pin * flags. The 74ls189 has no ROM; when it has `params.contents` (a power-on * preload, src/circuit/types.ts RAM_KINDS) its blob carries the sixteen * preload nibbles there instead (README's "RAM preload"), and with none its * blob ends at the pin flags, as every program before the field did. * * PIN ORDER (README's "Sequential and memory IC logic pins" table): controls, * then data, then outputs in bit order; bit 0 of every bus is its first pin * (`a0`/`io0`/... first). Hardcoded below, built from small per-family * helpers (`addressPinIds`, `ioPinIds`) so the 11/15-address-bit and * 8-data-bit runs can't typo against each other between 28c16 and 28c256. * * FLOATING_INPUT: the catalog-function test alone, reused from * compile/registers.ts's `catalogOnlyFloatingInput` (none of these three * kinds has icPinMap roles either — same reasoning as that file's header). * This is also what makes the 189's `/o1../o4` (catalog function * `tri_state`) and the EEPROMs' `io0..io7` (catalog function `io`) come out * flagged, matching README's "It covers every read pin and, through * tri_state and io, the 173's q pins and the memories' outputs" — no * additional role/direction logic is needed here at all, the catalog * function test alone already produces exactly that outcome pin by pin. * * ROM IMAGE (README's "ROM image" section, reused verbatim, never * re-derived): `eepromImageBytes(size, String(params.contents ?? ""))` * (classic's own `load()` helper, exported from sim-engine.ts for exactly * this), then word `k` = `b[4k] | b[4k+1]<<8 | b[4k+2]<<16 | b[4k+3]<<24`, * `>>> 0` — little-endian, built with shifts, never a host-endian * `Uint32Array` view onto the byte buffer. */ 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 declare const MEMORY_KINDS: readonly ["74ls189", "28c16", "28c256"]; export type MemoryKind = (typeof MEMORY_KINDS)[number]; export type MemoryCompileResult = { ok: true; pins: readonly ProgramPinInput[]; params: readonly number[]; /** Per logic pin (this kind's own order, above), the blob flag bits after blob[0]. Only bit 0 (FLOATING_INPUT) is ever set. */ pinFlags: readonly number[]; /** The finished digital-slot key list, in slot order. */ digitalSlotKeys: readonly string[]; /** The blob's tail after the pin flags: an EEPROM's ROM image as little-endian words; a 74ls189's sixteen preload nibbles, or nothing when it has no contents. */ romWords: readonly number[]; } | { ok: false; reason: string; }; /** * Compiles one 80-82 component. Mirrors `compileCombinationalIc`'s structure * and decline rule exactly (`topology:ic-pins:` when the * declared pins are not exactly vcc, gnd and the kind's logic pins). */ export declare function compileMemoryIc(built: CoreNodeBuild, openKeys: ReadonlySet, component: SimComponent, /** W2c: an EEPROM's image carried across a reload, in place of its authored `contents` (CompileOptions.eepromImages). */ carriedImage?: Uint8Array): MemoryCompileResult; export {};