graph LR subgraph Input X["x[n] ๐ถ"] end subgraph "FIR Filter ๐๏ธ" T1["zโปยน โช"] T2["zโปยน โช"] T3["zโปยน โช"] end subgraph "Coefficients ๐ข" H0["h[0]"] H1["h[1]"] H2["h[2]"] H3["h[N-1]"] end subgraph Output Y["y[n] โ "] end X --> T1 --> T2 --> T3 X -.-> H0 T1 -->|"ร"| H1 T2 -->|"ร"| H2 T3 -->|"ร"| H3 H0 -.-> Y H1 -.-> Y H2 -.-> Y H3 -.-> Y style X fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style Y fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style T1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style T2 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style T3 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style H0 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style H1 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style H2 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style H3 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px
graph TD A["๐ Filter Specs\n(N, passband, stopband, ripple)"] --> B["๐ฎ Ellipsoid Method\ncutting_plane_optim_q"] B --> C["๐ Optimized\nAuto-correlation r"] C --> D["๐ Spectral\nFactorization"] D --> E["๐ Impulse\nResponse h"] E --> F["๐งฎ CSD Quantization\ncsd_quantize"] F --> G["๐พ CSD Coefficients\n(+0-00+.0)"] G --> H["๐๏ธ Verilog Module\nshift-and-add only"] style A fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style C fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style D fill:#f3e5f5,stroke:#7b1fa2,color:#2e3440,stroke-width:3px style E fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style F fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style G fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style H fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph TD A["๐ Initial\nEllipsoid Eโ"] --> B{"๐ฎ Oracle\nLowpassOracleQ"} B -->|"feasible โ "| C["๐ฏ Found\noptimal r"] B -->|"violated โ"| D["โ๏ธ Cutting Plane\n(g, ฮฒโ, ฮฒโ)"] D --> E["โฌ๏ธ Update Ellipsoid\nparallel deep cut"] E --> B style A fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style C fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style D fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style E fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px
graph LR subgraph "Single Cut โ๏ธ" E1["Ellipsoid ๐ข"] CP1["Cut plane โโโโ"] end subgraph "Parallel Cut โก" E2["Ellipsoid ๐ข"] CP2a["Upper bound โโโโ"] CP2b["Lower bound โโโโ"] end E1 -.->|"updated"| SE1["๐ก Smaller"] E2 -.->|"updated"| SE2["๐ Much smaller"] style E1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style E2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style SE1 fill:#fff9c4,stroke:#f57f17,stroke-width:3px style SE2 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style CP1 fill:#ffcdd2,stroke:#c62828,stroke-width:3px style CP2a fill:#ffcdd2,stroke:#c62828,stroke-width:3px style CP2b fill:#ffcdd2,stroke:#c62828,stroke-width:3px
graph LR subgraph "multiplierless-cpp ๐ต โ 22 params" A["๐๏ธ Filter specs\n(6 params)"] B["๐ข CSD algo\n(5 params)"] C["๐ฌ Spectral fact\n(2 params)"] D["๐งฉ Q-optim\n(3 params)"] E["๐ Math const\n(6 shared)"] end subgraph "ellalgo-cpp ๐ด โ 9 params" F["โ๏ธ Options\n(3 params)"] G["โ๏ธ Cut control\n(2 params)"] H["๐ Computed const\n(2 params)"] I["๐ฎ Oracle defaults\n(2 params)"] end style A fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style B fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style C fill:#f3e5f5,stroke:#7b1fa2,color:#2e3440,stroke-width:3px style D fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style E fill:#eceff1,stroke:#455a64,color:#2e3440,stroke-width:3px style F fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style G fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style H fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style I fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph TD subgraph "C++ ๐ฅ๏ธ" A1["๐ฆ csd-cpp library\n(namespace csd)"] A2["๐งฎ EllAlgo-cpp\n(ellipsoid method)"] A3["๐๏ธ Multiplierless-cpp\n(filter design)"] end subgraph "Python ๐" B1["๐ฆ csdigit\n(CSD conversion)"] B2["๐ฆ ellalgo\n(ellipsoid method)"] B3["๐ฆ multiplierless\n(filter design)"] end subgraph "CLI ๐" C1["FirDesign.exe\nJSON โ CSD โ Verilog"] C2["fir-design\nJSON โ CSD โ Verilog"] end A1 --> A3 A2 --> A3 A3 --> C1 B1 --> B3 B2 --> B3 B3 --> C2 style A1 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style A2 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style A3 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style C1 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style B1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B3 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style C2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph LR subgraph "Per-coefficient CSD" C0["h0: +0-0+000+"] C1["h1: +0-0-000-"] C2["h2: +0+0-000+"] C3["h12: +000+0-0-"] end subgraph "Cross-CSE Detection ๐" PAT["Shared pattern:\n+0-"] end subgraph "Verilog Output โก" V0["wire _cse_0 =\n x_shift14 - x_shift12;"] V1["wire h0 =\n _cse_0 + x_shift4 + x_shift0;"] end C0 --> PAT C1 --> PAT C2 --> PAT C3 --> PAT PAT --> V0 V0 --> V1 style C0 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C2 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C3 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style PAT fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style V0 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style V1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph TD subgraph "Without CSE โ" W1["h0: +0- = 1 adder\nh5: +0- = 1 adder\nh13: +0- = 1 adder\nh27: +0- = 1 adder\nโโโ\nTotal: 4 adders"] end subgraph "With Cross-CSE โ " W2["_cse_0 = +0- (1 adder)\nh0 = _cse_0 >>> 6\nh5 = _cse_0 >>> 5\nh13 = _cse_0 >>> 1\nโโโ\nTotal: 1 adder!"] end style W1 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style W2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph TD subgraph "C++ ๐ฅ๏ธ" CC["FirDesign.exe\nโโโโโโโโโโโ\nc++20 ยท csd-cpp ยท ellalgo-cpp\nFFTW ยท nlohmann/json"] end subgraph "Python ๐" PC["fir-design\nโโโโโโโโโโโ\ncsdigit ยท ellalgo\nnumpy ยท json stdlib"] end subgraph "Both Output ๐ค" OUT["Same JSON + Verilog format โ "] end CC --> OUT PC --> OUT style CC fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style PC fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style OUT fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px
graph LR subgraph "Input Specs ๐" S1["N = 32 taps"] S2["ฯโ = 0.12ฯ"] S3["ฯโ = 0.20ฯ"] S4["csd_nnz = 4"] end subgraph "Result โ " R1["1350 iterations โฑ๏ธ"] R2["16-bit input"] R3["42-bit output"] R4["Cross-CSE: 8โ4 adders"] end style S1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style S2 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style S3 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style S4 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style R1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style R2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style R3 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style R4 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px