-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVGA_grid16.v
More file actions
57 lines (51 loc) · 1.03 KB
/
VGA_grid16.v
File metadata and controls
57 lines (51 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10/31/2022 05:29:00 PM
// Design Name:
// Module Name: VGA_grid16
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module vga_grid16(
input [9:0] x_pos,
input [9:0] y_pos,
output reg [1:0] grid_x,
output reg [1:0] grid_y
);
// Set x_grid positon
always @(x_pos)
begin
if (x_pos < 160)
grid_x <= 2'b00;
else if (x_pos < 320)
grid_x <= 2'b01;
else if (x_pos < 480)
grid_x <= 2'b10;
else //480-639
grid_x <= 2'b11;
end
// Set y_grid position
always @(y_pos)
begin
if (y_pos < 120)
grid_y <= 2'b00;
else if (y_pos < 240)
grid_y <= 2'b01;
else if (y_pos < 360)
grid_y <= 2'b10;
else //360-479
grid_y <= 2'b11;
end
endmodule