VGA показывает черный экран на мониторе с использованием Xilinx Spartan 6 Posedge One - PullRequest
0 голосов
/ 01 февраля 2019

Я использую Spartan 6 Posedge One Board с базовой тактовой частотой: 24 МГц для отображения простого изображения на мониторе с помощью VGA Verilog-модуля и VGA-кабеля на плате.Я сделал это до использования VGA 640x480p, но теперь, когда я изменил разрешение на 1024x768 с тактовой частотой 75 МГц, ничего не отображается.

Использовал мастер синхронизации v3.6 IP Core для генерации тактовой частоты 75 МГц с моментаБазовая тактовая частота составляет 24 МГц и названа CGM (модуль тактового генератора).и уже проверили время обоих hsync, vsync и т. д., но до сих пор не получили ничего на мониторе.поменял платы, VGA кабель но результатов пока нет.даже изменил полярность vsync и hsync, но все равно ничего (я получаю предупреждение: «компонент clk_wiz_v3_6 не имеет допустимого имени модели для синтеза verilog», но это, похоже, не влияет на мой проект. не пытался изменить имя"CGM" хотя ...)

`timescale 1ns / 1ps
module VGA(
input  wire i_clk,          // clock: 75MHz
input  wire i_rst,          // reset: restarts frame
output wire o_hs,           // horizontal sync
output wire o_vs,           // vertical sync
output wire o_blanking,     // high during blanking interval
output wire o_active,       // high during active pixel drawing
output wire o_screenend,    // high for one tick at the end of screen
output wire o_animate,      // high for one tick at end of active drawing
output wire [10:0] o_x,     // current pixel x position
output wire [9:0] o_y       // current pixel y position
);

localparam HS_STA = 24;              // horizontal sync start
localparam HS_END = 24 + 136;        // horizontal sync end
localparam HA_STA = 24 + 136 + 144;  // horizontal active pixel start
localparam VS_STA = 768 + 3;         // vertical sync start
localparam VS_END = 768 + 3 + 6;     // vertical sync end
localparam VA_END = 768;             // vertical active pixel end
localparam LINE   = 1328;            // complete line (pixels)
localparam SCREEN = 806;             // complete screen (lines)

reg [10:0] h_count; // line position
reg [9:0] v_count;  // screen position

// generate sync signals (active low)
assign o_hs = ~((h_count >= HS_STA) & (h_count < HS_END));
assign o_vs = ~((v_count >= VS_STA) & (v_count < VS_END));

// keep x and y bound within the active pixels
assign o_x = (h_count < HA_STA) ? 0 : (h_count - HA_STA);
assign o_y = (v_count >= VA_END) ? (VA_END - 1) : (v_count);

// blanking: high within the blanking period
assign o_blanking = ((h_count < HA_STA) | (v_count > VA_END - 1));

// active: high during active pixel drawing
assign o_active = ~((h_count < HA_STA) | (v_count > VA_END - 1)); 

// screenend: high for one tick at the end of the screen
assign o_screenend = ((v_count == SCREEN - 1) & (h_count == LINE));

// animate: high for one tick at the end of the final active pixel line
assign o_animate = ((v_count == VA_END - 1) & (h_count == LINE));

always @ (posedge i_clk)
begin
    if (i_rst)  // reset to start of frame
    begin
        h_count <= 0;
        v_count <= 0;
    end
    else
    begin
        if (h_count == LINE)  // end of line
        begin
            h_count <= 0;
            v_count <= v_count + 1;
        end
        else 
            h_count <= h_count + 1;

        if (v_count == SCREEN)  // end of screen
            v_count <= 0;
    end
end
endmodule

//Monitor

module MONITOR(
input  wire CLK,            // clock: 75 MHz
input  wire RST_BTN,        // reset button
output wire VGA_HS_O,       // horizontal sync output
output wire VGA_VS_O,       // vertical sync output
output wire [1:0] VGA_R,    // 2-bit VGA red output
output wire [1:0] VGA_G,    // 2-bit VGA green output
output wire [1:0] VGA_B     // 2-bit VGA blue output
);

wire rst = ~RST_BTN;    // reset is active low

wire [10:0] x;  // current pixel x position: 10-bit value: 0-1023
wire [9:0] y;   // current pixel y position:  9-bit value: 0-511

VGA Display (
    .i_clk(CLK),
    .i_rst(rst),
    .o_hs(VGA_HS_O), 
    .o_vs(VGA_VS_O), 
    .o_x(x), 
    .o_y(y)
);

// Four overlapping squares
wire [1:0] sq_a, sq_b, sq_c, sq_d;
assign sq_a = ((x > 310) & (y >  40) & (x < 470) & (y < 200)) ? 2'b11 : 2'b00; 
assign sq_b = ((x > 390) & (y > 120) & (x < 550) & (y < 280)) ? 2'b11 : 2'b00;
assign sq_c = ((x > 470) & (y > 200) & (x < 630) & (y < 360)) ? 2'b11 : 2'b00;
assign sq_d = ((x > 550) & (y > 280) & (x < 710) & (y < 440)) ? 2'b11 : 2'b00;

assign VGA_R = sq_b;         // square b is red
assign VGA_G = sq_a | sq_d;  // squares a and d are green
assign VGA_B = sq_c;         // square c is blue
endmodule


//TOP MODULE

module BOARD(
input clk,
input rst,
output wire VGA_HS_O,       // horizontal sync output
    output wire VGA_VS_O,       // vertical sync output
    output wire [1:0] VGA_R,    // 2-bit VGA red output
    output wire [1:0] VGA_G,    // 2-bit VGA green output
    output wire [1:0] VGA_B     // 2-bit VGA blue output
   );

CGM Clock(
     .CLK_IN1(clk),
     .CLK_OUT1(CLK_OUT1),     
     .RESET(rst)
     ); 

MONITOR Monitor (
     .CLK(CLK_OUT1), 
     .RST_BTN(rst), 
     .VGA_HS_O(VGA_HS_O), 
     .VGA_VS_O(VGA_VS_O), 
     .VGA_R(VGA_R), 
     .VGA_G(VGA_G), 
     .VGA_B(VGA_B)
     );
endmodule

Я ожидаю увидеть четыре перекрывающихся квадрата с разными цветами на экране.Я был бы очень благодарен, если бы кто-нибудь с платой fpga проверил мой код.Кстати, эти коды написаны в трех разных файлах .v и не находятся в одном и том же файле .v.я собрал все в одном, чтобы вы все могли их увидеть.

...