Repository navigation
t27c: accept uN casts, 1 <= N <= 64, decided in int_type_names.t27 (Closes #10072) - #10084
Merged
Merged
Conversation
…loses #10072) `x as u3` and `x as u12` were refused at parse time by a hand-written whitelist in compiler.rs. The decision now lives in specs/compiler/int_type_names.t27 (`uint_bits`, with tests and negative controls: u0, u65, u012, u3x, banana stay refused). The parser consults the generated copy; zig_uint_bits defers to it past usize, so the reference truncates a narrowing cast exactly as t27b verilog's t27_uN does. Hand-written Rust: 3 lines added, 3 removed, in compiler.rs (the call site, the doc line, the error text). FROZEN_HASH resealed. New conformance spec verilog_odd_cast.t27 carries the Build-A-Chip-Bench moving average (u12 samples, `as u12`), narrowing and widening casts, and a module-level narrowing in on_clock. Refs #10066. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 12 tasks
This was referenced Oct 17, 2026
Contributor
This was referenced Oct 17, 2026
spec(policy): l2_generation -- gen/json/ is t27c gen-json's backend directory (Closes #10079)
#10082
Merged
This was referenced Oct 17, 2026
Merged
Merged
Merged
gHashTag
enabled auto-merge (squash)
October 17, 2026 19:18
Contributor
PR DashboardGenerated at: 2026-10-17 19:24:23 UTC
Summary
Seal Status
|
This was referenced Oct 18, 2026
Closed
gHashTag
added a commit
that referenced
this pull request
Oct 18, 2026
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 #10072. Part of epic #10066 (Build-A-Chip-Bench proxy run).
What changes
t27buses t27c's parser unchanged, and that parser refused a cast into an odd unsigned width:x as u3andx as u12failed with "unknown cast target type". Odd widths already worked in params and returns (fn f(x: u12) -> u12, #5904). Only the cast was missing.specs/compiler/int_type_names.t27gainsuint_bits(ty) -> ?u32. It returns N foruNwith 1 <= N <= 64 and no leading zero, and null for everything else.zig_uint_bitsnow defers to it pastusize, so the Zig reference narrows with@truncate, ast27b verilog'st27_uNdoes. (@intCastwould panic on13 as u3.)bootstrap/gen/rust/compiler/int_type_names.rsist27c gen-rustoutput, regenerated on the lab. A second gen-rust with the patched binary produced the same bytes (fixed point).bootstrap/src/compiler.rs.VALID_CAST_TYPEScheck also acceptsint_type_names::uint_bits(..).is_some().x as u0as the refused example and points at the spec.bootstrap/stage0/FROZEN_HASHis resealed.foreign-budgetandown-languagepass, with no--no-verify.specs/tri/t27b/conformance/verilog_odd_cast.t27, 4 tests:as u12;as u3andas u1keep the low bits;on_clock.odd_width_int.t27header points at the new spec. There are 3 seals, and one ledger row indocs/reports/t27b_expectations.json.Evidence (Railway lab, never the Mac)
t27c test-report, 0 vacuous passes in each:int_type_names: 6/6;verilog_odd_cast: 4/4;odd_width_int: 9/9.as u1,as u3,as u12andas u64exit 0;as u0,as u65,as u3x,as u012andas bananaexit 1 with "unknown cast target type";u99,u128,u00,u,U3,i3,x3,u 3,u-3,usizeandbool.uint_bitsfails at least one test:uprefix check broken;t27b verilogon the new spec emits:function [11:0] avg8withinput [11:0]for each of its 8 args;t27_u12(...),t27_u3(x)andt27_u1(x).-DT27B_TESTBENCH) reports "4 passed, 0 failed, 4 tests, 15 runtime asserts".-> u16on a u12 average) it is still refused with a type mismatch, which is correct.-> u12andas u12it gives exit 0 andoutput reg [11:0] data_out; Icarus reports "2 passed, 0 failed".gen,gen-verilog,gen-rustandgen-c, pristine master ee3da59 against this branch. Result: 0 outputs differ. No existing spec casts from an odd width, so the@intCastto@truncatechange touches only new code.u3through as a type name. A host compiler refuses it loudly; nothing is silently miscompiled. Lowering those is out of scope.Not verified here
pass. That is a prediction from the passingt27b verilogbench and the nativeodd_width_introw.t27b-native-ratchet(not required, Q16) is the check. If it reports an UNEXPECTED FAILURE, the row or t27b's JIT cast lowering needs a follow-up.🤖 Generated with Claude Code