当前位置:网站首页>50MHz generation time
50MHz generation time
2022-07-08 01:00:00 【eachanm】
50Mhz The corresponding count is 0.02us, That is to say 20 nanosecond , Count to 1us want 50 Count , Others can be calculated by yourself , The following is the generation of 1us、1ms、1s Methods
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 by 20ns
reg [9:0]cnt_1s; // Give Way 1ms Count to 1000
reg [9:0]cnt_1ms; // Give Way 1us Count to 1000
reg [5:0]cnt_1us; // Count to 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;
// Control state
[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
Clock cycle corresponding to clock frequency
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
Common unit conversion
1GHz=1000MHz,1MHz=1000kHz,1kHz=1000Hz
1s=1000ms,1 ms=1000μs,1μs=1000ns
s( second )、ms( millisecond )、μs( Microsecond )、ns( nanosecond )
边栏推荐
- QT adds resource files, adds icons for qaction, establishes signal slot functions, and implements
- SDNU_ACM_ICPC_2022_Summer_Practice(1~2)
- 4.交叉熵
- 7.正则化应用
- Introduction to ML regression analysis of AI zhetianchuan
- C # generics and performance comparison
- 接口测试要测试什么?
- ReentrantLock 公平锁源码 第0篇
- 【笔记】常见组合滤波电路
- Which securities company has a low, safe and reliable account opening commission
猜你喜欢

Introduction to ML regression analysis of AI zhetianchuan

Semantic segmentation model base segmentation_ models_ Detailed introduction to pytorch
![[note] common combined filter circuit](/img/2f/a8c2ef0d76dd7a45b50a64a928a9c8.png)
[note] common combined filter circuit

jemter分布式

Cancel the down arrow of the default style of select and set the default word of select

Get started quickly using the local testing tool postman

Invalid V-for traversal element style

第一讲:链表中环的入口结点

Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet

Codeforces Round #804 (Div. 2)(A~D)
随机推荐
NVIDIA Jetson test installation yolox process record
Service mesh introduction, istio overview
jemter分布式
8道经典C语言指针笔试题解析
STL -- common function replication of string class
Su embedded training - C language programming practice (implementation of address book)
Reentrantlock fair lock source code Chapter 0
新库上线 | CnOpenData中国星级酒店数据
My best game based on wechat applet development
The method of server defense against DDoS, Hangzhou advanced anti DDoS IP section 103.219.39 x
New library online | information data of Chinese journalists
[Yugong series] go teaching course 006 in July 2022 - automatic derivation of types and input and output
13. Model saving and loading
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
Binder core API
Kubernetes static pod (static POD)
13. Enregistrement et chargement des modèles
ABAP ALV LVC模板
NVIDIA Jetson测试安装yolox过程记录
德总理称乌不会获得“北约式”安全保障