X-Prop - Mb3 Evans Pres
X-Prop - Mb3 Evans Pres
Adrian Evans
Craig Forward
Julius Yam
Cisco Systems
Outline
• X-Propagation Technology
– Introduction
– T-Merge/X-Merge
– Results
• Conclusions
2
X-Propagation
Introduction
Reason to run
Gate Simulations
Synthesis Errors
Questionable RTL Style
Timing Verification
Power Analysis
RTL X-Optimism
3
X-Propagation
Introduction
4
X-Propagation
Introduction
5
X-Propagation
Introduction
6
X-Propagation
Introduction
7
X-Propagation
Introduction
8
X-Propagation
Introduction
9
X-Propagation
Outline
• Introduction
• Background
– Sources of X in RTL We are here !
– Ambiguous RTL Constructs
– Existing Solutions
• X-Propagation Technology
– Introduction
– T-Merge/X-Merge
– Results
• Conclusions
10
X-Propagation
Where do Xs Come From?
1. Uninitialized state
• Initially all DUT state is X Simulator
DUT
DUT
X X X
X
XXXXX
XXXXX XXXXXXX
X XX
XXXXXXX
Testbench
11
X-Propagation
Where do Xs Come From?
1. Uninitialized state
• Initially all DUT state is X Simulator
– Testbench applies RESET
DUT
DUT
X X X
X
XXXXX
XXXXX XXXXXXX
X XX
XXXXXXX
RESET
Testbench
12
X-Propagation
Where do Xs Come From?
1. Uninitialized state
• Initially all DUT state is X Simulator
13
X-Propagation
Where do Xs Come From?
2. Testbench drives X
• Good DV practice is to assign Simulator
X to input signals that
should not be consumed: DUT
DUT
IDLE
Test-bench
14
X-Propagation
Where do Xs Come From?
2. Testbench drives X
• Good DV practice is to assign Simulator
X to input signals that
should not be consumed: DUT
DUT
task pkt_driver::drive_idle();
pkt_bus.valid <= ‘b0; VALID = ‘b0
pkt_bus.sop <= ‘bx; SOP, EOP = ‘bX
DATA = ‘bX
pkt_bus.eop <= ‘bx;
pkt_bus.data <= ‘bx;
endtask IDLE
15
X-Propagation
Where do Xs Come From?
3. RTL Drives Xs
• Designers express : Simulator
Test-bench
16
X-Propagation
Where do Xs Come From?
4. Models Drive X on Errors
• A simulation model can drive Simulator
X as the response to an
invalid transaction DUT
DUT
• Real system behaviour is
unknown
‘bXXXXX
Protocol Error
Violation Response
Simulation
Model
17
X-Propagation
Where do Xs Come From?
Summary
Source Timeline
Uninitialized State Start of simulation
Testbench Any time
RTL Output Don‟t Care Any time
Simulation Model Any time
18
X-Propagation
Outline
• Introduction
• Background
– Sources of X in RTL
– Ambiguous RTL Constructs We are here !
– Existing Solutions
• X-Propagation Technology
– Introduction
– T-Merge/X-Merge
– Results
• Conclusions
19
X-Propagation
Normal RTL X Semantics
RTL X-Optimism
20
X-Propagation
Ambiguous RTL Constructs (1)
IF/ELSE
reg state;
IN SIMULATION
ELSE branch executes
and flushes X
21
X-Propagation
Ambiguous RTL Constructs (1)
IF/ELSE
IEEE 1800-2009
If the cond_predicate expression evaluates to
true (that is, has a nonzero known value), the
first statement shall be executed. If it
evaluates to false (that is, has a zero value
or the value is x or z), the first statement
shall not execute. If there is an else
statement and the cond_predicate
expression is false, the else statement
shall be executed.
22
X-Propagation
Ambiguous RTL Constructs (2)
CASE Statements
• The issue of optimistic X propagation through CASE
statements in RTL is very similar to IF/ELSE
statements
23
X-Propagation
Ambiguous RTL Constructs (3)
AMBIGUOUS EDGES
24
X-Propagation
Ambiguous RTL Constructs (3)
AMBIGUOUS EDGES
IEEE 1800-2009
A negedge shall be detected on the transition
from 1 to x, z, or 0, and
from x or z to 0.
25
X-Propagation
Ambiguous RTL Constructs (4)
BIT SELECTS
reg [3:0] index;
IN SIMULATION
If index is X, no
assignment takes place
26
X-Propagation
Ambiguous RTL Constructs (4)
BIT SELECTS
IEEE 1800-2009
Writing to an array with an invalid index
shall perform no operation.
27
X-Propagation
Outline
• Introduction
• Background
– Sources of X in RTL
– Ambiguous RTL Constructs
– Existing Solutions We are here !
• X-Propagation Technology
– Introduction
– T-Merge/X-Merge
– Results
• Conclusions
28
X-Propagation
Existing Solutions
Solutions
Gate Level Simulation
RTL Coding Guidelines
Static X Randomization
Dynamic X Randomization
X-Propagation Technology
29
X-Propagation
Existing Solutions (1)
Gate Level Simulation
30
X-Propagation
Existing Solutions (1)
Gate Level Simulation
0
0
A=1 D=1
1
1
When A=1,
D=1
1
1
A=0 D=1
0
0
When A=0,
still D=1
34
X-Propagation
Existing Solutions (2)
RTL Coding Guidelines
35
X-Propagation
Existing Solutions (2)
RTL Coding Guidelines
Construct Rule
IF / ELSE Replace with ternary operator ? :
CASE Default always assigns Xs to outputs
RTL X Assignment Don‟t optimize output D.C. conditions
Ambiguous Edges
No specific coding guideline
Bit Selects
36
X-Propagation
Existing Solutions (2)
RTL Coding Guidelines
External IP Internal IP
Components Components
Legacy
Designs
New Design
DUT
DUT
PLI 0 1 1
Initial: 0
00000
IF (node===X) THEN
XXXXX XXXXXXX
node = RAND();
0 XX
0000000
Test-bench
38
X-Propagation
Existing Solutions (3)
Static X Randomization
Simulator
DUT
DUT
PLI 0 1 1
Initial: 0
00000
IF (node===X) THEN
00110 0110001
node = RAND();
0 01
0000000
• At start of simulation, randomly
replace Xs with 0s or 1s
Test-bench
39
X-Propagation
Existing Solutions (3)
Static X Randomization
Simulator
DUT
DUT
PLI 0 1 1
Initial: 0
00000
IF (node===X) THEN
00110 0110001
node = RAND();
0 01
XXXXXX
• At start of simulation, randomly Protocol Error
replace Xs with 0s or 1s Violation Response
Test-bench
Testbench and RTL
! can re-introduce Xs!
40
X-Propagation
Existing Solutions (4)
Dynamic X Randomization
Simulator
DUT
DUT
PLI 0 1 1
0
Every clock: 00000
IF (node===X) THEN 00110 0110001
node = RAND(); 01
0
XXXXXX
41
X-Propagation
Existing Solutions (4)
Dynamic X Randomization
Simulator
DUT
DUT
PLI 0 1 1
0
Every clock: 00000
IF (node===X) THEN 00110 0110001
node = RAND(); 01
0
XXXXXX
42
X-Propagation
Existing Solutions (3,4)
Randomization Solutions
N state elements
43
X-Propagation
Existing Approaches
Solutions Issues
Gate Level Simulation Slow. Pessimistic
Labour intensive
RTL Coding Guidelines Partial solution
Difficult to enforce
Static X Randomization Partial solution
Limited state coverage
Dynamic X Randomization Slow
Limited state coverage
44
X-Propagation
Outline
• Introduction
• Background
– Sources of X in RTL
– Ambiguous RTL Constructs
– Existing Solutions
• X-Propagation Technology
– Introduction We are here !
– T-Merge/X-Merge
– Results
• Conclusions
45
X-Propagation
What is X-Propagation?
46
X-Propagation
What is X-Propagation?
IEEE 1800-2009
X-Propagation Semantics
Semantics
out <= 1’b1; out <= 1’bx;
X is masked. Correct.
Optimistic Still at RTL
behaviour X-Propagation
47
T-Merge and X-Merge
48
X-Propagation
T-Merge and X-Merge
Mode Behaviour
T-Merge Only yields X if branches diverge
X-Merge Always yields X if selector is X
49
X-Propagation
Sequentials
Clean and Maybe Edges
• Clean posedge : 01
• Maybe posedge : 0X, 0Z, X1, Z1
50
X-Propagation
Sequentials
Clean and Maybe Edges
• Clean posedge : 01
• Maybe posedge : 0X, 0Z, X1, Z1
merge
function
new previous
value value
maybe
posedge
52
X-Propagation
Invoking X-Propagation
53
X-Propagation
Invoking X-Propagation
Not quite ….
54
X-Propagation
Invoking X-Propagation
55
X-Propagation
Outline
• Introduction
• Background
– Sources of X in RTL
– Ambiguous RTL Constructs
– Existing Solutions
• X-Propagation Technology
– Introduction
– T-Merge/X-Merge
– Results We are here !
• Conclusions
56
X-Propagation
Experience with X-Propagation
57
X-Propagation
Experience with VCS X-Prop
59
X-Propagation
False Negatives (1)
Multi-Cycle Reconvergence
• X-Prop changes semantics of combinatorial logic
• Reconvergence issues remain across clocks
• One issue of this nature was found in our design
60
X-Propagation
False Negatives (1)
Multi-Cycle Reconvergence
• X-Prop changes semantics of combinatorial logic
• Reconvergence issues remain across clocks
• One issue of this nature was found in our design
62
X-Propagation
False Negatives (2)
Pessimistic Edges
• Modelling of flop with async reset:
always @( posedge clk or negedge resetN ) begin
if ( !resetN )
q <= 1’b0;
. . .
63
X-Propagation
DV Bug (1)
Assertion Qualification
mem_A_decoded = 1’b0;
mem_B_decoded = 1’b0;
casez (address)
8’b0??????? : mem_A_decoded = 1’b1;
8’b1??????? : mem_B_decoded = 1’b1;
endcase
64
X-Propagation
DV Bug (1)
Assertion Qualification
mem_A_decoded = 1’b0;
mem_B_decoded = 1’b0;
8’bxxxxxxx
casez (address)
8’b0??????? : mem_A_decoded = 1’b1;
8’b1??????? : mem_B_decoded = 1’b1;
endcase
mem_A_decoded = 1’b0; mem_B_decoded = 1’b0;
assert zero_one_hot( .test_expr{ mem_A_decoded,
mem_B_decoded } );
casez (address)
8’b0??????? : mem_A_decoded = 1’b1;
8’b1??????? : mem_B_decoded = 1’b1;
endcase
67
X-Propagation
DV Bug (2)
Incorrect Reset Modeling
Memory BIST
with
IF/ELSE construct
Before
68
X-Propagation
DV Bug (2)
Incorrect Reset Modeling
69
X-Propagation
Summary of Findings
Observation Number
False Negative : Multi-Cycle Reconvergence 1
False Negative : Pessimistic Handling of Edges 1
DV Bug : Assertion Qualification 1
DV Bug : Reset Modelling 1
Minor RTL Changes : Additional Resets 2
70
X-Propagation
Outline
• Introduction
• Background
– Sources of X in RTL
– Ambiguous RTL Constructs
– Existing Solutions
• X-Propagation Technology
– Introduction
– T-Merge/X-Merge
– Results
71
X-Propagation
Issues with Gate Simulation
72
X-Propagation
Proposed RTL X-Prop Methodology
73
X-Propagation
Proposed Future Work
• Multi-cycle reconvergence
– Can these be identified using formal or symbolic
simulation techniques?
• Standardization
– X-Prop Verilog semantics should be standardized
– Avoid divergence between different tools
74
X-Propagation
Comparison of Techniques
Simulation Style Accuracy of Human Effort Simulation
X Modelling to Debug Speed
“Plain” RTL Semantics Optimistic Low Fastest
Gate Simulation Statistical Medium Slow
with X Randomization
Gate Simulation Pessimistic High Slow
without X Randomization
RTL X-Propagation Slightly Medium Fast
Pessimistic
75
X-Propagation
Conclusions
76
X-Propagation
Acknowledgements
– Co-authors at Cisco
• Craig Forward, Julius Yam
77
X-Propagation
Thank You!
• Questions?
78
X-Propagation
Backup Slides
79
X-Propagation
Where do Xs Come From?
3. RTL Drives Xs
case (instruction)
`ADD : begin Simulator
alu_in1 <= add_op1;
alu_in2 <= add_op2; DUT
DUT
end
`SUB : begin
alu_in1 <= sub_op1; DC_OUTPUT <= ‘bx
alu_in2 <= sub_op2;
end
`NOOP : begin
alu_in1 <= ‘bx;
alu_in2 <= ‘bx;
end
endcase // instruction Test-bench
Simulator
add_op1
0
DUT
DUT
sub_op1
1
DC_OUTPUT <= ‘bx
instruction == `SUB
81
X-Propagation
Ambiguous RTL Constructs (2)
CASE STATEMENTS
reg state;
82
X-Propagation
Ambiguous RTL Constructs (2)
CASE STATEMENTS
IEEE 1800-2009
In a case_expression comparison, the
comparison only succeeds when each bit
matches exactly with respect to the values
0, 1, x, and z. As a consequence, care is
needed in specifying the expressions in the
case statement.
83
X-Propagation