diff --git a/tests/opt/opt_first_fit_alloc.ys b/tests/opt/opt_first_fit_alloc.ys index a4bec64b0..4ffe36684 100644 --- a/tests/opt/opt_first_fit_alloc.ys +++ b/tests/opt/opt_first_fit_alloc.ys @@ -757,3 +757,103 @@ opt_first_fit_alloc select -assert-count 0 w:*ffa_* design -reset log -pop + +# ============================================================================ +# Group H: coalesce generalization (spelling + shape variants) +# ============================================================================ +# +# The coalesce variant is detected by functional fingerprinting of the dsel +# cone, so it should not depend on the exact way the same-category forwarding +# is written or on the specific N/NB/C shape. These cases vary both. + +# H1: coalesce with the same-category forwarding written INLINE (no precomputed +# same_cat[i][k] matrix) -- the leader compares categories directly in its +# forward loop. Functionally identical to G1's matrix form; must still detect +# the enable-independent coalescing variant and prove equivalent. +log -header "H1: coalesce inline-compare spelling, N=8 (equiv + fires)" +log -push +design -reset +read_verilog -sv <= N) ? (si - N) : si; + rr_dut #(N,W) u1(.req(req),.s(s),.grant(g1),.idx_next(n1)); + rr_ref #(N,W) u2(.req(req),.s(s),.grant(g2),.idx_next(n2)); + always_comb begin + assert (g1 == g2); + assert (n1 == n2); + end +endmodule +EOF +hierarchy -top tb +flatten +chformal -lower +opt -full +sat -verify -prove-asserts -show-ports tb +design -reset +log -pop + +# RR7: DIFFERENT RTL SPELLING of the same rotated-priority function. Instead of +# the customer's downward idx-- last-write-wins loop, scan UPWARD from s+1 with +# wraparound and keep the FIRST hit. This is a functionally identical arbiter +# written in an unrelated style; detection is functional so it must still fire +# and prove equivalent. (Combinational, pointer `s` an input -> full equiv at +# power-of-2 N over all pointer values.) +log -header "RR7: upward-scan spelling variant, N=16 (equiv + fires)" +log -push +design -reset +read_verilog -sv < no round-robin rewrite" +log -push +design -reset +read_verilog -sv <= SW'(S)) ? (k - SW'(S)) : k; // into [0,S) + end + logic [P-1:0] w1, w2; + pk_dut #(P,S,SW) u1(.act(act), .sel_flat(sel_c), .win(w1)); + pk_ref #(P,S,SW) u2(.act(act), .sel_flat(sel_c), .win(w2)); + always_comb assert (w1 == w2); +endmodule +EOF +hierarchy -top tb +flatten +chformal -lower +opt -full +sat -verify -prove-asserts -show-ports tb +design -reset +log -pop + +# E4: SAME non-pow2 S=12 under -strict. Strict validation sweeps the FULL key +# range and rejects rewrites that only hold via out-of-range don't-cares, so +# the pass must decline to rewrite. This is the safety mode used by formal +# synthesis flows: no reliance on out-of-range freedom. +log -header "E4: non-pow2 S=12 -strict -> no rewrite (safety)" +log -push +design -reset +read_verilog -sv < no rewrite" +log -push +design -reset +read_verilog -sv < no rewrite" +log -push +design -reset +read_verilog -sv <