完善资料让更多小伙伴认识你,还能领取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 |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
求FPGA 驱动控制ltc2271 或者 ltc2180 或者 ltc2190或者 ltc2202 的代码
962 浏览 0 评论
363 浏览 0 评论
求助:遇见诡异问题,FPGA模块A输出端口连接模块B输入后,模块A不能正常工作的
1139 浏览 1 评论
414 浏览 0 评论
1071 浏览 1 评论
3979 浏览 89 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-6 06:27 , Processed in 0.620937 second(s), Total 70, Slave 53 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号