21 lines
No EOL
220 B
Verilog
21 lines
No EOL
220 B
Verilog
//计数器模块
|
|
module jyh_4490_2_1(clk,en,Q);
|
|
input clk,en;
|
|
output reg[2:0] Q;
|
|
|
|
always@(posedge clk)
|
|
begin
|
|
if(en == 1'b1)
|
|
begin
|
|
if(Q<3'd6)
|
|
Q <= Q + 3'b1;
|
|
else
|
|
Q <= 0;
|
|
end
|
|
else
|
|
Q<=0;
|
|
end
|
|
endmodule
|
|
|
|
|
|
|