|
H_DISP(行显示有效像素):640
H_FPORCH:16时钟周期
H_SYNC:96时钟周期
H_BPROCH:48时钟周期
V_DISP(行显示有效像素):480
V_FPORCH:1时钟周期
V_SYNC:2时钟周期
V_BPROCH:33时钟周期
module Framebuffer_VGA(
input wire clk_50m,
input wire reset_n,
output wire vga_clk,
output wire vga_de,
output wire [7:0] vga_r,
output wire [7:0] vga_g,
output wire [7:0] vga_b,
output wire vga_hs,
output wire vga_vs,
output wire vga_bl,
output wire sdram_clk,
output wire [11:0] sdram_addr,
output wire [1:0] sdram_ba,
output wire sdram_cas_n,
output wire sdram_cke,
output wire sdram_cs_n,
inout wire [15:0] sdram_dq,
output wire [1:0] sdram_dqm,
output wire sdram_ras_n,
output wire sdram_we_n,
output wire epcs_dclk,
output wire epcs_sce,
output wire epcs_sdo,
input wire epcs_data0
);
assign vga_bl = 1;
wire vga_clk_r;
assign vga_clk = ~vga_clk_r; //对VGA时钟反相,以保证数据中心对齐
mysystem u0 (
.clk_50m_clk (clk_50m),
.reset_50m_reset_n (reset_n),
.vga_clk (vga_clk_r),
.vga_de (vga_de),
.vga_r (vga_r),
.vga_g (vga_g),
.vga_b (vga_b),
.vga_hs (vga_hs),
.vga_vs (vga_vs),
.altpll_0_phasedone_conduit_export (),
.altpll_0_locked_conduit_export (),
.altpll_0_areset_conduit_export (),
.epcs_dclk (epcs_dclk),
.epcs_sce (epcs_sce),
.epcs_sdo (epcs_sdo),
.epcs_data0 (epcs_data0),
.sdram_clk_clk (sdram_clk),
.sdram_addr (sdram_addr),
.sdram_ba (sdram_ba),
.sdram_cas_n (sdram_cas_n),
.sdram_cke (sdram_cke),
.sdram_cs_n (sdram_cs_n),
.sdram_dq (sdram_dq),
.sdram_dqm (sdram_dqm),
.sdram_ras_n (sdram_ras_n),
.sdram_we_n (sdram_we_n)
);
endmodule
#include "stdio.h"
#include "stdlib.h"
#include "io.h"
#include "sys/alt_alarm.h"
#include "altera_avalon_sgdma.h"
#include "altera_avalon_sgdma_descriptor.h"
#include "altera_avalon_sgdma_regs.h"
#include "alt_types.h"
#include "alt_video_display.h"
#include "unistd.h"
#include "pic1.h"
#include "pic2.h"
#include "system.h"
#define WIDTH 640
#define HEIGHT 480
#define NUM_FRAME 1
int main() {
unsigned int d = 0;
////Initial LCD Display
alt_video_display* display_global;
// printf("Initializing LCD display controller\n ");
display_global = alt_video_display_init(LCD_SGDMA_NAME, // Name of video controller
WIDTH, // Width of display
HEIGHT, // Height of display
16, // Color depth (32 or 16)
SDRAM_BASE + SDRAM_SPAN / 2, // Where we want our frame buffers
ONCHIP_MEMORY_BASE, // Where we want our descriptors
NUM_FRAME);
// if (display_global)
// printf(" - LCD Initialization OK\n");
// else
// printf(" - LCD FAILED\n");
alt_video_display_clear_screen(display_global, 0xff);
show_pic(display_global, pic1);
usleep(1000000);
while(1){
}
}