当前位置:网站首页>50Mhz产生时间
50Mhz产生时间
2022-07-07 23:12:00 【eachanm】
50Mhz 对应一个计数为0.02us,也就是20纳秒,计数到1us要50个计数,其他可自己算,下面是产生1us、1ms、1s的方法
module count_time
#(
parameter CNT_1US_MAX = 6'd49,
parameter CNT_1MS_MAX = 10'd999,
parameter CNT_1S_MAX = 10'd999
)
(
input wire sys_clk,
input wire sys_rst_n,
output reg led_out
);
//50Mhz为20ns
reg [9:0]cnt_1s; //让1ms计数到1000
reg [9:0]cnt_1ms; //让1us计数到1000
reg [5:0]cnt_1us; //计数到50
reg cnt_en;
//1us
[email protected] (posedge sys_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
cnt_1us <= 6'd0;
else if(cnt_1us == CNT_1US_MAX)
cnt_1us <= 6'd0;
else
cnt_1us <= cnt_1us +6'd1;
//1ms
[email protected] (posedge sys_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
cnt_1ms <= 10'd0;
else if(cnt_1ms == CNT_1MS_MAX && cnt_1us == CNT_1US_MAX)
cnt_1ms <= 10'd0;
else if(cnt_1us == CNT_1US_MAX)
cnt_1ms <= cnt_1ms +10'd1;
else
cnt_1ms <= cnt_1ms;
//1s
[email protected] (posedge sys_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
cnt_1s <= 10'd0;
else if(cnt_1s == CNT_1S_MAX && cnt_1ms == CNT_1MS_MAX && cnt_1us == CNT_1US_MAX)
cnt_1s <= 10'd0;
else if(cnt_1us == CNT_1US_MAX && cnt_1ms == CNT_1MS_MAX )
cnt_1s <= cnt_1s + 10'd1;
else
cnt_1s <= cnt_1s;
//控制状态
[email protected] (posedge sys_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
cnt_en <= 1'b0;
else if(cnt_1s == CNT_1S_MAX && cnt_1ms == CNT_1MS_MAX && cnt_1us == CNT_1US_MAX)
cnt_en <= ~cnt_en;
else
cnt_en <= cnt_en;
[email protected] (posedge sys_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
led_out <= 1'b1;
else if((cnt_en == 1'b0) && (cnt_1ms <= cnt_1s)
|| (cnt_en == 1'b1) && (cnt_1ms >= cnt_1s))
led_out <= 1'b0;
else
led_out <= 1'b1;
endmodule
时钟频率对应的时钟周期
5MHz 200ns
10MHz 100ns
20MHz 50ns
25MHz 40ns
33MHz 30ns
40MHz 25ns
50MHz 20ns
66MHz 15ns
80MHz 12ns
100MHz 10ns
120MHz 8.3ns
133MHz 7.5ns
166MHz 6.0ns
200MHz 5.0ns
250MHz 4.0ns
300MHz 3.3ns
333MHz 3.0ns
400MHz 2.5ns
500MHz 2.0ns
800MHz 1.2ns
1GHz 1.0ns
4GHz 0.25ns
常用单位换算
1GHz=1000MHz,1MHz=1000kHz,1kHz=1000Hz
1s=1000ms,1 ms=1000μs,1μs=1000ns
s(秒)、ms(毫秒)、μs(微秒)、ns(纳秒)
边栏推荐
- 【obs】官方是配置USE_GPU_PRIORITY 效果为TRUE的
- 22年秋招心得
- [OBS] the official configuration is use_ GPU_ Priority effect is true
- 2022-07-07: the original array is a monotonic array with numbers greater than 0 and less than or equal to K. there may be equal numbers in it, and the overall trend is increasing. However, the number
- 4.交叉熵
- Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
- 玩轉Sonar
- 德总理称乌不会获得“北约式”安全保障
- 7.正则化应用
- Fofa attack and defense challenge record
猜你喜欢

基于人脸识别实现课堂抬头率检测

1293_ Implementation analysis of xtask resumeall() interface in FreeRTOS

13. Enregistrement et chargement des modèles

Kubernetes Static Pod (静态Pod)

第四期SFO销毁,Starfish OS如何对SFO价值赋能?

Qt添加资源文件,为QAction添加图标,建立信号槽函数并实现

Image data preprocessing

英雄联盟胜负预测--简易肯德基上校

6.Dropout应用

Langchao Yunxi distributed database tracing (II) -- source code analysis
随机推荐
Interface test advanced interface script use - apipost (pre / post execution script)
Stock account opening is free of charge. Is it safe to open an account on your mobile phone
接口测试要测试什么?
Deep dive kotlin synergy (XXII): flow treatment
Service Mesh的基本模式
Jouer sonar
Solution to the problem of unserialize3 in the advanced web area of the attack and defense world
什么是负载均衡?DNS如何实现负载均衡?
v-for遍历元素样式失效
NTT template for Tourism
Letcode43: string multiplication
牛客基础语法必刷100题之基本类型
新库上线 | CnOpenData中国星级酒店数据
Fofa attack and defense challenge record
手机上炒股安全么?
新库上线 | CnOpenData中华老字号企业名录
[go record] start go language from scratch -- make an oscilloscope with go language (I) go language foundation
【obs】Impossible to find entrance point CreateDirect3D11DeviceFromDXGIDevice
The standby database has been delayed. Check that the MRP is wait_ for_ Log, apply after restarting MRP_ Log but wait again later_ for_ log
玩轉Sonar