Pages

Thursday 10 July 2014

Verilog Strengths

Definition
The strength declaration construct is used for modeling net type variables for a close correspondence with physical wires.

Syntax
(Strength1, Strength0)
(Strength0, Strength1)

Strength1: (specifies the strength when the net is driven with value “1”)
              supply1,  strong1,  pull1,  large1,  weak1,  medium1,  small1,  highz1

Strength0: (specifies the strength when the net is driven with value “0”)
               supply0,  strong0,  pull0,  large0,  weak0,  medium0,  small0,  highz0

Description
Strengths can be used to resolve which value should appear on a net or gate output. There are two types of strengths:                   
drive strength (See Example 1) and charge strength (See Example 2).

*    The drive strengths can be used for nets (except trireg net), gates, and UDPs.
         The charge strengths can be used only for trireg nets.

*    The drive strength types are supply, strong, pull, weak, and highz strengths.
         The charge strength types are large, medium and small strengths.

All strengths can be ordered by their value. The supply strength is the strongest and the highz strength is the weakest strength level. Strength value can be displayed by system tasks ($display, $monitor - by using of the %v characters).

Strength
Value
Value displayed by display tasks
Supply
7
Su
Strong
6
St
Pull
5
Pu
Large
4
La
  Weak
3
We
medium
2
Me
Small
1
Sm
Highz
0
HiZ

                    Table:  Strengths ordered by decreasing value

There are different scenarios of driving strength and is mentioned below –

*    If two or more drivers drive a signal then it will have the value of the strongest driver (See Example 3).
*    If two drivers of a net have the same strength and value, then the net result will have the same value and strength (See Example 4).
*    If two drivers of a net have the same strength but different values then signal value will be unknown and it will have the same strength as both drivers (See Example 5).
*    If one of the drivers of a net has an H or L value, then signal value will be n1n2X, where n1 is the strength value of the driver that has the smaller strength, and n2 is strength value of driver that has the larger strength (See Example 6).

** The combinations (highz0, highz1) and (highz1, highz0) are illegal.

SAMPLE CODE1:
and (strong1, weak0) and1(out, in1, in2);
Instance of and gate with  strong1 strength and weak0 strength specified.

SAMPLE CODE2:
trireg (medium) t;
The charge strength declaration for  trireg  net.













SAMPLE CODE3:
buf (strong1, weak0)  buff1 (y, a);
buf (pull1, supply0)  buff2 (y, b);

If a = 0 and b = 0 then y will be 0 with supply strength because both gates will set y to 0 and supply (7) strength has bigger value than weak (3) strength.
If a = 0 and b = 1 then y will be 1 with pull strength because buff1 will set y to 0 with weak (3) strength and buff2 will set y to 1 with pull (5) strength (pull strength is stronger than the weak strength).
If a = 1 and b = 0 then y will be 0 with supply strength because buff1 will set y to 1 with strong (6) strength and buff2 will set y to 0 with supply (7) strength (supply strength is stronger than the strong strength).
If a = 1 and b = 1 then y will be 1 with strong strength because buff1 will set y to 1 with strong (6) strength and buff2 will set y to 1 with pull (5) strength.


SAMPLE CODE4:

buf (strong1, weak0) buf1 (y, a);
buf (strong1, weak0) buf2 (y, b);

 If a = 0 and b = 0 then y will be 0 with weak strength.
If a = 1 and b = 1 then y will be 1 with strong strength.

SAMPLE CODE5:
buf (strong1, weak0) buf1 (y, a);
buf (weak1, strong0) buf2 (y, b);

If a = 1 and b = 0 then y will be x with strong strength.

SAMPLE CODE6:
bufif0 (strong1, weak0) buf1 (y, i1, ctrl);
bufif0 (strong1, weak0) buf2 (y, i2, ctrl);

If ctrl = x, i1 = 0, and i2 = 1 then y will be x with 36X strength, because buf1 will set y to L with strong strength (StL - 6) and buf2 will set y to H with weak strength (WeH - 3).


Important Notes
If one of the drivers has an H or L value, then the output value will be X.

No comments:

Post a Comment