blob: 23ab9f2c5b72828c4031573fe232d79aa86deaba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module counter(count, dr, en, rst, clk);
parameter WIDTH = 8;
output [WIDTH-1: 0] count;
output dr;
input en, rst, clk;
reg [WIDTH-1: 0] count;
wire en, rst, clk;
reg dr;
always @(posedge clk or posedge rst)
begin
if (rst)
count <= 0;
else
dr <= en;
if (en)
count <= count + 1;
end
endmodule // counter
|