// Test-pattern source for a parallel-RGB DVI transmitter such as the TI TFP410 // in 24-bit single-edge mode: DATA[23:16] red, DATA[15:8] green, DATA[7:0] blue, // plus DE, HSYNC and VSYNC, all latched on one edge of the pixel clock IDCK. // clk_pix comes from a PLL. Forward it to IDCK with the device's DDR output // register in the board wrapper, not from this module. `timescale 1ns / 1ps module video_top_tfp410 #( parameter int H_ACTIVE = 640, parameter int H_FP = 16, parameter int H_SYNC = 96, parameter int H_BP = 48, parameter int V_ACTIVE = 480, parameter int V_FP = 10, parameter int V_SYNC = 2, parameter int V_BP = 33, parameter logic H_POL = 1'b0, parameter logic V_POL = 1'b0, parameter int GRID = 32 ) ( input logic clk_pix, input logic rst, input logic [1:0] mode, output logic [23:0] tfp_data, output logic tfp_de, output logic tfp_hsync, output logic tfp_vsync ); localparam int XW = $clog2(H_ACTIVE + H_FP + H_SYNC + H_BP); localparam int YW = $clog2(V_ACTIVE + V_FP + V_SYNC + V_BP); logic hsync, vsync, de, frame_start; logic [XW-1:0] x; logic [YW-1:0] y; logic [7:0] r, g, b; logic hsync_d, vsync_d, de_d; video_timing #( .H_ACTIVE(H_ACTIVE), .H_FP(H_FP), .H_SYNC(H_SYNC), .H_BP(H_BP), .V_ACTIVE(V_ACTIVE), .V_FP(V_FP), .V_SYNC(V_SYNC), .V_BP(V_BP), .H_POL(H_POL), .V_POL(V_POL) ) u_timing ( .clk(clk_pix), .rst(rst), .hsync(hsync), .vsync(vsync), .de(de), .frame_start(frame_start), .x(x), .y(y)); test_pattern #( .H_ACTIVE(H_ACTIVE), .V_ACTIVE(V_ACTIVE), .XW(XW), .YW(YW), .GRID(GRID) ) u_pattern ( .clk(clk_pix), .mode(mode), .de(de), .x(x), .y(y), .r(r), .g(g), .b(b)); // The pattern adds one clock, so delay the syncs and DE by one clock too. // Then register every output, so that all pins change together. always_ff @(posedge clk_pix) begin hsync_d <= hsync; vsync_d <= vsync; de_d <= de; tfp_data <= {r, g, b}; tfp_de <= de_d; tfp_hsync <= hsync_d; tfp_vsync <= vsync_d; end logic unused; assign unused = frame_start; endmodule