// retroDE_ps2 — tb_gs_persp_uv (Ch301) // // Focused TB for gs_persp_uv — the per-pixel perspective-correct divide // (recip + multiply + clamp) that recovers integer texel (u,v) from the // interpolated perspective attributes (u/w, v/w, 1/w). Proves: // // PROOF 1 — ROUND-TRIP: for known (u,v,w), feeding uq=(u<63) tu[n]=100; tv[n]=0; tw[n]=1; vuq[n]=ATTR_W'((100*(1< 1) begin $error("[persp_uv] i=%0d (u=%0d,w=%0d) got_u=%0d exp=%0d", i, tu[i], tw[i], ou[i], eu); errors++; end if (iabs(int'(ov[i]) - ev) > 1) begin $error("[persp_uv] i=%0d (v=%0d,w=%0d) got_v=%0d exp=%0d", i, tv[i], tw[i], ov[i], ev); errors++; end end $display("[tb_gs_persp_uv] checked %0d, errors=%0d", oc, errors); if (errors == 0) $display("[tb_gs_persp_uv] PASS"); else $display("[tb_gs_persp_uv] FAIL"); $finish; end initial begin #2000000; $error("[tb_gs_persp_uv] TIMEOUT"); $finish; end endmodule : tb_gs_persp_uv