(筆記) 如何使用$width? (SOC) (Verilog)
2009-07-15 23:31
1896 查看
Abstract
$width是Verilog所提供的專門用來做timing check的system task,可以檢查一個edge transition到另外一個相反的edge transition的時間長度是否符合規格需求,若pulse width小於我們所指定的需求,將產生violation warning。
Introduction
使用環境:NC-Verilog 5.4 + Debussy 5.4
如下圖所示,若pulse width小於limit時,將產生violation warning。
Testbench
width_tb.v / Verilog
1 /*
2 (C) OOMusou 2009 http://oomusou.cnblogs.com 3
4 Filename : width_tb.v
5 Compiler : NC-Verilog 5.4 + debussy 5.4
6 Description : $width demo
7 Release : 07/15/2009 1.0
8 */
9
10 `timescale 1ns/1ns
11
12 module width_tb;
13
14 reg reg_a;
15 wire wire_a;
16
17 assign wire_a = reg_a;
18
19 initial begin
20 $fsdbDumpfile("width_tb.fsdb");
21 $fsdbDumpvars(0, width_tb);
22 #50;
23 $finish;
24 end
25
26 initial begin
27 reg_a = 1'b0;
28 #10;
29 reg_a = 1'b1;
30 #5;
31 reg_a = 1'b0;
32 end
33
34 specify
35 $width(posedge wire_a, 6); /* 4 is ok */
36 endspecify
37
38 endmodule
NC-Verilog產生Timing violation的warning
pulse width為5 ns
29行
reg_a = 1'b1;
#5;
故意產生pulse width為5ns的波形
34行
specify
$width(posedge wire_a, 6); /* 4 is ok */
endspecify
使用$width檢察timing,以上表示從posedge wire_a開始檢察,若pulse width小於6,將產生timing violation warning。此外,Verilog規定timing check類的system task,一定要放在specify block內。
完整程式碼下載
s_width.7z
Reference
Verilog延時specify
Cadence NC-Verilog Simulator Help
See Also
(筆記) 如何使用$skew? (SOC) (Verilog)
$width是Verilog所提供的專門用來做timing check的system task,可以檢查一個edge transition到另外一個相反的edge transition的時間長度是否符合規格需求,若pulse width小於我們所指定的需求,將產生violation warning。
Introduction
使用環境:NC-Verilog 5.4 + Debussy 5.4
如下圖所示,若pulse width小於limit時,將產生violation warning。
Testbench
width_tb.v / Verilog
1 /*
2 (C) OOMusou 2009 http://oomusou.cnblogs.com 3
4 Filename : width_tb.v
5 Compiler : NC-Verilog 5.4 + debussy 5.4
6 Description : $width demo
7 Release : 07/15/2009 1.0
8 */
9
10 `timescale 1ns/1ns
11
12 module width_tb;
13
14 reg reg_a;
15 wire wire_a;
16
17 assign wire_a = reg_a;
18
19 initial begin
20 $fsdbDumpfile("width_tb.fsdb");
21 $fsdbDumpvars(0, width_tb);
22 #50;
23 $finish;
24 end
25
26 initial begin
27 reg_a = 1'b0;
28 #10;
29 reg_a = 1'b1;
30 #5;
31 reg_a = 1'b0;
32 end
33
34 specify
35 $width(posedge wire_a, 6); /* 4 is ok */
36 endspecify
37
38 endmodule
NC-Verilog產生Timing violation的warning
pulse width為5 ns
29行
reg_a = 1'b1;
#5;
故意產生pulse width為5ns的波形
34行
specify
$width(posedge wire_a, 6); /* 4 is ok */
endspecify
使用$width檢察timing,以上表示從posedge wire_a開始檢察,若pulse width小於6,將產生timing violation warning。此外,Verilog規定timing check類的system task,一定要放在specify block內。
完整程式碼下載
s_width.7z
Reference
Verilog延時specify
Cadence NC-Verilog Simulator Help
See Also
(筆記) 如何使用$skew? (SOC) (Verilog)
相关文章推荐
- (筆記) 如何使用blocking與nonblocking assignment? (SOC) (Verilog)
- (筆記) 如何使用$skew? (SOC) (Verilog)
- (筆記) 如何使用Debussy與ModelSim做Co-Simulation? (SOC) (Verilog) (VHDL) (Debussy) (ModelSim)
- (筆記) 如何使用blocking與nonblocking assignment? (SOC) (Verilog)
- (筆記) 如何在Linux上使用Verilog PLI? (SOC) (Verilog PLI) (NC-Verilog) (Linux)
- (筆記) 如何設計8位元暫存器? (SOC) (Verilog)
- (筆記) 如何設計5位元的8對1多工器? (SOC) (Verilog) (MegaCore)
- (筆記) 如何將值delay n個clock? (SOC) (Verilog)
- 如何使用SignalTap II觀察reg與wire值? (SOC) (Verilog) (Quartus II) (SignalTap II)
- (筆記) 如何設計邊緣檢測電路? (SOC) (Verilog)
- (筆記) 如何設計D Latch與D Flip-Flop? (SOC) (Verilog)
- 如何使用SignalTap II觀察reg與wire值? (SOC) (Verilog) (Quartus II) (SignalTap II)
- (筆記) 如何將參數從Verilog傳到C? (SOC) (Verilog) (Verilog PLI)
- (筆記) 如何將memory轉成vector? (SOC) (Verilog)
- (转载)如何使用Verilog將YCbCr轉RGB? (SOC) (Verilog) (DE2-70)
- (筆記) 如何比較Windows與Liunx下所產生的文字檔? (SOC) (NC-Verilog) (VCS) (UltraEdit)
- (原創) 如何使用SignalTap II觀察reg與wire值? (SOC) (Verilog) (Quartus II) (SignalTap II)
- (筆記) 如何安裝NC-Verilog? (SOC) (NC-Verilog)
- (原創) 如何使用Verilog將YCbCr轉RGB? (SOC) (Verilog) (DE2-70)
- (筆記) 如何設計邊緣檢測電路? (SOC) (Verilog)