// retroDE_ps2 — tb_top_psmct32_texalpha_demo (Ch344) // // TOP-LEVEL TEXTURED + source-over ALPHA SPRITE demo, end-to-end through the BRAM BOARD VARIANT // (top_psmct32_raster_demo_bram) with SPRITE_TEX_ALPHA=1 — the integration the de25 board top fits, // driving gs_stub through the REGISTERED read2 wrapper (the model the unit TB now matches). // // EE bootlet (bios_texalpha.mem) + GIF payload (payload_texalpha.mem): // U1 -> upload an 8x8 checkerboard-ALPHA texture (opaque-white / fully-transparent). // U2 -> opaque BG SPRITE (ABE=0), solid blue, full 64x64. // U3 -> textured-alpha SPRITE (PRIM SPRITE+TME+ABE, source-over) over screen (16,16)-(48,48). // // Per pixel of the overlay: As = TEXEL alpha. Opaque texel (A=0x80) -> Cv = Cs (the gray texel, // identity MODULATE by a white tint); transparent texel (A=0) -> Cv = Cd (the blue BG shows through). // // Verification (PCRTC scanout RGB — what a board wires to the video PHY): // - the BORDER (outside the overlay rect) is the pure blue BG. // - EVERY overlay pixel is EITHER gray (0xC0,0xC0,0xC0) OR blue BG — nothing else (binary alpha, // no garbage), and BOTH appear in quantity (the checkerboard + per-texel alpha both rendered). `timescale 1ns/1ps module tb_top_psmct32_texalpha_demo; localparam int H_ACTIVE = 64, V_ACTIVE = 64; localparam int SX0 = 16, SY0 = 16, SX1 = 48, SY1 = 48; // overlay sprite rect logic clk, rst_n; initial clk = 1'b0; always #5 clk = ~clk; logic core_go; logic [7:0] r, g, b; logic hsync, vsync, de; logic core_halt, dma_done_seen, frame_seen, raster_overflow; logic frame_toggle, dma_done_toggle; top_psmct32_raster_demo_bram #( .H_ACTIVE(H_ACTIVE), .V_ACTIVE(V_ACTIVE), .VRAM_BYTES(32*1024), .PSMCT32_SWIZZLE(1'b0), .SPRITE_TEX_ALPHA(1'b1) ) dut ( .clk(clk), .rst_n(rst_n), .core_go(core_go), .r(r), .g(g), .b(b), .hsync(hsync), .vsync(vsync), .de(de), .core_halt(core_halt), .dma_done_seen(dma_done_seen), .frame_seen(frame_seen), .raster_overflow(raster_overflow), .frame_toggle(frame_toggle), .dma_done_toggle(dma_done_toggle), .joy_a_pressed_i(1'b0), .joy_b_pressed_i(1'b0) ); // expected colors localparam logic [7:0] BG_R=8'h00, BG_G=8'h00, BG_B=8'hC0; // blue BG localparam logic [7:0] GR_R=8'hC0, GR_G=8'hC0, GR_B=8'hC0; // opaque-texel gray logic [7:0] cap_r[0:V_ACTIVE-1][0:H_ACTIVE-1], cap_g[0:V_ACTIVE-1][0:H_ACTIVE-1], cap_b[0:V_ACTIVE-1][0:H_ACTIVE-1]; logic cap_de[0:V_ACTIVE-1][0:H_ACTIVE-1]; bit capture_armed; initial begin for (int y=0;y=SX0) && (x=SY0) && (y