题解 | #简易秒表#

简易秒表

https://www.nowcoder.com/practice/6493ca8c7b67499f918e1fa33b4cdeda

`timescale 1ns/1ns

module count_module(
	input clk,
	input rst_n,

    output reg [5:0]second,
    output reg [5:0]minute
	);
	
always@(posedge clk or negedge rst_n) begin
	if(!rst_n) begin
		second <= 'd0;
		minute <= 'd0 ;
	end
	else if (second == 'd60) begin
		second <= 'd1 ;
		minute <= minute + 1 ;
	end
	else if(minute == 'd60)
		second <= 0 ;
	else 
		second <= second + 'd1 ;
end
	
endmodule

全部评论

相关推荐

咩咩子_:项目和图形引擎岗没啥关系,最好还是项目和岗位有相关度好点,不然真有面也不一定会问很多
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务