From 7b64e027e8952729a9aa15bfb41cbb2f3d709774 Mon Sep 17 00:00:00 2001 From: Jens True Date: Sat, 24 Nov 2018 20:42:48 +0100 Subject: [PATCH] Cleanup of Verilog code --- Makefile | 4 ++-- vga640x480.v | 4 ++-- vgasquare.v | 2 +- vgasquare_tb.v | 13 ++++++++----- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index fd71f90..f0cd8a5 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ TBOUTPUT = vgasquare_tb.vcd #THIS NEEDS TO MATCH THE OUTPUT FILE # BE CAREFUL WHEN CHANGING ITEMS BELOW THIS LINE ############################################################################### #TOOL OPTIONS -COFLAGS = -o +COFLAGS = -o SFLAGS = SOUTPUT = -lxt #SIMULATOR OUTPUT TYPE #TOOL OUTPUT @@ -20,7 +20,7 @@ COUTPUT = vgasquare_tb.vpp #COMPILER OUTPUT ############################################################################### #MAKE DIRECTIVES check : $(TESTBENCH) $(SRC) - $(COMPILER) -v $(SRC) + $(COMPILER) $(SRC) simulate: $(COUTPUT) $(SIMULATOR) $(SFLAGS) $(COUTPUT) $(SOUTPUT) diff --git a/vga640x480.v b/vga640x480.v index 64456dd..4da2f8e 100644 --- a/vga640x480.v +++ b/vga640x480.v @@ -30,8 +30,8 @@ module vga640x480( localparam LINE = 800; // complete line (pixels) localparam SCREEN = 524; // complete screen (lines) - reg [9:0] h_count; // line position - reg [9:0] v_count; // screen position + reg [9:0] h_count = 0; // line position + reg [9:0] v_count = 0; // screen position // generate sync signals (active low for 640x480) assign o_hs = ~((h_count >= HS_STA) & (h_count < HS_END)); diff --git a/vgasquare.v b/vgasquare.v index 8bac5fc..5cec312 100644 --- a/vgasquare.v +++ b/vgasquare.v @@ -29,9 +29,9 @@ module vgasquare( vga640x480 display ( .i_pix_stb(PIXEL_CLK), .i_rst(rst), - .o_active(VGA_ACTIVE), .o_hs(VGA_HS), .o_vs(VGA_VS), + .o_active(VGA_ACTIVE), .o_x(x), .o_y(y) ); diff --git a/vgasquare_tb.v b/vgasquare_tb.v index e5605b7..d3335c3 100644 --- a/vgasquare_tb.v +++ b/vgasquare_tb.v @@ -18,16 +18,19 @@ module vgasquare_tb; wire O_VGA_HS; wire O_VGA_VS; - vgasquare display ( + vgasquare DUT ( .PIXEL_CLK(pixel_clk), // Pixel clock: 25Mhz (or 25.125MHz) for VGA .RST_BTN(reset), // reset button .box_x1(10'd120), .box_x2(10'd520), - .box_y1(9'd120), - .box_y2(9'd360), - .box_color(6'b111000), //1 bit for each color Foreground and background + .box_y1(9'd440), + .box_y2(9'd480), + .box_color(6'b100001), //1 bit for each color Foreground and background .VGA_ACTIVE(O_VGA_ACTIVE), .VGA_HS(O_VGA_HS), // horizontal sync output - .VGA_VS(O_VGA_VS) // vertical sync output + .VGA_VS(O_VGA_VS), // vertical sync output + .VGA_R(O_VGA_R), // 1-bit VGA red output + .VGA_G(O_VGA_G), // 1-bit VGA green output + .VGA_B(O_VGA_B) // 1-bit VGA blue output ); endmodule // test \ No newline at end of file