2018-08-13 22:17:36 +00:00
|
|
|
|
2017-11-15 00:12:52 +00:00
|
|
|
`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
|
2017-11-15 00:12:52 +00:00
|
|
|
|
2020-05-13 17:50:16 +00:00
|
|
|
// Include the H-V Sync Generator module and
|
|
|
|
// wire it to inputs, outputs, and wires.
|
2017-11-15 00:12:52 +00:00
|
|
|
hvsync_generator hvsync_gen(
|
|
|
|
.clk(clk),
|
2017-11-29 01:48:27 +00:00
|
|
|
.reset(0),
|
2017-11-15 00:12:52 +00:00
|
|
|
.hsync(hsync),
|
|
|
|
.vsync(vsync),
|
2017-11-17 21:01:07 +00:00
|
|
|
.display_on(display_on),
|
|
|
|
.hpos(hpos),
|
|
|
|
.vpos(vpos)
|
2017-11-15 00:12:52 +00:00
|
|
|
);
|
|
|
|
|
2020-05-13 17:50:16 +00:00
|
|
|
// Assign each color bit to individual wires.
|
2017-11-17 21:01:07 +00:00
|
|
|
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.
|
2017-11-15 00:12:52 +00:00
|
|
|
assign rgb = {b,g,r};
|
|
|
|
|
|
|
|
endmodule
|