-
Notifications
You must be signed in to change notification settings - Fork 1
/
draw_shape.v
44 lines (38 loc) · 1.4 KB
/
draw_shape.v
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
// ===================================================================================
// Define Module, Inputs and Outputs
// * Draw paddles *
// ===================================================================================
module draw_shape #(parameter WIDTH = 16, // default width: 16 pixels
HEIGHT = 128)( // default height: 128 pixels
x,
hcount,
y,
vcount,
clk,
pixel
);
// ====================================================================================
// Port Declarations
// ====================================================================================
input [10:0] x;
input [10:0] hcount;
input [9:0] y;
input [9:0] vcount;
input clk;
output [7:0] pixel;
// ====================================================================================
// Parameters, Register, and Wires
// ====================================================================================
reg [7:0] COLOR = 8'hBB;
reg [7:0] pixel;
// ===================================================================================
// Implementation
// ===================================================================================
always @(posedge clk)
begin
if ((hcount >= x && hcount < (x+WIDTH)) && (vcount >= y && vcount < (y+HEIGHT)))
pixel <= COLOR;
else
pixel <= 8'b0;
end
endmodule