1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-28 23:49:20 +00:00
8bitworkshop/presets/verilog/test_hvsync.v

40 lines
1.1 KiB
Coq
Raw Normal View History

`include "hvsync_generator.v"
2018-10-01 16:30:47 +00:00
/*
A simple test pattern using the hvsync_generator module.
*/
2018-02-07 00:07:40 +00:00
module test_hvsync_top(clk, reset, hsync, vsync, rgb);
2020-05-13 17:50:16 +00:00
input clk, reset; // clock and reset signals (input)
output hsync, vsync; // H/V sync signals (output)
output [2:0] rgb; // RGB output (BGR order)
wire display_on; // display_on signal
wire [8:0] hpos; // 9-bit horizontal position
wire [8:0] vpos; // 9-bit vertical position
2020-05-13 17:50:16 +00:00
// Include the H-V Sync Generator module and
// wire it to inputs, outputs, and wires.
hvsync_generator hvsync_gen(
.clk(clk),
.reset(0),
.hsync(hsync),
.vsync(vsync),
.display_on(display_on),
.hpos(hpos),
.vpos(vpos)
);
2020-05-13 17:50:16 +00:00
// Assign each color bit to individual wires.
wire r = display_on && (((hpos&7)==0) || ((vpos&7)==0));
wire g = display_on && vpos[4];
wire b = display_on && hpos[4];
2020-05-13 17:50:16 +00:00
// Concatenation operator merges the red, green, and blue signals
// into a single 3-bit vector, which is assigned to the 'rgb'
// output. The IDE expects this value in BGR order.
assign rgb = {b,g,r};
endmodule