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:#4caf50,color:#fff style Y fill:#4caf50,color:#fff style T1 fill:#2196f3,color:#fff style T2 fill:#2196f3,color:#fff style T3 fill:#2196f3,color:#fff style H0 fill:#ff9800,color:#fff style H1 fill:#ff9800,color:#fff style H2 fill:#ff9800,color:#fff style H3 fill:#ff9800,color:#fff
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:#4caf50,color:#fff style B fill:#ff9800,color:#fff style C fill:#2196f3,color:#fff style D fill:#9c27b0,color:#fff style E fill:#2196f3,color:#fff style F fill:#ff9800,color:#fff style G fill:#4caf50,color:#fff style H fill:#f44336,color:#fff
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:#4caf50,color:#fff style B fill:#ff9800,color:#fff style C fill:#4caf50,color:#fff style D fill:#f44336,color:#fff style E fill:#2196f3,color:#fff
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:#4caf50,color:#fff style E2 fill:#4caf50,color:#fff style SE1 fill:#ffeb3b style SE2 fill:#ff9800,color:#fff style CP1 fill:#f44336 style CP2a fill:#f44336 style CP2b fill:#f44336
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:#2196f3,color:#fff style B fill:#ff9800,color:#fff style C fill:#9c27b0,color:#fff style D fill:#4caf50,color:#fff style E fill:#607d8b,color:#fff style F fill:#f44336,color:#fff style G fill:#f44336,color:#fff style H fill:#f44336,color:#fff style I fill:#f44336,color:#fff
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:#f44336,color:#fff style A2 fill:#f44336,color:#fff style A3 fill:#f44336,color:#fff style C1 fill:#f44336,color:#fff style B1 fill:#4caf50,color:#fff style B2 fill:#4caf50,color:#fff style B3 fill:#4caf50,color:#fff style C2 fill:#4caf50,color:#fff
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:#2196f3,color:#fff style C1 fill:#2196f3,color:#fff style C2 fill:#2196f3,color:#fff style C3 fill:#2196f3,color:#fff style PAT fill:#ff9800,color:#fff style V0 fill:#4caf50,color:#fff style V1 fill:#4caf50,color:#fff
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:#f44336,color:#fff style W2 fill:#4caf50,color:#fff
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:#f44336,color:#fff style PC fill:#4caf50,color:#fff style OUT fill:#ff9800,color:#fff
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:#2196f3,color:#fff style S2 fill:#2196f3,color:#fff style S3 fill:#2196f3,color:#fff style S4 fill:#ff9800,color:#fff style R1 fill:#4caf50,color:#fff style R2 fill:#4caf50,color:#fff style R3 fill:#4caf50,color:#fff style R4 fill:#4caf50,color:#fff