题解 | #简易秒表#

简易秒表

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 <= 6'b0 ;
		end
		else if(second== 6'd60)begin
			second <= 6'b1 ;
		end
		else if(minute != 6'd60)begin
			second <= second + 6'b1 ;
		end
	end
	always @(posedge clk or negedge rst_n) begin
		if(!rst_n) begin
			minute <= 6'b0 ;
		end
		else if(second == 6'd60 && minute !=6'd60)begin
			minute <= minute + 6'b1 ;
		end
	end	
endmodule

全部评论

相关推荐

02-15 09:23
已编辑
深圳技术大学 Java
德勤 后端 OC 实习140/天,转正税前7k
恶龙战士:不如码农烧烤
点赞 评论 收藏
分享
01-14 19:01
吉首大学 Java
黑皮白袜臭脚体育生:加个项目吧,一般需要两个项目一业务一轮子呢,简历统一按使用了什么技术实现了什么功能解决了什么问题或提升了什么性能指标来写
点赞 评论 收藏
分享
2024-12-20 18:56
已编辑
武汉轻工大学 后端
牛牛大啊:er图都冒出来了😂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务