@vessel-dsp/compiler 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +314 -2
  2. package/dist/bake.d.ts +38 -0
  3. package/dist/bake.d.ts.map +1 -0
  4. package/dist/bake.js +101 -0
  5. package/dist/bake.js.map +1 -0
  6. package/dist/bbd-clock.d.ts +171 -0
  7. package/dist/bbd-clock.d.ts.map +1 -0
  8. package/dist/bbd-clock.js +1750 -0
  9. package/dist/bbd-clock.js.map +1 -0
  10. package/dist/block-row.d.ts +51 -0
  11. package/dist/block-row.d.ts.map +1 -0
  12. package/dist/block-row.js +17 -0
  13. package/dist/block-row.js.map +1 -0
  14. package/dist/bypass.d.ts +3 -0
  15. package/dist/bypass.d.ts.map +1 -0
  16. package/dist/bypass.js +228 -0
  17. package/dist/bypass.js.map +1 -0
  18. package/dist/compile.d.ts +24 -0
  19. package/dist/compile.d.ts.map +1 -0
  20. package/dist/compile.js +344 -0
  21. package/dist/compile.js.map +1 -0
  22. package/dist/converter-scale.d.ts +14 -0
  23. package/dist/converter-scale.d.ts.map +1 -0
  24. package/dist/converter-scale.js +133 -0
  25. package/dist/converter-scale.js.map +1 -0
  26. package/dist/couple.d.ts +28 -0
  27. package/dist/couple.d.ts.map +1 -0
  28. package/dist/couple.js +567 -0
  29. package/dist/couple.js.map +1 -0
  30. package/dist/dangling-active-terminal.d.ts +47 -0
  31. package/dist/dangling-active-terminal.d.ts.map +1 -0
  32. package/dist/dangling-active-terminal.js +542 -0
  33. package/dist/dangling-active-terminal.js.map +1 -0
  34. package/dist/declared-program.d.ts +23 -0
  35. package/dist/declared-program.d.ts.map +1 -0
  36. package/dist/declared-program.js +387 -0
  37. package/dist/declared-program.js.map +1 -0
  38. package/dist/denomination.d.ts +48 -0
  39. package/dist/denomination.d.ts.map +1 -0
  40. package/dist/denomination.js +27 -0
  41. package/dist/denomination.js.map +1 -0
  42. package/dist/device-laws.d.ts +237 -0
  43. package/dist/device-laws.d.ts.map +1 -0
  44. package/dist/device-laws.js +3497 -0
  45. package/dist/device-laws.js.map +1 -0
  46. package/dist/diagnostics.d.ts +13 -0
  47. package/dist/diagnostics.d.ts.map +1 -0
  48. package/dist/diagnostics.js +19 -0
  49. package/dist/diagnostics.js.map +1 -0
  50. package/dist/emit.d.ts +8 -0
  51. package/dist/emit.d.ts.map +1 -0
  52. package/dist/emit.js +43 -0
  53. package/dist/emit.js.map +1 -0
  54. package/dist/errors.d.ts +22 -0
  55. package/dist/errors.d.ts.map +1 -0
  56. package/dist/errors.js +39 -0
  57. package/dist/errors.js.map +1 -0
  58. package/dist/firmware-class.d.ts +69 -0
  59. package/dist/firmware-class.d.ts.map +1 -0
  60. package/dist/firmware-class.js +20 -0
  61. package/dist/firmware-class.js.map +1 -0
  62. package/dist/fixtures/circuits.d.ts +1721 -0
  63. package/dist/fixtures/circuits.d.ts.map +1 -0
  64. package/dist/fixtures/circuits.js +13404 -0
  65. package/dist/fixtures/circuits.js.map +1 -0
  66. package/dist/fixtures/expected.d.ts +257 -0
  67. package/dist/fixtures/expected.d.ts.map +1 -0
  68. package/dist/fixtures/expected.js +311 -0
  69. package/dist/fixtures/expected.js.map +1 -0
  70. package/dist/fixtures/index.d.ts +4 -0
  71. package/dist/fixtures/index.d.ts.map +1 -0
  72. package/dist/fixtures/index.js +8 -0
  73. package/dist/fixtures/index.js.map +1 -0
  74. package/dist/fixtures/registry.d.ts +52 -0
  75. package/dist/fixtures/registry.d.ts.map +1 -0
  76. package/dist/fixtures/registry.js +341 -0
  77. package/dist/fixtures/registry.js.map +1 -0
  78. package/dist/generic-tube-fit.d.ts +12 -0
  79. package/dist/generic-tube-fit.d.ts.map +1 -0
  80. package/dist/generic-tube-fit.js +45 -0
  81. package/dist/generic-tube-fit.js.map +1 -0
  82. package/dist/grounded-clock-supply.d.ts +13 -0
  83. package/dist/grounded-clock-supply.d.ts.map +1 -0
  84. package/dist/grounded-clock-supply.js +45 -0
  85. package/dist/grounded-clock-supply.js.map +1 -0
  86. package/dist/identify.d.ts +50 -0
  87. package/dist/identify.d.ts.map +1 -0
  88. package/dist/identify.js +319 -0
  89. package/dist/identify.js.map +1 -0
  90. package/dist/index.d.ts +10 -0
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +19 -0
  93. package/dist/index.js.map +1 -0
  94. package/dist/inert-controls.d.ts +15 -0
  95. package/dist/inert-controls.d.ts.map +1 -0
  96. package/dist/inert-controls.js +266 -0
  97. package/dist/inert-controls.js.map +1 -0
  98. package/dist/latch-seed.d.ts +53 -0
  99. package/dist/latch-seed.d.ts.map +1 -0
  100. package/dist/latch-seed.js +257 -0
  101. package/dist/latch-seed.js.map +1 -0
  102. package/dist/link.d.ts +7 -0
  103. package/dist/link.d.ts.map +1 -0
  104. package/dist/link.js +270 -0
  105. package/dist/link.js.map +1 -0
  106. package/dist/lower.d.ts +79 -0
  107. package/dist/lower.d.ts.map +1 -0
  108. package/dist/lower.js +1855 -0
  109. package/dist/lower.js.map +1 -0
  110. package/dist/netlist.d.ts +79 -0
  111. package/dist/netlist.d.ts.map +1 -0
  112. package/dist/netlist.js +4746 -0
  113. package/dist/netlist.js.map +1 -0
  114. package/dist/non-executable-clock-drivers.d.ts +8 -0
  115. package/dist/non-executable-clock-drivers.d.ts.map +1 -0
  116. package/dist/non-executable-clock-drivers.js +33 -0
  117. package/dist/non-executable-clock-drivers.js.map +1 -0
  118. package/dist/open-category.d.ts +98 -0
  119. package/dist/open-category.d.ts.map +1 -0
  120. package/dist/open-category.js +111 -0
  121. package/dist/open-category.js.map +1 -0
  122. package/dist/over-driven-node.d.ts +33 -0
  123. package/dist/over-driven-node.d.ts.map +1 -0
  124. package/dist/over-driven-node.js +188 -0
  125. package/dist/over-driven-node.js.map +1 -0
  126. package/dist/part-catalog.d.ts +7 -0
  127. package/dist/part-catalog.d.ts.map +1 -0
  128. package/dist/part-catalog.js +6639 -0
  129. package/dist/part-catalog.js.map +1 -0
  130. package/dist/part-number.d.ts +32 -0
  131. package/dist/part-number.d.ts.map +1 -0
  132. package/dist/part-number.js +80 -0
  133. package/dist/part-number.js.map +1 -0
  134. package/dist/partition.d.ts +7 -0
  135. package/dist/partition.d.ts.map +1 -0
  136. package/dist/partition.js +242 -0
  137. package/dist/partition.js.map +1 -0
  138. package/dist/port-full-scale.d.ts +70 -0
  139. package/dist/port-full-scale.d.ts.map +1 -0
  140. package/dist/port-full-scale.js +235 -0
  141. package/dist/port-full-scale.js.map +1 -0
  142. package/dist/pot-orientation.d.ts +114 -0
  143. package/dist/pot-orientation.d.ts.map +1 -0
  144. package/dist/pot-orientation.js +551 -0
  145. package/dist/pot-orientation.js.map +1 -0
  146. package/dist/power-domain-control.d.ts +40 -0
  147. package/dist/power-domain-control.d.ts.map +1 -0
  148. package/dist/power-domain-control.js +142 -0
  149. package/dist/power-domain-control.js.map +1 -0
  150. package/dist/proxy-declaration.d.ts +121 -0
  151. package/dist/proxy-declaration.d.ts.map +1 -0
  152. package/dist/proxy-declaration.js +50 -0
  153. package/dist/proxy-declaration.js.map +1 -0
  154. package/dist/registry.d.ts +323 -0
  155. package/dist/registry.d.ts.map +1 -0
  156. package/dist/registry.js +192 -0
  157. package/dist/registry.js.map +1 -0
  158. package/dist/sparse-schedule.d.ts +65 -0
  159. package/dist/sparse-schedule.d.ts.map +1 -0
  160. package/dist/sparse-schedule.js +421 -0
  161. package/dist/sparse-schedule.js.map +1 -0
  162. package/dist/speaker-load.d.ts +38 -0
  163. package/dist/speaker-load.d.ts.map +1 -0
  164. package/dist/speaker-load.js +97 -0
  165. package/dist/speaker-load.js.map +1 -0
  166. package/dist/stage-coverage.d.ts +21 -0
  167. package/dist/stage-coverage.d.ts.map +1 -0
  168. package/dist/stage-coverage.js +124 -0
  169. package/dist/stage-coverage.js.map +1 -0
  170. package/dist/stamp-partition.d.ts +314 -0
  171. package/dist/stamp-partition.d.ts.map +1 -0
  172. package/dist/stamp-partition.js +472 -0
  173. package/dist/stamp-partition.js.map +1 -0
  174. package/dist/supply-reference.d.ts +19 -0
  175. package/dist/supply-reference.d.ts.map +1 -0
  176. package/dist/supply-reference.js +66 -0
  177. package/dist/supply-reference.js.map +1 -0
  178. package/dist/supply-short.d.ts +32 -0
  179. package/dist/supply-short.d.ts.map +1 -0
  180. package/dist/supply-short.js +118 -0
  181. package/dist/supply-short.js.map +1 -0
  182. package/dist/supply-stamps.d.ts +51 -0
  183. package/dist/supply-stamps.d.ts.map +1 -0
  184. package/dist/supply-stamps.js +363 -0
  185. package/dist/supply-stamps.js.map +1 -0
  186. package/dist/terminal-role.d.ts +109 -0
  187. package/dist/terminal-role.d.ts.map +1 -0
  188. package/dist/terminal-role.js +46 -0
  189. package/dist/terminal-role.js.map +1 -0
  190. package/dist/terminal-roles.d.ts +59 -0
  191. package/dist/terminal-roles.d.ts.map +1 -0
  192. package/dist/terminal-roles.js +92 -0
  193. package/dist/terminal-roles.js.map +1 -0
  194. package/dist/transformer.d.ts +181 -0
  195. package/dist/transformer.d.ts.map +1 -0
  196. package/dist/transformer.js +476 -0
  197. package/dist/transformer.js.map +1 -0
  198. package/dist/types.d.ts +3157 -0
  199. package/dist/types.d.ts.map +1 -0
  200. package/dist/types.js +11 -0
  201. package/dist/types.js.map +1 -0
  202. package/dist/unbounded-operating-point.d.ts +35 -0
  203. package/dist/unbounded-operating-point.d.ts.map +1 -0
  204. package/dist/unbounded-operating-point.js +181 -0
  205. package/dist/unbounded-operating-point.js.map +1 -0
  206. package/dist/unexecuted-region.d.ts +3 -0
  207. package/dist/unexecuted-region.d.ts.map +1 -0
  208. package/dist/unexecuted-region.js +122 -0
  209. package/dist/unexecuted-region.js.map +1 -0
  210. package/dist/unimplemented-control-role.d.ts +3 -0
  211. package/dist/unimplemented-control-role.d.ts.map +1 -0
  212. package/dist/unimplemented-control-role.js +61 -0
  213. package/dist/unimplemented-control-role.js.map +1 -0
  214. package/dist/unreachable-output.d.ts +3 -0
  215. package/dist/unreachable-output.d.ts.map +1 -0
  216. package/dist/unreachable-output.js +97 -0
  217. package/dist/unreachable-output.js.map +1 -0
  218. package/dist/unreadable-terminal-role.d.ts +67 -0
  219. package/dist/unreadable-terminal-role.d.ts.map +1 -0
  220. package/dist/unreadable-terminal-role.js +409 -0
  221. package/dist/unreadable-terminal-role.js.map +1 -0
  222. package/dist/unverified-pinout.d.ts +27 -0
  223. package/dist/unverified-pinout.d.ts.map +1 -0
  224. package/dist/unverified-pinout.js +121 -0
  225. package/dist/unverified-pinout.js.map +1 -0
  226. package/package.json +75 -5
@@ -0,0 +1,341 @@
1
+ // Fake part registries.
2
+ //
3
+ // The registry is an injected parameter, so a fake is not a mock -- it is a
4
+ // legitimate configuration. `emptyRegistry` in particular is the arbitrary-schematic
5
+ // case: what compiles when the compiler knows about no parts at all.
6
+ //
7
+ // No real part numbers. `FIXTURE-DELAY-1` exists nowhere outside these tests, which
8
+ // keeps the identity assertions away from anything the corpus contains.
9
+ //
10
+ // **A fictional part, but not a fictional model.** `modelId` names the DSP algorithm a
11
+ // runtime must implement, not the chip (see `MacroModel.modelId`), so the fixture part's
12
+ // model is the real `bucket-brigade-delay-line` a real MN3007 entry would also name. Making
13
+ // it fictional too would mean the only implemented model in the runtime existed for tests.
14
+ const fixtureDelayMacro = {
15
+ modelId: "bucket-brigade-delay-line",
16
+ parameters: { stages: 1024 },
17
+ // Addressed by role rather than by index, which is what lets one entry serve documents that
18
+ // order the same pinout differently. The fixture's own terminals are named to match.
19
+ ports: {
20
+ audioIn: ["in"],
21
+ audioOut: ["out", "out1"],
22
+ parameter: ["cp1", "clock1"],
23
+ },
24
+ // A `coupled` port on both audio terminals: 47k in (a sampling-cap-and-bias-network
25
+ // stand-in), 1k out (a buffered source). Neither is a real MN3005 measurement --
26
+ // this part exists nowhere outside these tests -- but both are nonzero and
27
+ // declared, so the loading is real rather than a zero default nothing measured.
28
+ audioPortImpedanceOhms: { input: 47_000, output: 1_000 },
29
+ parameterReferenceVolts: 9,
30
+ };
31
+ /** The part's identity, shared by both macro registries below so only the model differs. */
32
+ const fixtureDelayIdentity = {
33
+ partIds: ["FIXTURE-DELAY-1"],
34
+ declaredTypes: ["Circuit.FixtureDelayMemory"],
35
+ terminalRoleGroups: [
36
+ ["cp1", "clock1"],
37
+ ["vgg", "gatebias"],
38
+ ],
39
+ };
40
+ /** Knows one macro model, by exact part id, declared type, and pinout. */
41
+ export const fixtureRegistry = {
42
+ entries: [
43
+ {
44
+ ...fixtureDelayIdentity,
45
+ model: { kind: "macro", macro: fixtureDelayMacro },
46
+ },
47
+ ],
48
+ };
49
+ /**
50
+ * The same part, declaring a DSP algorithm no runtime implements.
51
+ *
52
+ * The negative control for the model lockout, and it is the whole point of that lockout: a
53
+ * compander is a real thing a real chip in a real pedal does, it is not a delay line, and
54
+ * before `modelId` was dispatched on at all it would have *executed* as one -- plausible,
55
+ * silent and completely wrong. Only the `modelId` differs from `fixtureRegistry`, so a program
56
+ * built from this is identical in every other respect -- same pinout, same ports, same
57
+ * schedule, same stamps -- and whatever refuses it can only be refusing the model.
58
+ */
59
+ export const unimplementedMacroRegistry = {
60
+ entries: [
61
+ {
62
+ ...fixtureDelayIdentity,
63
+ model: {
64
+ kind: "macro",
65
+ macro: { ...fixtureDelayMacro, modelId: "compander" },
66
+ },
67
+ },
68
+ ],
69
+ };
70
+ /**
71
+ * The fixture part as the `digital-delay-line` model, with feedback regeneration.
72
+ *
73
+ * The positive control for the runtime's dispatch: same identity, same ports, same schedule as
74
+ * `fixtureRegistry` above, differing only in the algorithm name and the one parameter that model
75
+ * carries (`feedback`). A `digital-delay-line` that rendered as a plain delay would be the
76
+ * same plausible-wrong-pedal defect the `compander` lockout above pins, so this is the case that
77
+ * must regenerate.
78
+ */
79
+ export const digitalDelayLineRegistry = {
80
+ entries: [
81
+ {
82
+ ...fixtureDelayIdentity,
83
+ model: {
84
+ kind: "macro",
85
+ macro: {
86
+ ...fixtureDelayMacro,
87
+ modelId: "digital-delay-line",
88
+ parameters: { feedback: 0.6 },
89
+ },
90
+ },
91
+ },
92
+ ],
93
+ };
94
+ /** The `digital-delay-line` model with no regeneration: the plain-delay negative control. */
95
+ export const digitalDelayLineDryRegistry = {
96
+ entries: [
97
+ {
98
+ ...fixtureDelayIdentity,
99
+ model: {
100
+ kind: "macro",
101
+ macro: {
102
+ ...fixtureDelayMacro,
103
+ modelId: "digital-delay-line",
104
+ parameters: { feedback: 0 },
105
+ },
106
+ },
107
+ },
108
+ ],
109
+ };
110
+ /**
111
+ * Mock ICs for the parity gate (`scripts/report-fixture-spice-parity.ts`).
112
+ *
113
+ * Every chip in the corpus carrying a law that gate cannot reach is a `macro`: a BBD, a delay
114
+ * memory, a compandor. A macro is lifted out of the solver and executed as DSP, so ngspice has
115
+ * no circuit to compare against one and no fixture can change that. `sections` is the other
116
+ * thing a registry can say -- the chip expands into ordinary device laws that stay in the
117
+ * matrix -- and that is the path most of the corpus's registry-expanded devices actually take.
118
+ * These entries exist so that path has fixtures.
119
+ *
120
+ * Fictional part numbers, like every entry in this file. The *laws* are real: a mock law would
121
+ * mean the gate graded behaviour no pedal runs.
122
+ */
123
+ export const sectionsRegistry = {
124
+ entries: [
125
+ {
126
+ // One op-amp on an eight-pin package. The point of comparison is `invertingAmplifier`,
127
+ // which is the same circuit with the op-amp declared as `kind: opamp` instead: if the
128
+ // packaged one disagrees and the discrete one agrees, the defect is in expansion.
129
+ partIds: ["PKG-OPAMP-1"],
130
+ declaredTypes: [],
131
+ terminalRoleGroups: [],
132
+ model: {
133
+ kind: "sections",
134
+ pinout: [null, null, null, null, null, null, null, null],
135
+ sections: [
136
+ {
137
+ law: { kind: "ideal-opamp", railHigh: null, railLow: null, openLoopGain: 1e5 },
138
+ terminals: [0, 1, 2],
139
+ },
140
+ ],
141
+ },
142
+ },
143
+ {
144
+ /**
145
+ * An optocoupler / Vactrol: an LED facing a light-dependent resistor.
146
+ *
147
+ * `optocoupler` is four corpus packets -- the Fender tremolos -- and it is a stamp in
148
+ * the matrix rather than a lifted macro, which is what makes it referenceable at all.
149
+ * The LDR's resistance falls exponentially with LED current, so wiring the LED to the
150
+ * signal makes the row grade that coupling curve rather than one point on it.
151
+ *
152
+ * The `ldrMinOhms` / `ldrMaxOhms` span is the part fact here. `ledThresholdVolts` and
153
+ * `ledTransconductance` are *not*: both are required by the law's type and neither
154
+ * runtime reads them -- see
155
+ * docs/troubleshootings/an-optocouplers-declared-led-parameters-are-not-executed.md.
156
+ */
157
+ partIds: ["PKG-OPTO-1"],
158
+ declaredTypes: [],
159
+ terminalRoleGroups: [],
160
+ model: {
161
+ kind: "sections",
162
+ pinout: [null, null, null, null, null, null, null, null],
163
+ sections: [
164
+ {
165
+ law: {
166
+ kind: "optocoupler",
167
+ ledThresholdVolts: 1.6,
168
+ ledTransconductance: 0.001,
169
+ ldrMinOhms: 1000,
170
+ ldrMaxOhms: 100_000,
171
+ },
172
+ terminals: [0, 1, 2, 3],
173
+ },
174
+ ],
175
+ },
176
+ },
177
+ {
178
+ /**
179
+ * A CMOS transmission gate: a conductance between two signal pins, set by a third.
180
+ *
181
+ * `analog-switch` is two corpus packets and had no fixture. The law is a smooth
182
+ * sigmoid rather than a hard throw -- `gOff + (gOn - gOff) / (1 + exp(-10 * (vCtrl -
183
+ * Vth)))` -- so it has a curve to grade rather than two states, which is why an
184
+ * ngspice `S` element would be the wrong reference for it.
185
+ */
186
+ partIds: ["PKG-SWITCH-1"],
187
+ declaredTypes: [],
188
+ terminalRoleGroups: [],
189
+ model: {
190
+ kind: "sections",
191
+ pinout: [null, null, null, null, null, null, null, null],
192
+ sections: [
193
+ {
194
+ // Threshold at 0 V so the fixture's own signal drives the gate across the
195
+ // curve. A CD4066's real threshold sits mid-rail; this one is placed where
196
+ // the sigmoid is steepest, because a row biased hard on would grade the
197
+ // on-resistance and never the law.
198
+ law: { kind: "analog-switch", onOhms: 125, offOhms: 1e6, thresholdVolts: 0 },
199
+ terminals: [0, 1, 2],
200
+ },
201
+ ],
202
+ },
203
+ },
204
+ {
205
+ /**
206
+ * An open-collector comparator: the output is pulled toward `vee` or left floating.
207
+ *
208
+ * `comparator` is one corpus packet. Like the analog switch it is a sigmoid, not a
209
+ * step: `gOn / (1 + exp(k * vDiff)) + gOff` between output and `vee`. A fourth
210
+ * terminal would name `vee`; three leaves it at ground, which is the common wiring.
211
+ */
212
+ partIds: ["PKG-COMPARATOR-1"],
213
+ declaredTypes: [],
214
+ terminalRoleGroups: [],
215
+ model: {
216
+ kind: "sections",
217
+ sections: [
218
+ {
219
+ // A soft comparator, and every number here is chosen against a measurement.
220
+ // Sensitivity 8 rather than a decisive several hundred spans the sigmoid
221
+ // smoothly at this fixture's 0.1 V drive instead of producing switching
222
+ // edges, whose *timing* a fixed-step runtime and an adaptive-step ngspice
223
+ // resolve differently for reasons that are not the law. The 22:1 on/off
224
+ // conductance ratio is likewise deliberate: at the stiffer 1e4:1 first
225
+ // tried, the runtime's Newton failed to converge on 120 samples and the row
226
+ // reported `unconverged`, which says nothing about the comparator.
227
+ law: { kind: "comparator", pullDownOhms: 2200, floatOhms: 1e4, sensitivity: 8 },
228
+ terminals: [0, 1, 2],
229
+ },
230
+ ],
231
+ pinout: [null, null, null, null, null, null, null, null],
232
+ },
233
+ },
234
+ {
235
+ /**
236
+ * The four-terminal OTA: the one the corpus actually uses.
237
+ *
238
+ * A fourth mapped terminal is an amplifier-bias pin, and its presence is what selects
239
+ * the nonlinear part over the linear fallback. The bias pin sinks a diode current to
240
+ * `vee` -- unmapped here, so ground -- and that current sets the output's scale, so a
241
+ * declaration error in the bias pin changes the gain rather than nothing. The output
242
+ * is `2 * Iabc * tanh(vDiff / 2Vt)`: compressive by construction, which is the whole
243
+ * reason a phaser built on one sounds like a phaser.
244
+ */
245
+ partIds: ["PKG-OTA-NL-1"],
246
+ declaredTypes: [],
247
+ terminalRoleGroups: [],
248
+ model: {
249
+ kind: "sections",
250
+ pinout: [null, null, null, null, null, null, null, null],
251
+ sections: [
252
+ {
253
+ // `transconductance` is unread on this path: with a bias terminal the scale
254
+ // comes from `Iabc`, not from a declared gm. It is required by the law's type.
255
+ law: { kind: "ota", transconductance: 1e-3 },
256
+ terminals: [0, 1, 2, 3],
257
+ },
258
+ ],
259
+ },
260
+ },
261
+ {
262
+ // A transconductor: output current is gm times the input difference. `ota` is 5 corpus
263
+ // packets and has no fixture at all, because every real OTA arrives inside an `ic`.
264
+ partIds: ["PKG-OTA-1"],
265
+ declaredTypes: [],
266
+ terminalRoleGroups: [],
267
+ model: {
268
+ kind: "sections",
269
+ pinout: [null, null, null, null, null, null, null, null],
270
+ sections: [
271
+ {
272
+ law: { kind: "ota", transconductance: 1e-3 },
273
+ terminals: [0, 1, 2],
274
+ },
275
+ ],
276
+ },
277
+ },
278
+ ],
279
+ };
280
+ /** Knows one part as a lumped law rather than a macro model. */
281
+ export const resistiveChipRegistry = {
282
+ entries: [
283
+ {
284
+ partIds: ["FIXTURE-RESISTIVE-1"],
285
+ declaredTypes: [],
286
+ terminalRoleGroups: [],
287
+ model: { kind: "law", law: { kind: "conductance", siemens: 1e-4 } },
288
+ },
289
+ ],
290
+ };
291
+ /**
292
+ * Knows one multi-section part: a fictional dual op-amp on eight pins.
293
+ *
294
+ * The shape real dual op-amps take, without a real part number. Sections index the device's own
295
+ * terminals, so pins 4 and 7 -- the supply pins -- appear in no section and contribute nothing,
296
+ * which is correct: an `ideal-opamp` resolves its rails from the circuit's supply set rather than
297
+ * from its own pins.
298
+ */
299
+ export const dualOpampRegistry = {
300
+ entries: [
301
+ {
302
+ partIds: ["FIXTURE-DUAL-OPAMP-1"],
303
+ declaredTypes: [],
304
+ terminalRoleGroups: [],
305
+ model: {
306
+ kind: "sections",
307
+ // The fixture chip numbers its pins (`pin1`..`pin8`), and `terminalRoleToken` returns
308
+ // null for a bare pin number, so there is nothing to check and every position is
309
+ // unchecked. That is the honest encoding: the guard exists to catch a document whose
310
+ // *named* terminals disagree with the entry, and this one names none.
311
+ pinout: [null, null, null, null, null, null, null, null],
312
+ sections: [
313
+ // plus, minus, output -- the canonical order for an op-amp section. The rails are
314
+ // null here and substituted from the circuit's supply set at expansion, because a
315
+ // registry describes a part and the rails belong to the pedal it is fitted to.
316
+ {
317
+ law: {
318
+ kind: "ideal-opamp",
319
+ railHigh: null,
320
+ railLow: null,
321
+ // The part's own gain; only the rails come from the pedal.
322
+ openLoopGain: 2e5,
323
+ },
324
+ terminals: [0, 1, 2],
325
+ },
326
+ {
327
+ law: {
328
+ kind: "ideal-opamp",
329
+ railHigh: null,
330
+ railLow: null,
331
+ // The part's own gain; only the rails come from the pedal.
332
+ openLoopGain: 2e5,
333
+ },
334
+ terminals: [5, 4, 3],
335
+ },
336
+ ],
337
+ },
338
+ },
339
+ ],
340
+ };
341
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/fixtures/registry.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,EAAE;AACF,4EAA4E;AAC5E,qFAAqF;AACrF,qEAAqE;AACrE,EAAE;AACF,oFAAoF;AACpF,wEAAwE;AACxE,EAAE;AACF,uFAAuF;AACvF,yFAAyF;AACzF,4FAA4F;AAC5F,2FAA2F;AAI3F,MAAM,iBAAiB,GAAmB;IACzC,OAAO,EAAE,2BAA2B;IACpC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAC5B,4FAA4F;IAC5F,qFAAqF;IACrF,KAAK,EAAE;QACN,OAAO,EAAE,CAAC,IAAI,CAAC;QACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;QACzB,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;KAC5B;IACD,oFAAoF;IACpF,iFAAiF;IACjF,2EAA2E;IAC3E,gFAAgF;IAChF,sBAAsB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;IACxD,uBAAuB,EAAE,CAAC;CAC1B,CAAC;AAEF,4FAA4F;AAC5F,MAAM,oBAAoB,GAA6B;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,GAAiB;IAC9C,OAAO,EAAE;QACR;YACC,OAAO,EAAE,CAAC,sBAAsB,CAAC;YACjC,aAAa,EAAE,EAAE;YACjB,kBAAkB,EAAE,EAAE;YACtB,KAAK,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,sFAAsF;gBACtF,iFAAiF;gBACjF,qFAAqF;gBACrF,sEAAsE;gBACtE,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;gBACxD,QAAQ,EAAE;oBACT,kFAAkF;oBAClF,kFAAkF;oBAClF,+EAA+E;oBAC/E;wBACC,GAAG,EAAE;4BACJ,IAAI,EAAE,aAAa;4BACnB,QAAQ,EAAE,IAAI;4BACd,OAAO,EAAE,IAAI;4BACb,2DAA2D;4BAC3D,YAAY,EAAE,GAAG;yBACjB;wBACD,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;qBACpB;oBACD;wBACC,GAAG,EAAE;4BACJ,IAAI,EAAE,aAAa;4BACnB,QAAQ,EAAE,IAAI;4BACd,OAAO,EAAE,IAAI;4BACb,2DAA2D;4BAC3D,YAAY,EAAE,GAAG;yBACjB;wBACD,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;qBACpB;iBACD;aACD;SACD;KACD;CACD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type PartRegistry } from "./registry";
2
+ import type { CompileWarning, Netlist } from "./types";
3
+ /**
4
+ * One warning per tube device whose part number the registry does not answer.
5
+ *
6
+ * Reported per device rather than per part number, because "which tube is generic" and "how much of
7
+ * this amp is generic" are different questions and the second is the one that decides whether a
8
+ * render can be quoted. An amp whose preamp is catalogued and whose output pair is not is a
9
+ * different claim from one where nothing resolved.
10
+ */
11
+ export declare function findGenericTubeFits(netlist: Netlist, registry: PartRegistry): readonly CompileWarning[];
12
+ //# sourceMappingURL=generic-tube-fit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-tube-fit.d.ts","sourceRoot":"","sources":["../src/generic-tube-fit.ts"],"names":[],"mappings":"AAaA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,YAAY,GACpB,SAAS,cAAc,EAAE,CAqB3B"}
@@ -0,0 +1,45 @@
1
+ // A tube running a device-class fit instead of its own.
2
+ //
3
+ // This exists because the alternative was measured: every triode in the corpus ran a 12AX7 fit and
4
+ // every pentode a 6V6 fit, silently, for as long as v2 has compiled an amp. `vox-ac15-top-boost`'s
5
+ // EL84s were handed `mu 8.0` where the part's own fit says 21.29, which biased the shared cathode
6
+ // resistor to 23 V, cut the output stage off and decayed the amp to 2.5 mV. Nothing reported it,
7
+ // because a fallback that returns a working law looks exactly like a fallback that returns the
8
+ // right one. See `docs/troubleshootings/every-tube-gets-a-generic-fit-not-its-declared-device.md`.
9
+ //
10
+ // A warning rather than a refusal: an unregistered tube still gets a device-class law, exactly as
11
+ // an unregistered transistor does, and refusing every amp whose tube is not catalogued would trade
12
+ // a working corpus for a complete one.
13
+ import { registryLawFor } from "./registry.js";
14
+ /** The tube kinds whose law a part number can refine. */
15
+ const TUBE_KINDS = new Set(["triode", "pentode", "tube-diode"]);
16
+ /**
17
+ * One warning per tube device whose part number the registry does not answer.
18
+ *
19
+ * Reported per device rather than per part number, because "which tube is generic" and "how much of
20
+ * this amp is generic" are different questions and the second is the one that decides whether a
21
+ * render can be quoted. An amp whose preamp is catalogued and whose output pair is not is a
22
+ * different claim from one where nothing resolved.
23
+ */
24
+ export function findGenericTubeFits(netlist, registry) {
25
+ const warnings = [];
26
+ for (const device of netlist.devices) {
27
+ if (!TUBE_KINDS.has(device.kind)) {
28
+ continue;
29
+ }
30
+ const partNumber = device.identity.partNumber;
31
+ if (registryLawFor(registry, partNumber, device.kind) !== null) {
32
+ continue;
33
+ }
34
+ warnings.push({
35
+ code: "generic-tube-fit",
36
+ device: device.id,
37
+ partNumber,
38
+ detail: partNumber === null
39
+ ? `${device.kind} declares no part number, so it runs the generic device-class fit and its bias and gain are not this tube's`
40
+ : `${device.kind} ${partNumber} is not in the catalog, so it runs the generic device-class fit -- its bias and gain are another tube's`,
41
+ });
42
+ }
43
+ return warnings;
44
+ }
45
+ //# sourceMappingURL=generic-tube-fit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-tube-fit.js","sourceRoot":"","sources":["../src/generic-tube-fit.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,mGAAmG;AACnG,mGAAmG;AACnG,kGAAkG;AAClG,iGAAiG;AACjG,+FAA+F;AAC/F,mGAAmG;AACnG,EAAE;AACF,kGAAkG;AAClG,mGAAmG;AACnG,uCAAuC;AAEvC,OAAO,EAAE,cAAc,EAAqB,MAAM,YAAY,CAAC;AAG/D,yDAAyD;AACzD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAClC,OAAgB,EAChB,QAAsB;IAEtB,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,SAAS;QACV,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC9C,IAAI,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,IAAa,CAAC,KAAK,IAAI,EAAE,CAAC;YACzE,SAAS;QACV,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,kBAAkB;YACxB,MAAM,EAAE,MAAM,CAAC,EAAE;YACjB,UAAU;YACV,MAAM,EACL,UAAU,KAAK,IAAI;gBAClB,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,6GAA6G;gBAC7H,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,UAAU,yGAAyG;SACzI,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { CompileWarning, Program } from "./types";
2
+ /**
3
+ * Clock drivers whose `vdd` row is the ground row, and therefore render no clock at all.
4
+ *
5
+ * **Why this is a program-level check and not a netlist one.** `vdd` is a *row index* into the
6
+ * block's solution, not a source node id, so whether it is ground is only knowable after `link`
7
+ * has assigned rows and `nodeIds` maps them back. Reading `stamp.vdd === 0` directly would happen
8
+ * to work while row 0 is conventionally ground and would break silently the day it is not.
9
+ *
10
+ * See `ClockDriverSupplyAtGroundWarning` for why a correct transcription lands here.
11
+ */
12
+ export declare function findGroundedClockSupplies(program: Program): readonly CompileWarning[];
13
+ //# sourceMappingURL=grounded-clock-supply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grounded-clock-supply.d.ts","sourceRoot":"","sources":["../src/grounded-clock-supply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,OAAO,GACd,SAAS,cAAc,EAAE,CAkC3B"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Clock drivers whose `vdd` row is the ground row, and therefore render no clock at all.
3
+ *
4
+ * **Why this is a program-level check and not a netlist one.** `vdd` is a *row index* into the
5
+ * block's solution, not a source node id, so whether it is ground is only knowable after `link`
6
+ * has assigned rows and `nodeIds` maps them back. Reading `stamp.vdd === 0` directly would happen
7
+ * to work while row 0 is conventionally ground and would break silently the day it is not.
8
+ *
9
+ * See `ClockDriverSupplyAtGroundWarning` for why a correct transcription lands here.
10
+ */
11
+ export function findGroundedClockSupplies(program) {
12
+ const warnings = [];
13
+ for (const block of program.blocks) {
14
+ if (block.kind !== "mna") {
15
+ continue;
16
+ }
17
+ for (const stamp of block.stamps) {
18
+ if (stamp.kind !== "clock-driver") {
19
+ continue;
20
+ }
21
+ // **Both** supply pins, not just `vdd`. Until the stamp gained a `gnd` terminal it
22
+ // swung the phases between `vdd` and literal ground, so `vdd` at ground alone was
23
+ // fatal and this warned on it; that is no longer true and warning on it would now be
24
+ // a false alarm on two correctly-wired packets. What remains fatal is having no
25
+ // supply to swing between at all.
26
+ const vddNode = block.nodeIds?.[stamp.vdd] ?? stamp.vdd;
27
+ const gndNode = block.nodeIds?.[stamp.gnd] ?? stamp.gnd;
28
+ if (vddNode !== 0 || gndNode !== 0) {
29
+ continue;
30
+ }
31
+ warnings.push({
32
+ code: "clock-driver-supply-at-ground",
33
+ device: null,
34
+ detail: `Clock driver in block ${block.id} has both supply terminals at circuit ground ` +
35
+ `(VDD row ${stamp.vdd}, GND row ${stamp.gnd}), so there is no potential for its ` +
36
+ "clock phases to swing between and CP1, CP2 and VGG all render as zero -- the " +
37
+ "bucket brigade receives no clock. The MN3101/MN3102 run on a single negative " +
38
+ "supply, so exactly one of these two pins should sit at a rail: a +9 V pedal ties " +
39
+ "the part's GND pin to the positive rail and its VDD pin to circuit ground.",
40
+ });
41
+ }
42
+ }
43
+ return warnings;
44
+ }
45
+ //# sourceMappingURL=grounded-clock-supply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grounded-clock-supply.js","sourceRoot":"","sources":["../src/grounded-clock-supply.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CACxC,OAAgB;IAEhB,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YAC1B,SAAS;QACV,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACnC,SAAS;YACV,CAAC;YACD,mFAAmF;YACnF,kFAAkF;YAClF,qFAAqF;YACrF,gFAAgF;YAChF,kCAAkC;YAClC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC;YACxD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC;YACxD,IAAI,OAAO,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;gBACpC,SAAS;YACV,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,+BAA+B;gBACrC,MAAM,EAAE,IAAI;gBACZ,MAAM,EACL,yBAAyB,KAAK,CAAC,EAAE,+CAA+C;oBAChF,YAAY,KAAK,CAAC,GAAG,aAAa,KAAK,CAAC,GAAG,sCAAsC;oBACjF,+EAA+E;oBAC/E,+EAA+E;oBAC/E,mFAAmF;oBACnF,4EAA4E;aAC7E,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { type PartRegistry } from "./registry";
2
+ import type { Device, PartIdentity } from "./types";
3
+ /** Kinds whose behaviour is not determined by the netlist and so need a part. */
4
+ export declare function requiresIdentification(device: Device): boolean;
5
+ /**
6
+ * Kinds whose behaviour a registry **may** extend, as opposed to supply outright.
7
+ *
8
+ * `ic` and `power-amp` have no behaviour except a part's, so for them the registry is the only
9
+ * source and its silence is a refusal -- that is `requiresIdentification` above. An `ota` is
10
+ * different in both directions: it carries a universal device-class law
11
+ * (`I_out = gm * (V+ - V-)`), so an unregistered one must still work; and a registered one can be
12
+ * *more* than that law, because a single `ota` stamp cannot carry a second section. A BA662A is
13
+ * an OTA **plus** a Darlington buffer, and before this `boss-cs-2`'s `bufferinput`/`buffertie`
14
+ * net was touched by no stamp in the compiled program at all.
15
+ *
16
+ * So this is consulted only where a `sections` model is being looked up. It deliberately does not
17
+ * widen `requiresIdentification`: doing that put OTAs through the `ic` shell/isolation predicates
18
+ * and the unmatched-pinout refusal, which cost `electro-harmonix-small-stone` all five of its
19
+ * CA3094 stamps at once.
20
+ */
21
+ export declare function mayCarryRegistrySections(device: Device): boolean;
22
+ /**
23
+ * An op-amp whose registered *part* says it is not an op-amp, so the part's law overrides the
24
+ * device-class law even though the class law can read the terminals.
25
+ *
26
+ * The class law is `ideal-opamp`; a `sections` entry whose law kind is not that is the part
27
+ * disagreeing with the drawn kind. That is typed evidence the part carries and the document's
28
+ * `kind: opamp` is a drawing convenience: an LM339 drawn as an op-amp is still an
29
+ * open-collector comparator, and the ideal-op-amp output that stamps binds the shared node is
30
+ * a voltage source where the real part is a sink-or-float. `moogerfooger-mf-102`'s `U2A`/`U2C`
31
+ * wire-OR onto one pull-up resistor because the LM339's outputs *are* open-collector; a voltage
32
+ * source makes that node over-determined and the packet renders silence.
33
+ *
34
+ * Match is the same whole-token exact part id (rung 1) or canonical die (rung 4) the evidence
35
+ * ladder uses, so a prose mention can never admit one. The default registry is consulted with the
36
+ * arity deliberately unconstrained: an arity *mismatch* against a comparator entry still wants the
37
+ * registration question to end where it would today -- rung 3 -- rather than falling through to
38
+ * `declaredType`, whose class would re-stamp the drawn `opamp`.
39
+ */
40
+ /**
41
+ * A bipolar transistor whose exact part id the registry expands into sections -- a bias-resistor
42
+ * built-in transistor (a "digital transistor") such as Toshiba's RN1307, whose datasheet puts a
43
+ * series base resistor and a base-emitter resistor inside the package. The class law is a bare
44
+ * transistor and cannot know they are there; the part number can. Every other BJT keeps its class
45
+ * law untouched, because no other BJT has a sections entry.
46
+ */
47
+ export declare function bjtPartRegisteredAsSections(device: Device, registry: PartRegistry): boolean;
48
+ export declare function opampPartRegisteredAsOtherLaw(device: Device, registry: PartRegistry): boolean;
49
+ export declare function identify(device: Device, registry: PartRegistry): PartIdentity | null;
50
+ //# sourceMappingURL=identify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../src/identify.ts"],"names":[],"mappings":"AAwBA,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGpD,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAahE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAU3F;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAsB7F;AAoBD,wBAAgB,QAAQ,CACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,GACpB,YAAY,GAAG,IAAI,CA0KrB"}