whitebox approach for verifying pcie link training and status state machine

29
Whitebox Approach for Verifying PCIe Link Training and Status State Machine Pinal Patel, Gaurang Chitroda eInfochips Ltd Colm McSweeney Synopsys Ltd September 23, 2014 SNUG Austin

Upload: einfochips

Post on 14-Jun-2015

1.143 views

Category:

Technology


10 download

DESCRIPTION

Serial communication protocols like PCI Express and USB have evolved to enable high operating speeds. This evolution has resulted in their PHY Layer protocol growing in complexity, especially the Link Training and Status State Machines’ (LTSSM's) logic. The top-level DUT behaviour does not reveal if the LTSSM functionality was correct and whether it hit the expected state transitions properly.

TRANSCRIPT

Page 1: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 1

Whitebox Approach for Verifying PCIe

Link Training and Status State

Machine

Pinal Patel, Gaurang Chitroda

eInfochips Ltd

Colm McSweeney

Synopsys Ltd

September 23, 2014

SNUG Austin

Page 2: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 2

Agenda

LTSSM Testbench Architecture

Introduction

Rx PIPE Agent & Error Stimulus Generation

Coverage & Debug Features

Results & Summary

Page 3: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 3

Introduction

LTSSM Testbench Architecture

Introduction

Rx PIPE Agent & Error Stimulus Generation

Coverage & Debug Features

Results & Summary

Page 4: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 4

Introduction

• Increasing speed demand resulted in complexity of Serial

Protocols like PCIe , USB over years

– Physical Layer has become more and more complex

• Link Training & Status State Machine (LTSSM) becomes complex

Page 5: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 5

Introduction (Cont.)

LTSSM Location

Physical Layer

Transmit Receive

Data Link Layer

Transaction Layer

Port

Link Training

(LTSSM)

Software Layer

Page 6: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 6

Introduction (Cont.)

Main State Diagram of LTSSM

Loopback

Disabled

Detect

Polling

L0

L0s L1

L2

Initial State or Directed

by Data Link Layer

Recovery

Config Hot Reset

Page 7: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 7

CONFIG

RCVRY

SPEED

RCVRY

EQ1

RCVRY

CFG

RCVRY

LOCK

RCVRY

EQ0

DETECT

• 8 consecutive TS2 OSs are received on all

configured Lanes with the same Link and

Lane numbers that match what is being

transmitted on those same Lanes, &

• the speed_change bit is equal to the

directed_speed_change variable and the

EC field is 00b in all the consecutive TS1

Ordered Sets if the current data rate is 8.0

GT/s.

• 8 consecutive TS1 OSs are received on all

configured Lanes with the same Link and

Lane numbers that match what is being

transmitted on those same Lanes, &

• the speed_change bit is equal to the

directed_speed_change variable and the

EC field is 00b in all the consecutive TS1

Ordered Sets if the current data rate is 8.0

GT/s.

Introduction (Cont.)

State Diagram of Recovery Lock Sub State

Page 8: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 8

RCVRY

SPEED

CONFIG

RCVRY

EQ1

RCVRY

CFG

RCVRY

LOCK

RCVRY

EQ0

DETECT

Introduction (Cont.)

Possible Test cases:

1) Directed Speed change = Speed change bit with 7

Good TS OS and 1 corrupted (Directed Speed change !=

Speed change) TS OS with All Lane condition.

2) 4 Good TS OS and 4 Bad TS OS for All Lane condition.

3) Repeat 1st and 2nd for Any Lane condition.

4) Corrupt Symbol 6 to break the persistency.

5) Lane Number not equal to the configure Lane number.

6) Link Number not equal to the configure Link number.

7) For Gen3 data rate EC is not equal to zero.

8) For Gen3 data Rate Corrupt Symbol 9.

9) Insert SKIP, EIOS between TS OS’s and check the

persistency is break or not.

10) Inject Missing Comma error in TS OSs..

11) Corrupt the Data Rate ID. (i.e. bit for Gen3 = 1 and

Gen2 =0 )

All above test cases are with ALL Lane / ANY Lane

condition and also with Differnt Error Distribution (i.e. 7-1 ,

4-4 ) .

• 8 consecutive TS1 OSs are received on all

configured Lanes with the same Link and

Lane numbers that match what is being

transmitted on those same Lanes, & the

speed_change bit is equal to the

directed_speed_change variable and the EC

field is 00b in all the consecutive TS1 Ordered

Sets if the current data rate is 8.0 GT/s.

Page 9: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 9

Introduction (Cont.)

• Modeling of LTSSM becomes very critical and important

– Need for LTSSM White Box(WB) reference model

– Generation of Stimulus , Error Injection and Coverage

• This WB approach is not just limited to the LTSSM, but

can be re-purposed to verify any other complex state

machine

Page 10: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 10

LTSSM Test bench Architecture

Introduction

LTSSM Test bench Architecture

Rx PIPE Agent & Error Stimulus Generation

Coverage & Debug Features

Results & Summary

Page 11: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 11

DUT

Top Env

(uvm_env)

LTSSM WB Env

(uvm_env)

LTSSM Testbench Architecture

PIP

E R

x inte

rface

PIP

E S

tatu

s inte

rface

Remote

Link

Partner Register

Shadow model

DUT State

Monitor

(uvm_monitor)

WB Emulation Model (uvm_component)

Current WB State (uvm_object)

Pipe Rx

Agent

(uvm_

agent)

Lane (N-1) PIPE Monitor

Registers LTSSM

PIPE Rx Interface

PIP

E T

x inte

rface

PIP

E C

om

mand inte

rface

PIPE Tx Interface

Lane 2 PIPE Monitor

Lane 1 PIPE Monitor

Lane 0 PIPE Monitor

(uvm_monitor)

Page 12: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 12

base_state

emulated_state

previous_state

tx_pattern_matched

rx_pattern_matched

timer

dut_state_transition

wb_state_transition

base_state Variables

stat_ltssm_vars[*]

timeout_queue[$]

valid_next_state[$]

valid_reasons[$]

TX_OS [NL] [$]

RX_OS [NL] [$]

base_state Methods

pipe_rx_status_update (lane,t)

pipe_tx_cmd_update (lane,t)

txos(lane,os) timer_update()

rxos(lane,os) timer()

timer_expired()

start()

dut_state_transition()

wb_state_transition()

Rcvry_Lock

L0

• RCVRY_CFG

• RCVRY_SPEED

• CONFIGURATION

• RCVRY_EQ0

• RCVRY_EQ1

• DETECT

• Rcvry_Cfg:

RCVD_8_TS1_SPEED_CHANGE_BIT_EQUA

L_DIRECTED_SPEED_EC_0_ALL_LANES.

RCVD_8_TS2_SPEED_CHANGE_BIT_EQU

AL_DIRECTED_SPEED_EC_0_ALL_LANES

TIMEOUT_24MS_AND_RCVD_8_TS1_SPE

ED_CHANGE_BIT_1_GEN2_ANY_LANES

• Detect :

TIMEOUT_24MS

LTSSM WB Base State

LTSSM Testbench Architecture (Cont.)

Page 13: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 13

LTSSM Wb Component

LTSSM WB Base State (Contd.)

RCVD_8_TS1_SPEED_CHANGE_

BIT_EQUAL_DIRECTED_SPEED_

EC_0_ALL_LANES.

WB transition to Rcvry.Rcvr.Cfg

wb_state_transition = 1

rxos()

txos()

rxstatus()

txcmd()

Fro

m P

ipe M

onitor(

s)

From DUT

State Monitor

DUT transition to Rcvry.Rcvr.Cfg

dut_state_transition = 1

Emulated State Update

Recovry

Lock

Recovery

RcvrCfg State Transition

Validity Check √

LTSSM Testbench Architecture (Cont.)

Page 14: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 14

LTSSM Wb Component

LTSSM WB Base State (Contd.)

RCVD_8_TS1_SPEED_CHANGE_

BIT_EQUAL_DIRECTED_SPEED_

EC_0_ALL_LANES.

WB transition to Rcvry.Rcvr.Cfg

wb_state_transition = 0

rxos()

txos()

rxstatus()

txcmd()

Fro

m P

ipe M

onitor(

s)

From DUT

State Monitor DUT transition to Rcvry.Speed

dut_state_transition = 1

Recovery

Lock State Transition

Validity Check X

LTSSM Testbench Architecture (Cont.)

Page 15: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 15

Rx PIPE Agent & Error Stimulus Generation

Introduction

Rx PIPE Agent & Error Stimulus Generation

LTSSM Test bench Architecture

Coverage & Debug Features

Results & Summary

Page 16: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 16

DUT

Top Env

(uvm_env)

LTSSM WB Env

(uvm_env)

Rx PIPE Agent & Error Stimulus Generation

PIP

E R

x inte

rface

PIP

E S

tatu

s inte

rface

Remote

Link

Partner Register

Shadow model

DUT State

Monitor

(uvm_monitor)

WB Emulation Model (uvm_component)

Current WB State (uvm_object)

Lane (N-1) PIPE Monitor

Registers LTSSM

PIPE Rx Interface

PIP

E T

x inte

rface

PIP

E C

om

mand inte

rface

PIPE Tx Interface

Lane 2 PIPE Monitor

Lane 1 PIPE Monitor

Lane 0 PIPE Monitor

(uvm_monitor)

Pipe Rx

Agent

(uvm_

agent)

Page 17: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 17

TS1 OS

BC 05 00 0F 8E 00 4a 4a 4a 4a 4a 4a 4a 4a 4a 4a

Symbol 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

PIPE Rx Agent

MAC PIPE Rx

Agent Driver

PIPE Rx Agent

Monitor

PIPE Rx Agent Queue

PIPE

I/F

PIPE

I/F Callback

PHY

00

MISSING COMMA

Rx PIPE Agent & Error Stimulus Generation

Page 18: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 18

How Rx PIPE Agent helps generating corner case scenarios?

DUT

(RcvryLock)

WB

(RcvryLock)

DUT Rx Counter

WB Rx Counter

0

0

DUT Rx Queue

WB Rx Queue

Rx Pipe

Agent

BC 05 00 0F 8E 00 4a 4a 4a 4a 4a 4a 4a 4a 4a 4a

BC 05 00 0F 8E 00 8a 4a 4a 4a 4a 4a 4a 4a 4a 4a

1

1

2

2

3

3

4

4

5

5 6

6 7

7

DUT

(RcvryCfg)

Good TS1 Good TS1

TS

1

TS

1

TS

1

TS

1

Good TS1 Good TS1

TS

1

TS

1

TS

1

Good TS1 Good TS1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

Good TS1 Good TS1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

0

8

Good TS1 Good TS1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

Good TS1 Good TS1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

Good TS1 Good TS1 BAD TS1 BAD TS1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

TS

1

Corrupt Symbol 6

ERROR !!!

Rx PIPE Agent & Error Stimulus Generation (Cont.)

Page 19: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 19

Coverage & Debug Features

Introduction

Coverage & Debug Features

LTSSM Test bench Architecture

Rx PIPE Agent & Error Stimulus Generation

Results & Summary

Page 20: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 20

Coverage & Debug Features

• Every LTSSM sub-states, create a verification plan, which

consists of the following coverage items

– All possible state transitions for the sub-state

– All possible state transition conditions/reasons for the sub-state

– Transmit rules for the sub-state

– Stimulus(Error Injection) coverage for the sub-state

– Boundry coverage for the sub-state

• Coverage plan for state transitions and state transition

conditions is extracted using a script from the emulated

WB state.

Page 21: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 21

Coverage & Debug Features (Cont.) All Possible State Transitions

coveragroup cg_ltssm_state_transitions

with function sample(dut_state tr);

cp_ltssm_state_transitions: coverpoint tr.e_current_state

{

bins lock_to_rcfg = (RCVRY_LOCK => RCVRY_RCVR_CFG);

bins lock_to_speed = (RCVRY_LOCK => RCVRY_SPEED);

bins lock_to_eq0 = (RCVRY_LOCK => RCVRY_EQ0);

bins lock_to_eq1 = (RCVRY_LOCK => RCVRY_EQ1);

bins lock_to_cfg = (RCVRY_LOCK => CFG_LINKWD_START);

bins lock_to_detect = (RCVRY_LOCK => DETECT_QUIET);

}

endgroup : cg_ltssm_state_transitions

Config

Rcvry

Speed

Rcvry

EQ1

Rcvry

Cfg

Rcvry

Lock

Rcvry

EQ0

Detect

Config

Rcvry

Speed

Rcvry

EQ1

Rcvry

Cfg

Rcvry

Lock

Rcvry

EQ0

Detect

Page 22: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 22

covergroup cg_ltssm_wb (ref base_state state) with function sample(base_state tr); cp_reason : coverpoint tr.reason { bins valid_reason[] = cp_reason with ( validate_reasons(e_transition_code'(item), state) ); } cp_expected_state : coverpoint tr.wb_expecte_state { bins valid_transition[] = cp_expected_state with ( validate_next_state(e_ltssm_state'(item), state) ); } cc_next_state_reason : cross cp_expected_state, cp_reason; endgroup : cg_ltssm_wb

Coverage & Debug Features (Cont.) All Possible State Transitions Reasons

Config

Rcvry

Speed

Rcvry

EQ1

Rcvry

Cfg

Rcvry

Lock

Rcvry

EQ0

Detect

Page 23: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 23

Coverage & Debug Features (Cont.) Transmit Rules

//Check link and lane numbers transmitted in

// recovery lock matching with Received TS1/TS2.

event check_rlock_ts1_link_lane_num;

property p_check_rlock_ts1_link_lane_num();

@(check_rlock_ts1_link_lane_num ) disable iff(!core_rst_n)

1==1;

endproperty : p_check_rlock_ts1_link_lane_num

cov_p_check_rlock_ts1_link_lane_num :

cover property( p_check_rlock_ts1_link_lane_num() );

if( sel_link_num==t.symbols[1] &&

sel_lane_num[lane]==t.symbols[2])

// Trigger event for cover property

->i_utbCovProp.check_rlock_ts1_link_lane_num;

else

`uvm_error(“RCVRY_LOCK”, $psprintf(“Failed check”)

Page 24: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 24

Coverage & Debug Features (Cont.) Boundary Coverage

cp_good_ts1 : coverpoint (cov_ts_pad_lane_num[TS1]==0 &&

cov_ts_pad_link_num[TS1]==0)

{

type_option.comment = "Covering a sequence where no

transition is expected.";

// 7 good TS1s followed by one bad TS1

bins seven_good = (1=>1=>1=>1=>1=>1=>1=>0 );

}

Page 25: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 25

Coverage & Debug Features (Cont.) Screenshot of Verification Plan XML output

Page 26: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 26

Coverage & Debug Features (Cont.) Transaction Logging

• Create a separate transaction log which would just log the

required transaction and displays within

• This log can be viewed within the waves along with the

design signals

• Helps reducing the debugging time as we can see the

design and model behaviour side by side

Page 27: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 27

Results & Summary

Introduction

Results & Summary

LTSSM Test bench Architecture

Rx PIPE Agent & Error Stimulus Generation

Coverage & Debug Features

Page 28: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 28

Results & Summary

• Once the model is stable after some initial efforts , it was

much easier and quicker to verify a complex design like

PCIe LTSSM

• With the approach presented in this paper we improved

the IP quality

• No. of tests are reduced to around 60 compared to 700

directed test cases

• Auto-extracted coverage reports give a very high level of

confidence that strict compliance is met

• This WB approach is not just limited to the LTSSM, but

can be re-purposed to verify any other complex state

machine

Page 29: Whitebox Approach for Verifying PCIe Link Training and Status State Machine

SNUG 2014 29

Thank You