boosting systemc-based testbenches with modern … · boosting systemc-based testbenches with...

13
Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, Rolf Drechsler University of Bremen, Germany © Accellera Systems Initiative 1

Upload: nguyenmien

Post on 18-Apr-2018

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Boosting SystemC-based Testbenches with Modern C++ and

Coverage-Driven GenerationHoang M. Le, Rolf Drechsler

University of Bremen, Germany

© Accellera Systems Initiative 1

Page 2: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Agenda

• Motivation

• State of the Art (for SystemC)

• Modern C++11 API incl. Coverage

• Coverage-driven Generation

• Wrap-up

© Accellera Systems Initiative 2

Page 3: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Motivation

• SystemC– IEEE 1666-2011

– C++ modeling @ multiple levels of abstraction

– Open-source reference simulator

• Verification of SystemC models– Constrained Random Verification Methodology (e.g. UVM for SystemC)

– Randomization (CRAVE or SCV)

– Coverage?

– Automated Coverage Closure?

© Accellera Systems Initiative 3

SystemC DUT

SystemC Testbench

Verification

Scenarios

ConstrainedRandomStimuli

Results

Checking

Coverage

Page 4: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

State of the Art (for SystemC)

• Randomization (CRAVE 2.0)– SystemVerilog-inspired syntax

– Random objects

– Random variables

– Hard/soft/distribution constraints

– Efficient constraint solving• SMT backends

• Constraint partitioning

– Still somewhat cumbersome syntax

© Accellera Systems Initiative 4

Page 5: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

State of the Art (for SystemC)

• Coverage (SCVX or SVM)

– SystemVerilog-inspired syntax

– Covergroups

– Coverpoints

– Coverbins

– Not expressive enough forcomplex coverage conditions

– No automated coverage closure

© Accellera Systems Initiative 5

Page 6: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Our proposed solution

• Using C++11 for more compact constraint syntax

• New coverage API connected to the expression layer of CRAVE 2.0

– For better expressiveness (same as of the constraint layer)

– Allow automated coverage closure / coverage-driven generation (coverage expression handled as a special type of constraint in the constraint solving process)

© Accellera Systems Initiative 6

Valid

Page 7: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Modern C++11 API incl. Coverage

• Constraint layer

• Automated creation of named object hierarchy

• C++11 allows in-place initialization

© Accellera Systems Initiative 7

Page 8: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Modern C++11 API incl. Coverage

• Coverage layer

• Example (verification of a SystemC TLM interrupt controller)

© Accellera Systems Initiative 8

Page 9: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Coverage-driven Generation

• Coverage sampling

• Results without CdG

© Accellera Systems Initiative 9

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

5 5 10 12 21 24 24 36 61 90 103 74 115 189 207

33 56 68 87 152 186 252 384 411 654 851 102614171716

252380 111 122 172 297 377 508 758 82312231587

22012844

3443

5097

Hits

Forwarded Interrupt

Coverpoint fwd_lvl_1

1000 stimuli 10000 stimuli 20000 stimuli

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

0 0 0 0 0 0 0 0 1 0 3 6 3 92

0 0 0 0 0 0 3 4 4 11 11

31 30 36

54

0 0 0 0 0 315

84

21 21

51 5362

119

Hits

Forwarded Interrupt

Coverpoint fwd_lvl_0

1000 stimuli 10000 stimuli 20000 stimuli

Page 10: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Coverage-driven Generation

• Manual coverage closure– Add more (distribution) constraints?

– Add more directed tests?

– Both highly non-trivial

• “Push-button” when constraint and coverage are connected!– Convert coverage expressions to constraint expressions

– In each generation pass• Pick one unsatisfied “coverage” constraint (i.e. uncovered bin), add to

the constraint set, then apply constraint solving

• If successful, marked the “coverage” constraint as satisfied, otherwise pick another unsatisfied and repeat

© Accellera Systems Initiative 10

Page 11: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Wrap-up

• CRAVE

– Open-source constrained random stimuli generator forSystemC/C++

– Powerful constraint solving technologies

– Frequently added new features, recently: modern C++11 API, coverage layer & coverage-driven generation

• What‘s next?

– Graph-based specification / Portable Stimulus

– UVM-SystemC Integration

© Accellera Systems Initiative 11

Page 12: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Acknowledgement

© Accellera Systems Initiative 12

This work was supported in part by the German Federal Ministry of Education and Research (BMBF) within the project EffektiVunder contract no. 01IS13022E and by the German Research Foundation (DFG) within the Reinhart Koselleck project DR 287/23-1.

Page 13: Boosting SystemC-based Testbenches with Modern … · Boosting SystemC-based Testbenches with Modern C++ and Coverage-Driven Generation Hoang M. Le, ... 0 3 4 4 11 11 31 30 36 54

Thanks for your time!Questions?

© Accellera Systems Initiative 13