vga framebuffer: use 640x480@60Hz video timings
- we still can only display 400 lines, so 80 blank lines are added at the bottom - we get square pixels this way and are hopefully more compatible with monitors and other devices like scan converters and capture cards
This commit is contained in:
parent
e08d610aef
commit
ecff04a7a0
2 changed files with 39 additions and 18 deletions
|
|
@ -6,8 +6,11 @@
|
|||
// Learn more at https://projectf.io
|
||||
|
||||
//128K video memory is not enough for 640x480x4
|
||||
`define RES_640_400
|
||||
//`define RES_640_400
|
||||
//`define RES_1024_768
|
||||
// RES_640_480 mode displays 400 lines with 640x480/60 video timings,
|
||||
// adding blank lines at the bottom
|
||||
`define RES_640_480
|
||||
|
||||
module display_timings #(
|
||||
H_RES=640, // horizontal resolution (pixels)
|
||||
|
|
@ -126,6 +129,8 @@ module vgafb #(VMEM_ADDR_WIDTH = 15, VMEM_DATA_WIDTH = 32) (
|
|||
localparam COLOR_WIDTH = 12;
|
||||
localparam PALETTE_WIDTH = 4;
|
||||
|
||||
localparam signed PIC_LINES = 400; // visible picture lines
|
||||
|
||||
// Display Clocks
|
||||
wire pix_clk = CLK; // pixel clock
|
||||
wire clk_lock = 1; // clock locked?
|
||||
|
|
@ -202,6 +207,18 @@ module vgafb #(VMEM_ADDR_WIDTH = 15, VMEM_DATA_WIDTH = 32) (
|
|||
.V_BP(35),
|
||||
.H_POL(0),
|
||||
.V_POL(1)
|
||||
`endif
|
||||
`ifdef RES_640_480
|
||||
.H_RES(640), // 640 800 1280 1920
|
||||
.V_RES(480), // 480 600 720 1080
|
||||
.H_FP(16), // 16 40 110 88
|
||||
.H_SYNC(96), // 96 128 40 44
|
||||
.H_BP(48), // 48 88 220 148
|
||||
.V_FP(10), // 10 1 5 4
|
||||
.V_SYNC(2), // 2 4 5 5
|
||||
.V_BP(33), // 33 23 20 36
|
||||
.H_POL(0), // 0 1 1 1
|
||||
.V_POL(0) // 0 1 1 1
|
||||
`endif
|
||||
)
|
||||
display_timings_inst (
|
||||
|
|
@ -217,6 +234,8 @@ module vgafb #(VMEM_ADDR_WIDTH = 15, VMEM_DATA_WIDTH = 32) (
|
|||
.o_sy(sy)
|
||||
);
|
||||
|
||||
wire pic_enable = (sy >= 0) && (sy < PIC_LINES); // when to display pixels from VRAM
|
||||
|
||||
wire [7:0] red;
|
||||
wire [7:0] green;
|
||||
wire [7:0] blue;
|
||||
|
|
@ -288,7 +307,7 @@ module vgafb #(VMEM_ADDR_WIDTH = 15, VMEM_DATA_WIDTH = 32) (
|
|||
// 12 bit RGB palette
|
||||
assign VGA_HS = h_sync;
|
||||
assign VGA_VS = v_sync;
|
||||
assign VGA_R = de ? color_data[11:8] : 4'b0;
|
||||
assign VGA_G = de ? color_data[7:4] : 4'b0;
|
||||
assign VGA_B = de ? color_data[3:0] : 4'b0;
|
||||
assign VGA_R = (pic_enable && de) ? color_data[11:8] : 4'b0;
|
||||
assign VGA_G = (pic_enable && de) ? color_data[7:4] : 4'b0;
|
||||
assign VGA_B = (pic_enable && de) ? color_data[3:0] : 4'b0;
|
||||
endmodule
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue