diff --git a/tridoracpu/tridoracpu.srcs/vgafb.v b/tridoracpu/tridoracpu.srcs/vgafb.v index 37c1376..f87e514 100644 --- a/tridoracpu/tridoracpu.srcs/vgafb.v +++ b/tridoracpu/tridoracpu.srcs/vgafb.v @@ -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 diff --git a/tridoracpu/tridoracpu.xpr b/tridoracpu/tridoracpu.xpr index 24f05b5..b0ba2bb 100644 --- a/tridoracpu/tridoracpu.xpr +++ b/tridoracpu/tridoracpu.xpr @@ -351,7 +351,9 @@ - + + Vivado Synthesis Defaults + @@ -361,9 +363,7 @@ - - Vivado Synthesis Defaults - + @@ -371,21 +371,25 @@ - + - + + Best predicted directive for place_design. + - + + + - + - + - + @@ -393,15 +397,13 @@ - + - - Default settings for Implementation. - +