728x90

 0. [verilog] - Counter



 1. 풀이

clk신호와 reset 신호를 input으로 받는 counter를 설계하였다.


단순하게 clk신호마다 cnt를 1 증가시켜주는 방식으로 설계되었다.


 2. 소스코드


1
2
3
4
5
6
7
8
9
10
11
module up_counter(clk,reset,cnt);
input clk, reset;
output reg [7:0] cnt;
 
always @ (posedge clk or negedge reset) begin
    if(!reset) cnt <= 0;
    else cnt <= cnt + 1;
end
 
 
endmodule
cs


 3. 참고




질문이나 지적 있으시면 댓글로 남겨주세요~

도움 되셨으면 하트 꾹!


+ Recent posts