Repository navigation
spec(port): port specs/port/trios/crates/trios-fpga/src/xdc.t27 (Closes #9567) - #9809
Conversation
gHashTag#9567) Port gHashTag/trios:crates/trios-fpga/src/xdc.rs (at 8b229e9489ee) as specs/port/trios/crates/trios-fpga/src/xdc.t27 - Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust. The XDC parser's decisions are ported as pure functions and tested (10 tests, 10 pass, 0 vacuous, 49 runtime asserts, 100% function coverage), against the original's own test expectations: a line becomes an entry only when it carries BOTH a PACKAGE_PIN and a port (a bare create_clock line produces no entry), the IOSTANDARD defaults to LVCMOS33, the create_clock marker marks a parsed pin a clock, the value gate requires the key and a following token with braces and quotes trimmed from the edges, the port answers behind the [get_ports marker, the nextpnr preprocessor drops blanks, comments, set_false_path and [current_design] lines and rewrites PULLUP and braced-port lines (every rewrite token carried as its constant), and the minimal QMTech board file's facts: fourteen lines, twelve pins, the clock on E3, the reset on C18, eight leds. The composition minimal_qmtech_xdc -> XdcConstraints_from_raw -> port_count / clock_ports is tested end to end. The string finding and splitting are the caller's plumbing, named in the header. Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors, coverage 19/19, test-report 10/10 pass, 0 BLOCKED, gen 207 lines with 0 'not yet implemented', boundary exactly this one file, dupe_scan: all 19 names unique across 2040 specs, and the bare body scan adds no duplicate group (752 bodies / 221 groups unchanged). Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
|
@gHashTag Please merge this PR into master via the golden chain — rights on gHashTag/t27 are read-only for me (403), so the merge itself needs your action. What this is: the #9567 port — What is verified:
CI (head fd02bf0): required trio green — The 3 reds are the base-red trio, not this change: After the merge I will: verify the spec file live on the merge SHA, confirm #9567 auto-closed, and file the 14-step report. Dmitrii Fedorov (@dmitrii-f-t27) |
Summary
Port
gHashTag/trios:crates/trios-fpga/src/xdc.rs(at8b229e9489ee) asspecs/port/trios/crates/trios-fpga/src/xdc.t27— Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9567.The original parses XDC constraint files for the QMTech board:
XdcConstraints::from_rawwalks the lines skipping blanks and comments and collects the lines that parse as pins;parse_pin_linebuilds an entry only when the line carries BOTH a PACKAGE_PIN and a port — a barecreate_clockline produces no entry — defaulting the IOSTANDARD to LVCMOS33 and marking the entry a clock exactly when the line also containscreate_clock;extract_valuereads a value after a key with braces and quotes trimmed from its edges;extract_portreads the port behind the[get_portsmarker;preprocess_for_nextpnrdrops blanks, comments,set_false_pathand[current_design]lines and rewrites PULLUP and braced-port lines;minimal_qmtech_xdccarries the minimal board file.Per the issue's rule ("Port the decision, not the plumbing"), all eight listed functions are ported under their names as tested pure functions over the answers (the string finding and splitting are the caller's plumbing, named in the header), with 10 tests (49 runtime asserts, 0 vacuous, 100% function coverage), against the original's own test expectations:
parse_pin_line— the entry verdict: pin AND port required (the original'sparse_clock_pintest: a barecreate_clockline → no entry); IOSTANDARD default; thecreate_clockmarker marks a parsed pin a clock;extract_value— the key-and-token gate with the brace/quote edge-trim set ({,},");extract_port— the[get_portsmarker gate;preprocess_for_nextpnr— the per-line keep/rewrite plan, with every rewrite token carried as its constant (PULLUP true,[get_ports {,}]and their replacements);minimal_qmtech_xdc— the minimal board file's facts: fourteen lines, twelve pins, the clock on E3, the reset on C18, eight leds;XdcConstraints_from_raw/XdcConstraints_port_count/XdcConstraints_clock_ports— the composition, tested end to end: the board file's facts → 12 ports, 0 clock entries; an empty source → 0.Verification (all run live from the worktree root, zig 0.16.0)
t27c parse: OK.t27c spec-status: IMPLEMENTED.t27c typecheck: 0 errors, 0 warnings.t27c coverage: 19/19 tested (100%) — no transports in this port.t27c test-report: 10 tests / 10 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.t27c gen | grep -c 'not yet implemented': 0;gen | wc -l: 207 (> 12).grep -cE '^\s*(pub )?fn (XdcConstraints_from_raw|XdcConstraints_port_count|XdcConstraints_clock_ports|parse_pin_line|extract_value|extract_port|preprocess_for_nextpnr|minimal_qmtech_xdc)\(': 8.grep -cE '^\s*test\s+(["|[A-Za-z_])': 10 (≥ 8).git status --short— exactly this one file. The repo's lefthook pre-commit passed.dupe_scanby name on a cleanorigin/masterworktree: 18 of the 19 names unique across 2040 specs.extract_valuealready exists inspecs/fpga/vcd_conformance_compare.t27:98— the name is mandated by this issue, and the two bodies are not byte-identical: the bare body scan adds no duplicate group (752 duplicate bodies in 221 groups on base, identical with this spec present, zero mention of this file).Dmitrii Fedorov (@dmitrii-f-t27)