#!/usr/bin/env python3 """Print the designers' comments from one of the Flare netlist files. The Tom and Jerry netlists (reference/src/JagNetlists/netlists_org) carry the designers' prose in /* ... */ blocks between the gate instances; the prose is where the pipeline, the wait states and the dated bug fixes are explained. This prints the comments with their line numbers and drops the gates, so a 24 KB file reads as two pages. python -I scripts/netlist_comments.py tom/PREFETCH.NET python -I scripts/netlist_comments.py jerry/DSP_EXEC.NET --min 2 """ from __future__ import annotations import argparse import re import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] NETLISTS = ROOT / "reference" / "src" / "JagNetlists" / "netlists_org" COMMENT = re.compile(r"/\*.*?\*/|\(\*.*?\*\)", re.S) STOPPED = ( "netlist_comments.py is retired (2026-11-25, decisions L4 and L5): it printed text\n" "from JagNetlists (no licence), which an MIT repository no longer keeps\n" "(docs/provenance.md). The facts already taken stay in docs/, cited." ) def main() -> int: parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) parser.add_argument("netlist", help="path under netlists_org, e.g. tom/SBOARD.NET") parser.add_argument("--min", type=int, default=1, help="skip comments shorter than N lines") args = parser.parse_args() raise SystemExit(STOPPED) text = (NETLISTS / args.netlist).read_text(encoding="latin-1").replace("\r", "") for match in COMMENT.finditer(text): body = match.group(0) if body.count("\n") + 1 < args.min: continue line = text.count("\n", 0, match.start()) + 1 print(f"--- line {line}") print(body) return 0 if __name__ == "__main__": sys.exit(main())