Repository navigation
spec(course): the FPGA course lesson specs compile, pass and assert at run time (Closes #10013) - #10014
Merged
Conversation
…t run time (Closes #10013) Measured on the Railway lab at trinity ee5123592, 11 of the 27 lesson specs the t27.ai FPGA course links did not hold: lesson 5 failed, lessons 10, 11, 12, 14 and 19 did not compile, lesson 4 had no tests, and lessons 1, 3 and 6 carried 9 vacuous tests that compared a constant with its own literal. - specs/tutorial/01..08: the eight lessons land here from trinity (they were never merged in t27). 01 gains 4 tests; 04 casts the usize loop capture; 05 narrows with `as` (truncating) and keeps @intcast for a value that fits; 06 types the switch-bound local; 08 writes typed arrays, since `[_]T{}` lowers to a tuple that cannot be indexed at run time. Non-ASCII dashes in comments become ASCII (L3). - specs/demos/hello_world.t27: `cast(...)` was undeclared; use `as u16`. - specs/fpga/placement.t27: floorplan() sets the `_dummy` field. - specs/boards/wukong_v1.t27: the IDCODE, JEDEC id, flash size and DRAM tests decode the identifiers at run time instead of re-reading literals. - specs/boards/xc7a100t_minimal.t27: the clock, LED and MAC-debug tests go through period_ns_from_hz, cycles_per_ms, count_leds and has_mac_debug. - specs/fpga/stdlib.t27: ip_kind_values reads the enum through kind_code() instead of asserting `0 == 0 and 1 == 1`. After, on the lab: 23 of 23 lesson specs held in t27 report N/N tests passing with 0 vacuous under t27c and the same PASS counts under t27b. 14 of 14 planted wrong values fail exactly their target test under both. iverilog errors unchanged: placement 6, stdlib 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
gHashTag
enabled auto-merge (squash)
October 17, 2026 16:20
This was referenced Oct 17, 2026
gHashTag
added a commit
that referenced
this pull request
Oct 17, 2026
…#10053) #10014 changed specs/boards/xc7a100t_minimal.t27, specs/boards/wukong_v1.t27, specs/fpga/placement.t27 and specs/fpga/stdlib.t27 without resealing, so check_seal_currency reported 8 STALE seals and Spec Guards and Seal Coverage went red for every PR. Written by `t27c seal <spec> --save && tri seals sync-twins` on the Railway lab at d03afb0. No --update-baseline. Lab: STALE generated-code hash 0, check_seal_coverage OK. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10013
The t27.ai FPGA hardware course links one spec per lesson (trinity
apps/website/specs/course/course.t27,LESSON_SPECS), and trinity vendors those specs from this repo. On the Railway lab, 11 of the 27 lesson specs did not hold. This PR fixes them in.t27only. The eightspecs/tutorial/lessons land here for the first time: they lived only in trinity, written on the unmerged t27 commit 1cd2877.Before and after
All counts are from the Railway lab:
t27c test-report(with zig 0.16.0) andt27b test --check(aarch64, under qemu). Before is trinityee512359254bcd7438bb6a79c8a4a7f8b554b620, vendored copies. After is this branch on t27de2cff882.Result: all 23 lesson specs held in t27 pass every test (201 tests in total) with 0 vacuous under t27c, and t27b reports the same PASS counts with 0 FAIL.
What each fix was
narrow(0x1234)used@intCast, which fails at run time when the value does not fit. It now useswide as u8, which truncates.narrow_checkedkeeps@intCastand has its own test with a value that fits. The lesson comment now explains the difference.for (0..n) |i|capture isusize, so the u8 sum now casts it.constbound to aswitchwith bare literal arms needs a type (: u8); without one, the comptime_int depends on runtime control flow.[_]T{...}lowers to an untyped tuple, which cannot be indexed with a runtime value. The arrays are now[N]T = [...], and the lesson says why.varfirst, because asserting on a constant folds at compile time and counts as vacuous.cast(...)is not declared; it now usesas u16.floorplan()did not set the struct's_dummyfield.mbit_to_bytes(128) == FLASH_BYTES;dram_capacity_known().count_leds() == NUM_LEDS, andhas_mac_debug().ip_kind_valueswas0 == 0 and 1 == 1. It now readsIpKind.uart_tx,.gpioand.ternary_aluthroughkind_code().Checks
gen-verilogfor master and for this branch and raniverilog -g2012on both. The counts are unchanged: placement 6, stdlib 2 (matchingtools/elab_baseline.txt), wukong_v1 0, xc7a100t_minimal 4.Out of scope: lessons 22, 24, 25 and 26
These are trios tool cards, and they are not in this repo. Trinity generates them from trios with
apps/website/scripts/tools-from-trios-tri.mjs, whose output is "data and carries no test block". Giving them tests means changing that.mjsgenerator, which the only-t27 rule does not allow (the alternative is porting the generator to t27). That is left as a follow-up. Until then, those four lessons still show 0 tests.🤖 Generated with Claude Code