Commit 603cda5
feat(coprocessor): Phase 6B — Dsp + Io + Graphics + Audio + Fpga backends
Completes the coprocessor kind ladder begun in Phase 0 + 6A. All 11
CoprocessorKind variants (Math, Vector, Tensor, Crypto, Physics,
FlintMath, Dsp, Io, Graphics, Audio, Fpga) now have full Rust impls
with no stubs.
Dsp (src/rust/coprocessor/dsp.rs):
- 4 ops: DspFft, DspIfft, DspHannWindow, DspHammingWindow.
- Backed by rustfft 6 (Apache-2.0 / MIT). FFT input/output uses
FloatVec with re/im interleaved (avoids inventing a Complex outcome
variant). IFFT scales by 1/N for round-trip identity — verified to
1e-9 over a sine-wave test. Length checks classify odd-length
spectra as Failure. Tier 3 (LibraryWrapped).
Io (src/rust/coprocessor/io.rs):
- 3 ops: IoReadAll (16 MiB cap, returns Hex), IoLineCount (BigInt),
IoSha256OfFile (streams 64 KiB chunks, returns Hex). Async via
tokio::fs. Missing files return Empty; permission errors return
Failure with diagnostic. RFC SHA-256("abc") test vector green.
Tier 3.
Graphics (src/rust/coprocessor/graphics.rs):
- 2 ops: GraphicsProofGraphSvg (depth-aware vertical-waterfall layout
with edges + rounded-rect nodes), GraphicsBarChartSvg (normalised
heights, escaped labels). Pure Rust, no GPU dependency, no svg
crate — emits SVG strings directly and Hex-wraps for wire safety.
XML escape verified against `<dangerous & "chars">` input. Tier 3.
Audio (src/rust/coprocessor/audio.rs):
- 2 ops: AudioSineWave (frequency + duration + sample_rate → WAV bytes,
Nyquist-checked, sample_rate range [8 kHz, 192 kHz]),
AudioCompletionChime (pre-baked C5/E5/G5 100 ms each). Pure Rust
PCM-16 + RIFF packing — no audio library dep. RIFF/WAVE/fmt /data
chunk magic numbers verified. Tier 3.
Fpga (src/rust/coprocessor/fpga.rs):
- 1 op: FpgaYosysSynth — subprocess to `yosys -p "synth -top X; write_verilog"`.
Health flips Unhealthy at construction if yosys not on PATH so the
MetaController can route around. top_module name validated against
shell-injection (alphanum + underscore, no leading digit). Tier 1
(ExternalSubprocess) — yosys is a witness oracle, not certifying.
Wiring:
- CoprocessorKind: + Dsp, Io, Graphics, Audio, Fpga. CoprocessorFactory
::native dispatches all five. julia_bridge kind_name covers all
eleven kinds.
- src/abi/CoprocessorForeign.idr: + 6 kind discriminants (5..10),
extended kindEncodeDecodeId proof — case analysis still discharges
every variant constructively. Zero believe_me.
- Cargo.toml: + rustfft 6.
Also: `tptp_output.rs` was orphan-tracked in cbd9449 (used by 4 HO-ATPs
but missing from the commit) — fixed in 1ad49f8 alongside this work.
Tests: 54 coprocessor tests green (10 Math + 6 Vector + 6 Tensor + 6
Crypto + 4 Physics + 1 factory + 5 Dsp + 4 Io + 4 Graphics + 4 Audio
+ 4 Fpga). panic-attack assail clean on all five new files (the
Graphics 1 "weak point" is allocation-counting noise, not a defect).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1ad49f8 commit 603cda5
12 files changed
Lines changed: 1533 additions & 39 deletions
File tree
- .machine_readable/6a2
- src
- abi
- rust/coprocessor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | | - | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
102 | 109 | | |
103 | 110 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
109 | 122 | | |
110 | 123 | | |
111 | 124 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
118 | 137 | | |
119 | 138 | | |
120 | | - | |
121 | | - | |
| 139 | + | |
122 | 140 | | |
123 | 141 | | |
124 | 142 | | |
125 | 143 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
131 | 155 | | |
132 | 156 | | |
133 | 157 | | |
| |||
172 | 196 | | |
173 | 197 | | |
174 | 198 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
0 commit comments