Title: Partial Order Reduction for Scalable Testing of SystemC TLM Designs
1Partial Order Reduction for Scalable Testing of
SystemC TLM Designs
Sudipta Kundu, University of California, San
Diego Malay Ganai, NEC Laboratories
America Rajesh Gupta, University of California,
San Diego
2Hardware Design Methodology
S Y S T E M C
Architecture Level Transaction Level Model (TLM)
(Non-Synthesizable Subset)
Mostly Manual
Micro-architecture Level (Synthesizable Subset)
High Level Synthesis
Register Transfer Level (RTL)
3Outline
- Motivation
- Background
- SystemC Semantics
- Partial-order Reduction
- Our Approach
- Static Analysis
- Query-based Framework Satya
- Experiments
- Conclusion
4Semantics of SystemC
- C library
- Co-operatively Multitasking
- Asynchronous and Synchronous concurrency
- Variables
- Signals Blocking variables
- Non-signals Non-blocking variables
5Example Producer-Consumer
Global variables
int num 0 char data2 sc_event e
0
- Process C (bool flag)
- if (!flag)
- wait(e)
- c data--num
- wait(1, SC_NS)
- //local computation
- return
- Process P ()
- datanum A
- notify (e)
- wait(1, SC_NS)
- //local computation
- return
!flag
flag
C1
C3
2
C2
4
C4
6
Pi and Ci are atomic blocks
6Single Interleaving not enough ..
0
0
!flag
datanum A notify (e) wait(1, SC_NS)
flag
C1
wait(e)
P1
C3
2
c data--num wait(1, SC_NS)
C2
3
4
P2
C4
5
6
Input flag false
Problem 1
- SystemC scheduler is deterministic
- For given input it explores only one interleaving
Problem 2
Exponential number of possible interleavings
7Partial Order Reduction (POR)
- Reduces the interleaving that needs to be
searched - Exploits the commutative of concurrently executed
transitions.
t1 and t2 are commutative (independent) ? Explore
interleaving t1.t2 or t2.t1(not both)
- Concurrent Software Verification
- Static POR Godefroid 95
- Dynamic POR Flanagan 05
8Our Approach Overview
- Adapts POR techniques for SystemC TLM Designs
- Exploits SystemC specific semantics
- Co-operatively multitasking
- Wait to wait atomic block
- Notion of d-cycle
- Signal (blocking) variables
- We implemented a query-based framework
- Combines static and dynamic POR techniques
9Our Framework Satya
Intermediate Representation
SystemC Design
Static Analysis
Partial Order Information
Query Engine
Explore Engine
Modified SystemC Simulator
Explicit Stateless Model Checker
Satya
Satya is a Sanskrit word that translates into
English as "truth" or "correct."
10Static Analysis Basic Steps
- Get a control skeleton.
- Find out the wait boundaries (atomic blocks)
- Summarize static informations (Wns, Rns, Ws, Rs,
Notify, Wait) - Compute the dependence relation between atomic
blocks. (next slide)
ID Wns Rns Ws Rs Notify Wait
C1 - - - - - e
C2 num data, num - - - (1, SC_NS)
C3 num data, num - - - (1, SC_NS)
C4 - - - - - -
ns non signal s - signal
11Dependence Relation (D)
- Given two transitions (atomic blocks) t1 and t2,
(t1, t2) D if - A write on shared non-signal variable v in t1 and
a read or a write on the same variable v in t2.
(data dependency) -
- A write on a shared signal variable s in t1 and a
write on the same variable s in t2. (write-write
conflict) - A wait on an event e in t1 and an immediate
notification on the same event e in t2 (causal
dependency) - Special Case We consider symmetric writes
(increment, - decrement) on non-signals as independent.
OR
OR
12Dependence Relation Example
ID Wns Rns Ws Rs Notify Wait
A1 i - - - - e
A2 x - - s - -
ID Wns Rns Ws Rs Notify Wait
B1 - - s - e (1, SC_NS)
B2 i x - - - -
Dependent?
A1 A2
B1
B2
YES
NO
YES
NO
Query Table
13Our Explore Algorithm
Runnable Sleep Todo
lt P1 , C1 , C1, P1 , gt
Runnable Sleep Todo lt P1 , C1 ,
, gt
Runnable Sleep Todo lt P1 ,
C1 , C1 , P1gt
Runnable Sleep Todo lt P1
, C1 , C1 , gt
C1
P1
Scheduler State ltRunnable, Sleep,
Todogt Runnable Set Transitions enabled at the
state Sleep Set - Transitions that no longer need
to explore Todo Set - Transitions that will be
explored next
- Randomly execute an execution path till some
depth. - Analyze the path bottom up considering each
d-cycle separately. - If there exist a transition in (Todo \ Sleep)
then execute it from start (as our algorithm is
stateless).
P1
C1
C2
t
t
Runnable Sleep Todo lt P2 ,
C4 , P2 , gt
Runnable Sleep Todo lt P2 , C4 ,
, gt
P2
C4
Dependent?
P2
(3, 6)
C1 C2 C3 C4
P1 YES YES YES NO
P2 NO NO NO NO
Is ( P2, C4 ) Dependent?
Is ( P1, C1 ) Dependent?
C4
P2
(5, 6)
Execution Tree
Query Engine
14Our Contributions
- Commutative checks between the transitions are
not done across d-cycles (not required) - Low cost commutative checks
- No book-keeping for dynamic reads and writes
- Use pre-computed query table
- Conservative approach
- Independent transitions are precise, but not the
dependent ones - Dependent transitions identified statically are
most likely dependent - Large wait to wait atomic blocks
- Signal variables are commonly used
15Experiments and Results 1/2
- No POR Explore all execution paths
- POR Our Approach using POR
- Fifo Benchmark
- Open SystemC Initiative (OSCI) Repository
- Array Bound Violation (2 producer, 1 consumer)
Elements produced Total traces Time (no POR) (secmsec) Reduced traces Time (POR) (secmsec)
14 8 00046 6 00032
28 80 00469 42 00265
44 992 06344 318 02313
62 13376 93563 2514 19031
16Experiments and Results 2/2
- Transaction Accurate Communication Benchmark
(TAC) - ST Microelectronics
- 6 modules 2 traffic generators, 2 memories, 1
timer, 1 router - Static slicing of the router while testing for
deadlock
Transactions Total traces Time (no POR) (minsec) Reduced traces Time (POR) (minsec)
80000 12032 8947 1 0013
17Conclusion and Future Work
- We presented Satya, a query-based approach build
over SystemC Simulator - Compute and use static information efficiently
- We exploit SystemC specific semantics
- Reduces interleaving that are needed to explore
- Improve previous explore algorithm
- Avoids book-keeping cost
- Avoid dynamic commutative checks
- In future,
- We are working on intelligent test bench
generation
18THANK YOU