云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > Verilog HDL语言 四位数字频率计 课程设计

Verilog HDL语言 四位数字频率计 课程设计

  • 62 次阅读
  • 3 次下载
  • 2025/12/9 16:17:14

课程设计说明书

其中分别对应着十进制的0—9这是个数字。

6、编译仿真

最后的程序的编译仿真结果如图1-5。

图1-5

附录1:

module cymometer(seg7,scan,sysclk,clkin); output[6:0]seg7; output[7:0]scan; output led; reg led;

input sysclk; //20MHz时钟信号 input clkin; reg[6:0]seg7; reg[7:0]scan; reg[25:0]cnt; reg clk_cnt;

reg[2:0]cntp1,cntp2,cntp3,cntp4; reg[2:0]cntq1,cntq2,cntq3,cntq4; reg[3:0]dat;

always@(posedge sysclk) begin if(cnt==26’b1_0111_1101_0111_1000_0100_0000) begin clk_cnt<=~clk_cnt;cnt<=0;end else begin cnt<=cnt+1;end end

always@(posedge clkint) begin if(clk_cnt) begin if(cntp1==’b1001) begin cntp1<=’b0000; cntp2<=cntp2+1; if(cntp2==’b1001) begin cntp2<=’b0000; cntp3<=cntp3+1; if(cntp3==’b1001) begin cntp3<=’b0000; cntp4<=cntp4+1; if(cntp4==’b1001) begin cntp4<=’b0000; led=1;end end end

5

课程设计说明书

end

else begin cntp1<=cntp+1;end

end else begin

if(cntp1!=’b0000|cntp2!=’b0000|cntp3!=’b0000|cntp4!=’b0000 |) begin

cntq1<=cntp1;cntq2<=cntp2;cntq3<=cntp3;cntq4<=cntp4; cntp1<='b0000;cntp2<=’b0000;cntp3<=’b0000;cntp4<=’b0000; end end end always begin case(cnt[14:13]) 'b00:begin scan<=’b00000001;dat<=cntq1; end 'b01:begin scan<=’b00000010;dat<=cntq2; end 'b10:begin scan<=’b00000100;dat<=cntq3; end 'b11:begin scan<=’b00001000;dat<=cntq4; end default:begin scan<=’bx;dat<=’bx; end endcase case(dat[3:0]) 4’b0000:begin seg7*6:0+=7’b1111110:end 4’b0001:seg7*6:0+=7’b0110000; 4’b0010:seg7*6:0+=7’b1101101; 4’b0011:seg7*6:0+=7’b1111001; 4’b0100:seg7*6:0+=7’b0110011; 4’b0101:seg7*6:0+=7’b1011011; 4’b0110:seg7*6:0+=7’b1011111; 4’b0111:seg7*6:0+=7’b1110000; 4’b1000:seg7*6:0+=7’b1111111; 4’b1001:seg7*6:0+=7’b1111011; default:seg7*6:0+=’bX; endcase end

endmodule

6

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

课程设计说明书 其中分别对应着十进制的0—9这是个数字。 6、编译仿真 最后的程序的编译仿真结果如图1-5。 图1-5 附录1: module cymometer(seg7,scan,sysclk,clkin); output[6:0]seg7; output[7:0]scan; output led; reg led; input sysclk; //20MHz时钟信号 input clkin; reg[6:0]seg7; reg[7:0]scan; reg[25:0]cnt; reg clk_cnt; reg[2:0]cntp1,cntp2,cntp3,cntp4; reg[2:0]cntq1,cntq2,cntq3,c

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com