博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【Verilog_1】: 设计 4 位 BCD 十进制计数器
阅读量:3941 次
发布时间:2019-05-24

本文共 607 字,大约阅读时间需要 2 分钟。

设计 4 位 BCD 十进制计数器

Design a 4-digit BCD decimal counter

module bcd_4d_cnt(		//4位十进制计数器	input clk,	input reset_n,	input en,  //同步使能	input load,     //同步装载	input [15:0] d,	output reg [15:0] bcd);		always @ (posedge clk or negedge reset_n)		if(!reset_n)			bcd <= 0;		else if(load)			bcd <= d;		else if(en)			if(bcd[3:0] < 9) bcd[3:0] <= bcd[3:0] + 1'b1;			else if(bcd[7:4] < 9) begin bcd[7:4]<=bcd[7:4] + 1'b1;bcd[3:0]<=0; end			else if(bcd[11:8] < 9) begin bcd[11:8]<=bcd[11:8] + 1'b1;bcd[7:0]<=0; end			else if(bcd[15:12] < 9) begin bcd[15:12]<=bcd[15:12] + 1'b1;bcd[11:0]<=0; end			else bcd <= 0;			endmodule

转载地址:http://kyiwi.baihongyu.com/

你可能感兴趣的文章
J2ME贪吃蛇源代码——200行左右,包含详细注释
查看>>
J2ME游戏源代码免费下载——国外Digiment公司商业化代码
查看>>
手机银行技术应用探讨
查看>>
角色扮演游戏引擎的设计原理
查看>>
j2me开发FAQ整理
查看>>
J2ME程序开发新手入门九大要点
查看>>
双向搜索算法
查看>>
日本GAME製作方式
查看>>
移动行业术语资料
查看>>
3G到来将全面颠覆SP、CP游戏规则
查看>>
射击游戏中跟踪弹及小角度移动的开发
查看>>
完美的软件项目开发团队结构
查看>>
数学的重要性
查看>>
how Google routed around Sun’s IP-based licensing restrictions on Java ME
查看>>
JAVA面试题最全集
查看>>
JAVA面试题集
查看>>
Embedded System Interview Questions:
查看>>
The Standalone Programmer:Tips from the trenches
查看>>
优化C代码常用的几招
查看>>
Embedded firmware interview questions
查看>>