完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
module test21(Iavg_EOC,CLK,RSTn,Iavg,end_frequency,current_frequency,start);
input CLK; input RSTn; input Iavg_EOC; input [11:0]Iavg; output [13:0]end_frequency; output [13:0]current_frequency; output start; reg [13:0]end_frequency; reg [13:0]current_frequency; reg start; reg [11:0]I_Value1; reg [11:0]I_Value0; reg i; always @(posedge CLK or negedge RSTn) if(!RSTn) begin current_frequency<=14'd2381; end_frequency<=14'd2381; I_Value0<=10'd0; start<=1'b0; end else begin if(current_frequency<=2681) begin start<=1'b0; if(Iavg_EOC==1'b1) begin current_frequency<=current_frequency; end_frequency<=end_frequency; I_Value1<=Iavg; i<=1'b0; end else begin if(i==1'b0) begin if(I_Value1>I_Value0) begin current_frequency<=current_frequency+14'd10; end_frequency<=end_frequency+14'd10; I_Value0<=I_Value1; i<=1'b1; end else if(I_Value1 begin current_frequency<=current_frequency+14'd10; end_frequency<=end_frequency; i<=1'b1; end else begin current_frequency<=current_frequency+14'd10; end_frequency<=end_frequency; end end else begin current_frequency<=current_frequency; end_frequency<=end_frequency; end end end else begin current_frequency<=current_frequency; end_frequency<=end_frequency; start<=1'b1; end end endmodule |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
752 浏览 0 评论
矩阵4x4个按键,如何把识别结果按编号01-16(十进制)显示在两个七段数码管上?
962 浏览 0 评论
862 浏览 0 评论
1837 浏览 0 评论
473 浏览 0 评论
1264 浏览 26 评论
5461 浏览 113 评论
浏览过的版块 |
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-7 22:28 , Processed in 0.818489 second(s), Total 68, Slave 51 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号