Chapter 2: Maclaurin Pipeline Specification [ Part 2 of 2 ]
WPMS シンセサイザー — 第1層仕様書
第2章:マクローリンパイプライン仕様 【後編】
License: CC0 1.0 Universal (Public Domain) This chapter specifies the Maclaurin polynomial pipeline that computes sin(x) for each bin of the WPMS Synthesizer. It is the foundational signal-generation component of the FPGA Spectrum Engine physical layer.
ライセンス:CC0 1.0 Universal(パブリックドメイン) 本章は、WPMS シンセサイザーの各ビンの sin(x) を計算するマクローリン多項式パイプラインを仕様する。これは FPGA Spectrum Engine 物理層の信号生成基盤部品である。
2.7 Output Contract / 出力契約
2.7.1 Interface to the amplitude multiplier / 振幅乗算器へのインターフェース

The Maclaurin pipeline produces one output per clock to the amplitude multiplier (Chapter 4 territory):
マクローリンパイプラインは振幅乗算器(第 4 章領域)へ 1 クロックあたり 1 出力を生成する:
| Signal | Width | Format | Direction |
|---|---|---|---|
sin_out | 41 | Q0.40 signed | Maclaurin → amplitude multiplier |
sin_valid | 1 | active-high | Maclaurin → amplitude multiplier |
bin_index_out | 11 | unsigned | Maclaurin → amplitude multiplier (delayed by pipeline depth) |
The 41-bit signed format is Q0.40: 1 sign bit + 40 fractional bits, representing the range [−1, +1) with precision 2⁻⁴⁰ ≈ 9 × 10⁻¹³. The maximum representable positive value is 1 − 2⁻⁴⁰; the value +1 exactly is not representable (and not reachable from the polynomial truncation in any case).
41 ビット符号付きフォーマットは Q0.40:1 符号ビット + 40 小数ビットで、範囲 [−1, +1) を精度 2⁻⁴⁰ ≈ 9 × 10⁻¹³ で表現する。最大表現可能正値は 1 − 2⁻⁴⁰;値 +1 ちょうどは表現不能(およびいかなる場合も多項式打ち切りから到達不能)。
2.7.2 Why Q0.40 rather than Q0.27 / なぜ Q0.27 ではなく Q0.40 か
A simpler approach would be to truncate the Maclaurin core's output to 27 bits (Q0.26) so that the downstream amplitude multiplier (sin × A_k) can also fit in a single 27×27 DSP block. The WPMS Synthesizer rejects this simplification for the reasons recorded in Chapter 1's "spend richly outside the core" principle:
より単純なアプローチは、マクローリンコアの出力を 27 ビット(Q0.26)に切り詰めて、下流の振幅乗算器(sin × A_k)も単一の 27×27 DSP ブロックに収まるようにすることだろう。WPMS シンセサイザーはこの簡略化を、第 1 章の「コア外では贅沢に」原則に記録された理由により拒否する:

- The amplitude multiplier instantiates only twice per module (one per output channel), unlike the Maclaurin Horner stages that instantiate per-stage. A doubled DSP cost on a per-module-twice operation is amortized over 2,048 bin computations between instances. / 振幅乗算器は段ごとにインスタンス化される Horner 段とは異なり、モジュールあたり 2 回(出力チャンネルあたり 1 回)のみインスタンス化される。モジュールあたり 2 回の演算における 2 倍 DSP コストは、インスタンス間で 2,048 ビン計算にわたって償却される。
- The 13 bits of additional precision (Q0.40 vs Q0.27) directly map to better SNR in the final summed output. With 4,096 bins summed (Compact), each bin contributes a fractional share to the total; preserving low-order bits matters for the total's precision floor. / 13 ビットの追加精度(Q0.40 対 Q0.27)は最終総和出力における SNR の改善に直接マッピングする。4,096 ビンが総和される(Compact)場合、各ビンは合計に小数の取り分を寄与する。低位ビットの保持は合計の精度床にとって重要である。
- The 24-bit DAC at the HDMI output ultimately discards bits below 2⁻²³, but internal precision must exceed DAC precision to avoid quantization noise floor lift. A 40-bit internal value summed across 4,096 channels results in a total well above 24-bit precision; the 24-bit truncation at HDMI output is then a clean rounding rather than precision-limited. / HDMI 出力の 24 ビット DAC は最終的に 2⁻²³ 未満のビットを破棄するが、量子化ノイズフロアの押し上げを避けるため、内部精度は DAC 精度を超えねばならない。4,096 チャンネルにわたって総和される 40 ビット内部値は、24 ビット精度を遥かに超える合計を生む。HDMI 出力での 24 ビット切り詰めは、精度制限ではなくクリーンな丸めとなる。
2.7.3 Output validity timing / 出力有効性タイミング
The sin_out value at clock cycle N corresponds to the phase_in value received at clock cycle N − 16 (the Approach B pipeline depth). The bin_index_out signal carries the bin index forward through the same delay so that downstream stages can route the output to the correct amplitude multiplier and accumulator slot.
クロックサイクル N における sin_out 値は、クロックサイクル N − 16 で受信された phase_in 値に対応する(アプローチ B パイプライン深度)。bin_index_out 信号は同じ遅延を通じてビンインデックスを前方に運び、下流段が出力を正しい振幅乗算器および累算器スロットへ経路づけることを許す。
2.8 Error Budget / 誤差予算
2.8.1 Error sources / 誤差源

Five distinct error sources affect sin(x) computation:
5 つの異なる誤差源が sin(x) 計算に影響する:
| Source | Magnitude (relative) | Location |
|---|---|---|
| Maclaurin truncation (11th-order) | (π/2)¹³ / 13! ≈ 4 × 10⁻⁸ | Pipeline output |
| Phase quantization (Q0.32) | 2⁻³² ≈ 2.3 × 10⁻¹⁰ | Phase accumulator |
| x' truncation (Q0.30 → Q0.25) | ≈ 2⁻²⁵ × x'/(2π) ≈ 7 × 10⁻⁹ | Stage R |
| X truncation (Q4.50 → Q4.23) | ≈ 2⁻²³ ≈ 1.2 × 10⁻⁷ relative to X | Stage 0 |
| Horner stage truncation (Q1.53 → Q1.26) | ≈ 2⁻²⁶ per stage ≈ 1.5 × 10⁻⁸ | Each Horner stage |
2.8.2 Aggregate error / 集計誤差
The dominant errors are the X truncation (1.2 × 10⁻⁷) and the Maclaurin truncation (4 × 10⁻⁸). These are uncorrelated and approximately add in quadrature:
支配的誤差は X 切り詰め(1.2 × 10⁻⁷)とマクローリン切り詰め(4 × 10⁻⁸)である。これらは無相関でありおおよそ二乗加算する:
ε_total ≈ √((1.2e-7)² + (4e-8)²) ≈ 1.3 × 10⁻⁷
This is comparable to the 24-bit DAC quantum (2⁻²³ ≈ 1.2 × 10⁻⁷) and below the 23-bit threshold. The Maclaurin core delivers sin(x) accurate to approximately the DAC's least-significant-bit; further internal precision improvements would not improve audible output quality.
これは 24 ビット DAC の量子(2⁻²³ ≈ 1.2 × 10⁻⁷)に匹敵し、23 ビット閾値の下にある。マクローリンコアは概ね DAC の最下位ビットの精度で sin(x) を配送する。これ以上の内部精度改善は可聴出力品質を改善しない。
The pipeline thus operates at the ear-and-DAC-matched precision regime: not over-engineered (would waste resources), not under-engineered (would degrade output below DAC capability).
パイプラインはしたがって 耳-DAC マッチ精度領域 で動作する:過剰設計でなく(リソースを浪費する)、不足設計でもない(DAC 能力以下に出力を劣化させる)。
2.8.3 Verification anchor / 検証アンカー

The KEY[1] test-origin restore (Chapter 1 § 1.11) loads the Dirichlet-kernel test configuration. The expected output, when summed across all 2,048 active bins of Compact configuration with α = β = γ = δφ = ψ = 0, should reproduce the 2020 prototype waveform. Deviation from that waveform — measured by RMS difference of the output PCM samples against a reference recording — is the operational test of whether the Maclaurin pipeline meets its error budget.
KEY[1] テスト原点復元(第 1 章 § 1.11)は Dirichlet カーネルテスト構成をロードする。Compact 構成の全 2,048 アクティブビン(α = β = γ = δφ = ψ = 0)にわたって総和されるとき、期待される出力は 2020 年プロトタイプ波形を再現すべきである。その波形からの偏差——出力 PCM サンプルの参照録音に対する RMS 差で測定——は、マクローリンパイプラインがその誤差予算を満たすか否かの動作テストである。
2.9 Implementation Arena Items / Implementation Arena 項目

The following choices are made for the WPMS Synthesizer reference implementation but are recorded as Implementation Arena items, available for future variants under different constraints:
以下の選択は WPMS シンセサイザーリファレンス実装のためになされるが、Implementation Arena 項目として記録され、異なる制約下の将来の変種が利用可能である:
| Item | This implementation chooses | Alternative preserved for future |
|---|---|---|
| Horner variant (A vs B) | B (high-precision, 2 clk/stage) | A (low-latency, 1 clk/stage) for latency-critical use |
| Pipeline depth budget | 30 clocks (16 used, 14 reserved) | Tighter for FPGAs with smaller routing budgets |
| 27×27 DSP constraint scope | Maclaurin core internal only | Whole-pipeline 27×27 for tighter DSP-budget targets |
| sin(x) output width | Q0.40 (rich) | Q0.27 (compact) for tightly-resource-constrained targets |
| Truncation rounding policy | Toward zero | Round-to-nearest if measurement reveals audible bias |
| 2π·ξ formation | Materialized x' (one stage) | Folded into X = (2π·ξ)² (saves a stage but loses x' for final mult) |
| Phase resolution | Q0.32 (~1.1 × 10⁻⁵ Hz) | Q0.24 (C5G-like, ~3 × 10⁻³ Hz) for legacy or memory-constrained variants |
Each row of this table is a candidate for a future Layer 2 reasoning trace, should an implementer choose differently.
この表の各行は、実装者が異なる選択をする場合、将来の第 2 層推論軌跡の候補である。
2.10 Open Questions Carried Forward / 持ち越される未解決問題

The following are deliberately left for Layer 2 traces during implementation, as they require empirical measurement or downstream-chapter context to resolve definitively:
以下は意図的に実装中の第 2 層軌跡に残される。決定的な解決には経験的測定または下流章のコンテキストを要するためである:
| Question | Reason for deferral |
|---|---|
| Exact placement constraints for the 7 DSP blocks within Cyclone V's DSP columns | Empirical: depends on Quartus Fitter behavior on specific device |
| Measurement of audible truncation bias under truncation-toward-zero policy | Empirical: requires DAC output measurement |
| Whether the Approach-B 80 ns latency overhead causes any musically perceptible delay vs Approach-A | Empirical: requires A/B listening test |
| Whether Standard configuration (5 modules) requires changes to the Maclaurin core itself, or only replication of it | Architectural: depends on Chapter 4's summation tree topology |
| Whether the folded "X = (2π·ξ)²" variant could save the materialization stage in a future implementation | Architectural: depends on whether the final amplitude stage can derive x' from φ_k bits without a separate x' value |
| Whether 11th-order can be reduced to 9th-order (saving one Horner stage) when targeting microcontroller-class FPGAs | Audibility: requires measurement of 9th-order error vs 24-bit DAC |
2.11 Summary of Chapter 2 Decisions / 第 2 章決定事項のまとめ
| ID | Decision | Status |
|---|---|---|
| C2-D1 | Polynomial: 11th-order Maclaurin truncation of sin(x) | Fixed |
| C2-D2 | Evaluation form: Horner Approach B (2 clk/stage, constant absorption) | Fixed for reference impl, tie preserved |
| C2-D3 | Coefficients C₃...C₁₁ pre-computed and DSP-coefficient-register-loaded | Fixed |
| C2-D4 | Argument range reduction: four-quadrant decomposition; x' ∈ [0, π/2) | Fixed |
| C2-D5 | Quadrant identification: top 2 bits of Q0.32 phase accumulator | Fixed |
| C2-D6 | x' format: Q2.25 (27-bit signed); 2π scaling absorbed via formatting | Fixed |
| C2-D7 | 27×27 DSP constraint applies to Maclaurin core internal multiplies only | Fixed |
| C2-D8 | sin(x) output: Q0.40 signed (41 bits) | Fixed |
| C2-D9 | Pipeline depth: 9 logical stages, 16 clocks (Approach B); 14-clock reserve from 30-clock budget | Fixed |
| C2-D10 | DSP block count per Maclaurin core: 7 (1 X-square + 5 Horner inner + 1 final) | Fixed |
| C2-D11 | Truncation policy: toward zero everywhere | Fixed (subject to Open Question on audibility) |
| C2-D12 | Input contract: phase_in (Q0.32, 32 bits), phase_valid, bin_index, pipeline_ready | Fixed |
| C2-D13 | Output contract: sin_out (Q0.40, 41 bits), sin_valid, bin_index_out | Fixed |
| C2-D14 | Error budget: total ~1.3 × 10⁻⁷, matched to 24-bit DAC quantum | Fixed |
| C2-D15 | Verification anchor: 2020 Dirichlet-kernel waveform reproduction via KEY[1] | Fixed (inherited from Chapter 1) |
End of Chapter 2 / 第 2 章の末尾
Code is ephemeral; the knowledge architecture is the commons. コードは一時的なものであり、知識アーキテクチャこそが共有財産である。
Spend the precision you have for free; constrain only what costs you. 無料で得られる精度は使い切り、コストがかかるところでのみ制約せよ。
This chapter is released into the public domain under CC0 1.0 Universal. Chapter 3 (Sequence-Modulation Pipeline Processor Specification) follows.
本章は CC0 1.0 Universal のもとパブリックドメインに公開される。第 3 章(数列変調パイプラインプロセッサ仕様)が続く。
Tsuneo.Ohnaka
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.