完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
module counter60(qout,cout,data,load,reset,clk);
input load,clk,reset; input[7:0] data; output reg[7:0] qout;output cout; always @(posedge clk) begin if(reset) qout<=0; else if(load) qout<=data; else begin if(qout[3:0]==9) begin qout[3:0]<=0; if(qout[7:4]==5) qout[7:4]<=0; else qout[7:4]<=qout[7:4]+1; end else qout[3:0]<=qout[3:0]+1; end end assign cout=(qout==8'd59)?1:0; endmodule
|
|
相关推荐
4 个讨论
|
|
少了一个进位信号cin,正确的程序应该是:
module count60BCD(cin,reset,load,data,qout,cout); input cin,reset,load; input [7:0] data; output [7:0] qout; output [7:0] cout; reg [7:0] qout; wire [7:0] cout; always @ (posedge clk) begin if(!reset) qout<=0; else if (load) qout<=data; else if (cin) begin if(qout[3:0]==9) qout[3:0]<=0; if(qout[7:4]==5) qout[7:4]<=0; else qout[7:4]<=qout[7:4]+1; end else qout[3:0]<=qout[3:0]+1; end end assign cout=((qout==8'h59)&cin)?1:0; endmodule |
|
|
|
|
|
只有小组成员才能发言,加入小组>>
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 19:56 , Processed in 0.656178 second(s), Total 60, Slave 46 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号