Close

WPMS Synthesizer — Layer 1 Specification [ 4 ]

A project log for FPGA Spectrum Engine

10,240 independent oscillators · 1-sample latency · 0.001 Hz resolution

tsuneoohnakaTsuneo.Ohnaka 05/07/2026 at 12:400 Comments

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 出力を生成する:

SignalWidthFormatDirection
sin_out41Q0.40 signedMaclaurin → amplitude multiplier
sin_valid1active-highMaclaurin → amplitude multiplier
bin_index_out11unsignedMaclaurin → 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 章の「コア外では贅沢に」原則に記録された理由により拒否する

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) 計算に影響する:

SourceMagnitude (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 XStage 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 項目として記録され、異なる制約下の将来の変種が利用可能である:

ItemThis implementation choosesAlternative 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 budget30 clocks (16 used, 14 reserved)Tighter for FPGAs with smaller routing budgets
27×27 DSP constraint scopeMaclaurin core internal onlyWhole-pipeline 27×27 for tighter DSP-budget targets
sin(x) output widthQ0.40 (rich)Q0.27 (compact) for tightly-resource-constrained targets
Truncation rounding policyToward zeroRound-to-nearest if measurement reveals audible bias
2π·ξ formationMaterialized x' (one stage)Folded into X = (2π·ξ)² (saves a stage but loses x' for final mult)
Phase resolutionQ0.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 層軌跡に残される。決定的な解決には経験的測定または下流章のコンテキストを要するためである:

QuestionReason for deferral
Exact placement constraints for the 7 DSP blocks within Cyclone V's DSP columnsEmpirical: depends on Quartus Fitter behavior on specific device
Measurement of audible truncation bias under truncation-toward-zero policyEmpirical: requires DAC output measurement
Whether the Approach-B 80 ns latency overhead causes any musically perceptible delay vs Approach-AEmpirical: requires A/B listening test
Whether Standard configuration (5 modules) requires changes to the Maclaurin core itself, or only replication of itArchitectural: depends on Chapter 4's summation tree topology
Whether the folded "X = (2π·ξ)²" variant could save the materialization stage in a future implementationArchitectural: 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 FPGAsAudibility: requires measurement of 9th-order error vs 24-bit DAC

2.11 Summary of Chapter 2 Decisions / 第 2 章決定事項のまとめ

IDDecisionStatus
C2-D1Polynomial: 11th-order Maclaurin truncation of sin(x)Fixed
C2-D2Evaluation form: Horner Approach B (2 clk/stage, constant absorption)Fixed for reference impl, tie preserved
C2-D3Coefficients C₃...C₁₁ pre-computed and DSP-coefficient-register-loadedFixed
C2-D4Argument range reduction: four-quadrant decomposition; x' ∈ [0, π/2)Fixed
C2-D5Quadrant identification: top 2 bits of Q0.32 phase accumulatorFixed
C2-D6x' format: Q2.25 (27-bit signed); 2π scaling absorbed via formattingFixed
C2-D727×27 DSP constraint applies to Maclaurin core internal multiplies onlyFixed
C2-D8sin(x) output: Q0.40 signed (41 bits)Fixed
C2-D9Pipeline depth: 9 logical stages, 16 clocks (Approach B); 14-clock reserve from 30-clock budgetFixed
C2-D10DSP block count per Maclaurin core: 7 (1 X-square + 5 Horner inner + 1 final)Fixed
C2-D11Truncation policy: toward zero everywhereFixed (subject to Open Question on audibility)
C2-D12Input contract: phase_in (Q0.32, 32 bits), phase_valid, bin_index, pipeline_readyFixed
C2-D13Output contract: sin_out (Q0.40, 41 bits), sin_valid, bin_index_outFixed
C2-D14Error budget: total ~1.3 × 10⁻⁷, matched to 24-bit DAC quantumFixed
C2-D15Verification 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 章(数列変調パイプラインプロセッサ仕様)が続く。

Discussions