graph LR V["Verilog\n.v"] --> Y["Yosys\nSynthesis"] Y --> J["Netlist\nJSON"] Y --> L["Liberty\n.lib"] J --> A["Analysis\nPython/C++"] style J fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
flowchart TD S["Start"] --> F["Open file (rb)"] F --> E["ijson.parse(f)"] E --> L{Event Loop} L -->|".cells + map_key"| C["Record cell name"] L -->|".ports + map_key"| P["Record port name"] L -->|".connections + number"| N["Record (cell, net_id)"] L -->|".ports.bits + number"| B["Record (port, net_id)"] L -->|"end_map 1st mod"| X["Stop โน"] C --> L P --> L N --> L B --> L style S fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style F fill:#fff9c4,stroke:#f57f17,stroke-width:3px style E fill:#fff9c4,stroke:#f57f17,stroke-width:3px style L fill:#fff9c4,stroke:#f57f17,stroke-width:3px style C fill:#fff9c4,stroke:#f57f17,stroke-width:3px style P fill:#fff9c4,stroke:#f57f17,stroke-width:3px style N fill:#fff9c4,stroke:#f57f17,stroke-width:3px style B fill:#fff9c4,stroke:#f57f17,stroke-width:3px style X fill:#ffccbc,stroke:#bf360c,stroke-width:3px
sequenceDiagram participant P as Parser participant H as Handler participant S as State P->>H: start_object() H->>S: push "root" P->>H: key("modules") H->>S: key_stack = "modules" P->>H: start_object(1) H->>S: push "modules" โ ["modules"] P->>H: key("top") H->>S: key_stack = "top" P->>H: start_object(3) H->>S: push "top" โ ["modules","top"] P->>H: key("ports") H->>S: key_stack = "ports" Note over H: Path = join(stack, ".")
xychart-beta title "Python DOM vs SAX (ms)" x-axis ["yosys_and2\n(small)", "sphere\n(482 KB)", "sphere3hopf\n(528 KB)"] y-axis "Mean (ms)" 0 --> 90 bar [0.38, 31.5, 59.2] bar [0.39, 19.3, 88.3]
graph TD subgraph Python["๐ Python"] PD["DOM: json.load()"] PS["SAX: ijson.parse()"] end subgraph Cpp["๐ง C++"] CD["DOM: json::parse()"] CS["SAX: json::sax_parse()"] end PD -->|"31 ms"| R1["Result"] PS -->|"19 ms"| R1 CD -->|"24 ms"| R2["Result"] CS -->|"5 ms"| R2 R1 -.->|"SAX 1.6x"| Note1["Mixed results"] R2 -.->|"SAX 5.0x"| Note2["Consistent win"] style CS fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style PS fill:#fff9c4,stroke:#f57f17,stroke-width:3px
flowchart LR subgraph Input["๐ Input"] J["Yosys JSON File"] end subgraph Sax["โก SAX Parser"] P["Event Stream"] S["State Machine"] C["Collected Data"] end subgraph Build["๐ Assembly"] G["Bipartite Graph"] N["Netlist Object"] end J -->|"read_yosys_json_sax()"| P P --> S S --> C C --> G G --> N style Sax fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style Build fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px