Verilog HDL
2007/07/27 11:43
http://blog.naver.com/PostPrint.nhn?blogId=babojay&logNo=40040331255#
Chapter 10.
Timing
and Delays
- Timing Simulation : ½ÇÁ¦ Çϵå¿þ¾î¿¡¼´Â logic elementµé°ú pathµé¿¡ ÀÇÇØ delayµéÀÌ Á¸ÀçÇÑ´Ù. Timing requirement¸¦ ¸¸Á·ÇÏ´ÂÁö¸¦ °ËÁõÇØ¾ß ÇÑ´Ù.
* Objectives
- Verilog ½Ã¹Ä·¹À̼ǿ¡¼ »ç¿ëµÇ´Â delay ¸ðµ¨µé
: distributed, lumped, pin-to-pin(path)
- specify block : path delay¸¦
¼³Á¤ÇÏ´Â ¹æ¹ý
- parallel connection, full connection
- specparam
: specify block¾ÈÀÇ ÆĶó¸ÞŸ¸¦ Á¤ÀÇÇÏ´Â ¹æ¹ý
- state-dependent path
delays
- rise, fall, turn-off delays. min, max, typ °ªÀÇ ¼³Á¤¹æ¹ý
-
$setup, $hold,
$switch
-
delay back-annotation
10.1 Types of Delay Models
10.1.1 Distributed Delay
- ȸ·Î¾ÈÀÇ ¿ä¼ÒµéÀÇ delay¸¦ µû·Î µû·Î Á¤ÀÇÇÒ ¼ö ÀÖ´Ù.
±×¸² 10.1 Distributed Delay
- °¢°¢ÀÇ gate¿¡ delay¸¦ ÁöÁ¤Çϰųª assign±¸¹®¿¡ delay¸¦ ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù.
Ex)
// Distributed delay in
gate-level
module M (out, a, b, c, d);
output out;
input a, b, c, d;
wire e, f;
and #5 a1(e, a, b);
and #7 a2(f, c,
d);
and #4
a3(out, e, f);
endmodule
// Distributed delay in data flow
module M (out, a, b, c,
d);
output out;
input a, b, c, d;
wire e, f;
assign #5 e = a & b;
assign #7 f = c &
d;
assign #4
out = e & f;
endmodule
10.1.2 Lumped Delay
- module ´ÜÀ§·Î delay¸¦ ÁöÁ¤ÇÑ´Ù. moduleÀÇ Ãâ·Â¿¡ ´ÜÀÏ delay·Î ÁöÁ¤ÇÏ¸ç ¸ðµç pathÀÇ ´©Àû delay¸¦ ³ªÅ¸³½´Ù.
±×¸² 10.2 Lumped Delay
Ex)
// Lumped Delay
Model
module M
(out, a, b, c, d);
output out;
input a, b, c,
d;
wire e, f;
and a1(e, a, b);
and a2(f, c,
d);
and #11
a3(out, e,
f);
// Ãâ·Â¿¡ 4+7ÀÇ delay Àû¿ë
endmodule
10.1.3 Pin-to-Pin Delays
- input¿¡¼ ºÎÅÍ output±îÁöÀÇ ¸ðµç path¿¡ ´ëÇؼ °³º°ÀûÀ¸·Î delay¸¦ ÁöÁ¤ÇÑ´Ù.
- Ç¥ÁغÎÇ°¿¡
´ëÇؼ± ¸ÞÀÌÄ¿°¡ Á¦°øÇÏ´Â delay¸¦ ÁöÁ¤Çϰųª SPICE°°Àº simulationÀ» ÅëÇØ delay¸¦ ¾ò¾î »ç¿ëÇÑ´Ù.
-
pin-to-pin delay°¡ ¼¼¼¼ÇÏ°Ô ÁöÁ¤ÇØÁà¾ß ÇÏ´Â delayÀ̱ä ÇÏÁö¸¸ Å« »çÀÌÁîÀÇ design¿¡¼´Â ³»ºÎ¿¡ ¾î¶»°Ô ±¸¼ºµÇ¾ú´Â°¡¸¦ ÀÏÀÏÀÌ
°í·ÁÇÏÁö ¾Ê°í ÀԷ°ú Ãâ·ÂÀÇ °üÁ¡¿¡¼ delay¸¦ »ý°¢Çϱ⠶§¹®¿¡ ¿ÀÈ÷·Á ½¬¿ï ¼ö ÀÖ´Ù.
- Path delay¶ó°íµµ
ÇÑ´Ù.
10.2 Path Delay Modeling
10.2.1 Specify Blocks
- module path delay : moduleÀÇ source(input,
inout)¿¡¼ destination(output,
inout)±îÁöÀÇ delay
- specify, endspecify
: Path delay¸¦ ÁöÁ¤ÇÏ´Â keyword. specify blockÀ» ±¸¼ºÇÑ´Ù.
-
specify block
:
¡Ü moduleÀ» °¡·ÎÁö¸£´Â pin-to-pin delay¸¦
ÁöÁ¤
¡Ü ȸ·ÎÀÇ timing check¸¦
¼³Á¤
¡Ü specparam »ó¼ö¸¦
Á¤ÀÇ
Ex)
// Pin-to-pin
Delays
module M
(out, a, b, c, d);
output out;
input a, b, c,
d;
wire e, f;
specify
(a
=> out) = 9;
(b
=> out) = 9;
(c
=> out) = 11;
(d
=> out) = 11;
endspecify
and a1(e, a, b);
and a2(f, c,
d);
and a3(out,
e, f);
endmodule
- spcify blockÀº module¾È¿¡¼ÀÇ µ¶¸³ÀûÀº º°µµÀÇ blockÀÌ´Ù. initialÀ̳ª always°°Àº ´Ù¸¥ block¾È¿¡ ÀÖÀ» ¼ö ¾ø´Ù.
10.2.2 Inside Specify Blocks
¡á Parallel Connection
- bitº° 1´ë1ÀÇ path¿¡ ´ëÇÑ delay¼³Á¤
Usage:
( <source_fied>
=> <destination_field>
) = <delay_value>
;
±×¸² 10.4 Parallel Connection
Ex)
// Parallel
Connection
//
Single bit a, out
(a => out) =
9;
// Vector a[3:0], out[3:0]
(a => out) =
9;
(a[0] => out[0]) = 9; // À§ÀÇ ¿¹¿Í °°´Ù.
(a[1] => out[1]) = 9;
(a[2] => out[2]) =
9;
(a[3] =>
out[3]) = 9;
// Vector a[4:0], out[3:0]
(a => out) =
9;
// bit width°¡ ´Ù¸£±â ¶§¹®¿¡ Error
¡á Full Connection
- ¸ðµç source¿Í destinationÀ» ¿¬°áÇÏ´Â pathÀÇ delay¸¦ ÇϳªÀÇ °ªÀ¸·Î Çѹø¿¡ ÁöÁ¤
Usage: ( <source_fied> *> <destination_field> ) = <delay_value> ;
±×¸² 10.5 Full Connection
Ex)
// Full
Connection
module M (out, a, b, c, d);
output out;
input a, b, c,
d;
wire e, f;
specify
(a, b
*> out) = 9;
(c, d
*> out) = 11;
endspecify
and a1(e, a, b);
and a2(f, c,
d);
and a3(out,
e, f);
endmodule
- ´ÙÀ½°ú °°ÀÌ bit width°¡ ´Ù¸¥ °æ¿ì¿¡µµ »ç¿ë°¡´ÉÇÏ´Ù.
Ex)
// a[31:0],
out[15:0]
specify
(a
*> out) = 9;
endspecify
* À§¿Í °°Àº °æ¿ì¸¦ parallel connectionÀ¸·Î ó¸®ÇÒ °æ¿ì 32*16 = 352°³ÀÇ connectionÀ» ÁöÁ¤ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
¡á specparam Statements
- specparam
: specify block¿¡¼ »ç¿ëÇÏ´Â special parameter¸¦ Á¤ÀÇÇÒ ¶§ »ç¿ë
-
ÀÏÀÏÀÌ delay ¼ýÀÚ¸¦ ½áÁÖ´Â °ÍÀ» ´ë½ÅÇÏ¿© parameter¸¦ Á¤ÀÇÇÏ°í specify block¿¡¼ »ç¿ëÇÑ´Ù.
Ex)
// Specparam
specify
specparam d_to_q = 9;
specparam clk_to_q = 11;
(d
=> q) = d_to_q;
(clk
=> q) = clk_to_q;
endspecify
- specify parameter´Â Á¤ÀÇµÈ specify block¾È¿¡¼¸¸ »ç¿ë°¡´ÉÇÏ´Ù.
¡á Conditional Path Delays
- input ½ÅÈ£ÀÇ »óÅ¿¡ µû¶ó¼ pin-to-pin delay°¡ ´Þ¶óÁú ¼ö ÀÖ´Ù. specify block¾È¿¡ if±¸¹®À» ÀÌ¿ëÇØ input»óÅ¿¡ µû¶ó ´Ù¸¥
delay¸¦ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù.
- else±¸¹®À» »ç¿ëÇÏ´Â °ÍÀº
±ÝÁöµÇ¾îÀÖ´Ù.
Ex)
// Conditional Path
Delay
module M
(out, a, b, c, d);
output out;
input a, b, c,
d;
wire e, f;
specify
if (a)
(a => out) = 9;
if(~a)
(a => out) = 10;
if (b
& c) (b => out) = 9;
if (~(b
& c)) (b => out) = 13;
if ({c,
d} == 2'b01)
(c, d *> out) = 11;
if ({c,
d} != 2'b01)
(c, d *> out) = 13;
endspecify
and a1(e, a, b);
and a2(f, c,
d);
and a3(out,
e, f);
endmodule
¡á Rise, Fall, Turn-off Delays
- Pin-to-pin delay´Â rise, fall, turn-off delay·Î ¼¼ºÐÈÇÏ¿© ÁöÁ¤ÇØ ÁÙ ¼ö
ÀÖ´Ù.
- ¸ðµç Á¾·ùÀÇ transitionÀ» ÀÚÀ¯·Ó°Ô ÁöÁ¤ÇÒ ¼ö ÀÖ´Â °ÍÀº ¾Æ´Ï´Ù. ´ÙÀ½°ú °°Àº ±ÔÄ¢¿¡ ÀÇÇØ 5°¡ÁöÀÇ ¹æ½ÄÀ¸·Î
ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù. transitionÀÇ Á¾·ù´Â ÁöÁ¤ÇÏ´Â ¼ø¼¿¡ ÀÇÇØ Á¤ÇØÁö¹Ç·Î ¼ø¼¸¦ ¹Ýµå½Ã ÁöÄÑ¾ß ÇÑ´Ù.
i) 1°³ÀÇ delay : ¸ðµç transition¿¡ ´ëÇÑ ÇϳªÀÇ delay¸¦ ÁöÁ¤
specparam t_delay =
11;
(clk => q) = t_delay;
ii) 2°³ÀÇ delay : rise(0¡æ1, 0¡æz, z¡æ1), fall(1¡æ0, 1¡æz, z¡æ0)¿¡ ´ëÇÑ delayÁöÁ¤
specparam t_rise = 9, t_fall = 13;
(clk => q) = (t_rise,
t_fall);
iii) 3°³ÀÇ delay : rise(0¡æ1, z¡æ1), fall(1¡æ0, z¡æ0), turn-off(1¡æz, 0¡æz)¿¡ ´ëÇÑ delayÁöÁ¤
specparam t_rist = 9, t_fall = 13, t_turnoff = 11;
(clk => q) = (t_rise, t_fall, t_turnoff);
iv) 6°³ÀÇ delay : (0¡æ1, 1¡æ0, 0¡æz, z¡æ1, 1¡æz, z¡æ0)ÀÇ ¼ø¼¿¡ ÀÇÇÑ delay ÁöÁ¤
specparam t_01 = 9, t_10 = 13, t_0z = 11;
specparam t_z1 = 9, t_1z = 11, t_z0 = 13;
(clk => q) = (t_01, t_10, t_0z, t_z1, t_1z, t_z0);
v) 12°³ÀÇ delay :(0¡æ1, 1¡æ0,
0¡æz, z¡æ1,
1¡æz, z¡æ0,
0¡æx, x¡æ1,
1¡æx, x¡æ0,
x¡æz, z¡æx)ÀÇ
¼ø¼¿¡ ÀÇÇÑ ÁöÁ¤
specparam t_01 = 9, t_10 = 13, t_0z = 11;
specparam t_z1 = 9, t_1z = 11, t_z0 = 13;
specparam t_0x = 4, t_x1 = 13, t_1x = 5;
specparam t_x0 = 9, t_xz = 11, t_zx = 7;
(clk => q) = (t_01, t_10, t_0z, t_z1, t_1z, t_z0, t_0x, t_x1, t_1x, t_x0,
t_xz, t_zx);
¡á MIn, Max, Typical delays
- pin-to-pin delay¿¡ 5Àå¿¡¼ ¼³¸íÇÑ min, max, typical delay¸¦ ÁöÁ¤ÇÒ ¼ö
ÀÖ´Ù.
- min:typ:max ÀÇ ¹æ½ÄÀ¸·Î À§ÀÇ 5°¡Áö delayÁöÁ¤ ¹æ¹ý¿¡ ¸ðµÎ »ç¿ë°¡´ÉÇÏ´Ù.
specparam t_rise = 8:9:10, t_fall = 12:13:14, t_turnoff =
10:11:12;
(clk
=> q) = (t_rist, t_fall, t_turnoff);
¡á Handling x transition
- Verilog¿¡¼ x »óÅÂÀÇ·ÎÀÇ transitionÀÇ delay´Â
ºñ°üÀû?(pessimistic)ÀÎ ¹æ¹ýÀ¸·Î °è»êµÈ´Ù.
- À§ÀÇ ºñ°üÀû(pessimistic)À̶õ ¸»Àº ¾ÆÁ÷µµ »ý¼ÒÇÏ´Ù. ¾î·µç
´Ù¸¥ delay°ªµéÀÇ ¿µÇâÀ» ¹Þ¾Æ ±× ÃÖ¼Ò°ª°ú ÃÖ´ë°ªÀ» ÃëÇÑ´Ù.
- x·ÎÀÇ
transition¿¡¼´Â ´Ù¸¥ ¸ðµç °¡´ÉÇÑ delayÁß¿¡¼ ÃÖ¼Ò°ªÀ» ÃëÇÑ´Ù.
- x·ÎºÎÅÍÀÇ
transition¿¡¼´Â ´Ù¸¥ ¸ðµç °¡´ÉÇÑ delayÁß¿¡¼ ÃÖ´ë°ªÀ» ÃëÇÑ´Ù.
// 6°³ÀÇ delay ¹æ¹ý
// 0¡æ1, 1¡æ0, 0¡æz, z¡æ1, 1¡æz, z¡æ0ÀÇ ¼ø¼¿¡ ÀÇÇÑ ÁöÁ¤
specparam t_01
= 9, t_10 = 13, t_0z = 11;
specparam t_z1 = 9, t_1z = 11,
t_z0 = 13;
(clk
=> q) = (t_01, t_10, t_0z, t_z1, t_1z, t_z0);
Ç¥ 1-.1 x transition
10.3 Timing Checks
- $setup,
$hold, $width
: °¡Àå ÀϹÝÀûÀÌ°í ¸¹ÀÌ »ç¿ëÇÏ´Â timing checking system task
- ¾ðÁ¦³ª
specify block¾È¿¡¼¸¸ »ç¿ë °¡´ÉÇÏ´Ù.
10.3.1 $setup and $hold checks
- setup, hold : ¼øÂ÷ȸ·Î¿¡¼ clockÀÇ ÀüÈÄ·Î dataÀÇ ÃÖ¼Ò À¯È¿ ½Ã°£À» ÀǹÌÇÑ´Ù.
±×¸² 10.6 Setup and Hold Times
¡á $setup task
Usage :
$setup(data_event, reference_event,
limit);
data_event : monitorÇÏ´Â
½ÅÈ£
reference_event : data_eventÀÇ ±âÁØÀÌ µÇ´Â ½ÅÈ£
limit
: setup time¿¡ ÇÊ¿äÇÑ ÃÖ¼Ò ½Ã°£
- (Treference_event - Tdata_event) < limit ÀÌ¸é ¿À·ù¸¦ º¸°íÇÑ´Ù.
Ex)
// Setup Check
specify
$setup(data, posedge clock, 3);
endspecify
¡á $hold task
Usage :
$hold(reference_event, data_event,
limit);
reference_event
: data_eventÀÇ ±âÁØÀÌ µÇ´Â
½ÅÈ£
data_event
: monitorÇÏ´Â
½ÅÈ£
limit
: hold time¿¡ ÇÊ¿äÇÑ ÃÖ¼Ò ½Ã°£
- (Tdata_even - Treference_event) < limit ÀÌ¸é ¿À·ù¸¦ º¸°íÇÑ´Ù.
Ex)
// Hold Check
specify
$hold(posedge clock, data, 5);
endspecify
10.3.2 $width check
- ¶§·Î´Â ÆÞ½ºÀÇ ÆøÀ» checkÇØ¾ß ÇÒ ¶§µµ ÀÖ´Ù. À̶§ »ç¿ëÇÏ´Â °ÍÀÌ $widthÀÌ´Ù.
±×¸² 10.7 Width of pulse
Usage :
$width(reference_event,
limit);
reference_event
: edge-triggerd
event
limit
: ÆÞ½º ÆøÀÇ ÃÖ¼Ò ½Ã°£
- data_event´Â µû·Î
¸í½ÃÇÏÁö ¾Ê´Â´Ù. reference_event°¡
ÀϾ°í ³ ÈÄ ´ÙÀ½¿¡ ¿À´Â ¹Ý´ë¹æÇâÀÇ edge°¡ data_event°¡ µÈ´Ù.
- (Tdata_even - Treference_event) <
limit ÀÌ¸é ¿À·ù¸¦ º¸°íÇÑ´Ù.
Ex)
// Width check
// posedge claer :
reference_event
// ¹Ù·ÎÀ̾îÁö´Â negedge clear : data_event
specify
$width(posedge clear, 6);
endspecify
10.4 Delay Back-Annotation
- Delay back-annotationÀº Ã¥ ÇѱÇÀ» ´Ù ÇÒ¾ÖÇصµ ¸ðÀÚ¶õ ÁÖÁ¦ÀÌ´Ù. ¿©±â¼± °£·«ÇÑ ¼Ò°³¸¸ ÇÏ°í
³Ñ¾î°£´Ù.
±×¸² 10.8 Delay Back-Annotation
1) RTL·Î ±â¼úÇÏ°í functional simulationÀ» ½ÇÇà
2) RTLÀ» gate-levelÀÇ
netlist·Î º¯È¯(Logic Synthesis)
3) IC°øÁ¤¿¡ °üÇÑ Á¤º¸¿Í delay calculatorµîÀ» ÀÌ¿ëÇÑ
chipÀÇ prelayout data¸¦ °¡Áö°í timing simulationÀ» ½ÇÇà
4) P&R(Place &
Route) tool·Î layout ÀÛ¼º. ÀÌ layoutÀÇ R, C¸¦ °è»êÇÏ¿© postlayout delay°ªÀ» ÃßÃâ.
5)
ÀÌ·¸°Ô ¾ò¾îÁø delay°ªÀ¸·Î gate-level netlist¿¡ »ç¿ëµÈ delay ÃßÁ¤°ªÀ» ¼öÁ¤. timing simulationÀ» Àç½ÇÇà.
spec.À» ¸¸Á·ÇÏ´ÂÁö È®ÀÎ
6) timing specÀ» ¸¸Á·Çϸé RTL·Î µ¹¾Æ°¡ ÃÖÀûȸ¦ ÁøÇàÇÏ°í 2´Ü°èºÎÅÍ 5´Ü°èÀÇ °úÁ¤À»
¹Ýº¹.