introducing the universal verification methodology (uvm...

24
1 © Fraunhofer IIS/EAS Karsten Einwich Fraunhofer IIS/EAS Martin Barnasconi NXP Semiconductors Thilo Vörtler Fraunhofer IIS/EAS Thomas Klotz Fraunhofer IIS/EAS NASCUG 2014 Introducing the Universal Verification Methodology (UVM) in SystemC and SystemC-AMS © Fraunhofer IIS/EAS Karsten Einwich NASCUG 2014 Introduction and Motivation Universal Verification Methodology (UVM) what is it? Why UVM in SystemC/C++/SystemC-AMS? UVM-SystemC overview UVM foundation elements UVM test bench and test creation Randomization and coverage Contribution to Accellera Applications and use cases of UVM-SystemC Summary and outlook Outline North American SystemC User's Group June 2, 2014 Presented during DAC 51 in San Francisco, CA Page 1 of 24

Upload: habao

Post on 18-May-2018

280 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

1

© Fraunhofer IIS/EAS

Karsten Einwich Fraunhofer IIS/EAS

Martin Barnasconi NXP Semiconductors

Thilo Vörtler Fraunhofer IIS/EAS

Thomas Klotz Fraunhofer IIS/EAS

NASCUG 2014

Introducing the Universal Verification Methodology (UVM) in SystemC and SystemC-AMS

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Introduction and Motivation n  Universal Verification Methodology (UVM) … what is it?

n  Why UVM in SystemC/C++/SystemC-AMS?

n UVM-SystemC overview n  UVM foundation elements

n  UVM test bench and test creation

n  Randomization and coverage

n Contribution to Accellera

n Applications and use cases of UVM-SystemC n Summary and outlook

Outline

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 1 of 24

Page 2: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

2

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Introduction and Motivation n  Universal Verification Methodology (UVM) … what is it?

n  Why UVM in SystemC/C++/SystemC-AMS?

n UVM-SystemC overview n  UVM foundation elements

n  UVM test bench and test creation

n  Randomization and coverage

n Contribution to Accellera

n Applications and use cases of UVM-SystemC n Summary and outlook

Outline

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Universal Verification Methodology facilitates the creation of modular, scalable, configurable and reusable test benches n Based on verification components with standardized interfaces

n Class library which provides a set of built-in features dedicated to simulation-based verification

n Utilities for phasing, component overriding (factory), configuration, comparing, scoreboarding, reporting, etc.

n Environment supporting migration from directed testing towards Coverage Driven Verification (CDV)

n  Introducing automated stimulus generation, independent result checking and coverage collection

Introduction: UVM - what is it?

4

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 2 of 24

Page 3: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

3

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n No structured nor unified verification methodology available for ESL design n UVM (in SystemVerilog) primarily targeting

block/IP level (RTL) verification, not system-level

n Porting UVM to SystemC/C++ enables

n creation of more advanced system-level test benches

n  reuse of verification components between system-level and block-level verification

n Target to make UVM truly universal, and not tied to a particular language

Motivation

5

*UVM-SystemC = UVM implemented in SystemC/C++

C++

SystemC-­‐AMSTLM SCV

UVM-­‐SystemC* -­‐AMS

Verification & ValidationMethodology

SystemC

-­‐AMS

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Strong need for a system-level verification methodology for embedded systems which include HW/SW and AMS functions

n SystemC is the recognized standard for system-level design, and needs to be extended with advanced verification concepts

n SystemC AMS available to cover the AMS verification needs

n Reuse tests and test benches across verification (simulation) and validation (HW-prototyping) platforms

n This requires a portable language like C++ to run tests on HW prototypes and even measurement equipment

n Enabling Hardware-in-the-Loop simulation or Rapid Control Prototyping

n Benefit from proven standards and reference implementations

n Leverage from existing methodology standards and reference implementations, aligned with best practices in verification

Why UVM in SystemC/C++ and SystemC-AMS?

6

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 3 of 24

Page 4: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

4

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Introduction and Motivation n  Universal Verification Methodology (UVM) … what is it?

n  Why UVM in SystemC/C++/SystemC-AMS?

n UVM-SystemC overview n  UVM foundation elements

n  UVM test bench and test creation

n  Randomization and coverage

n Contribution to Accellera

n Applications and use cases of UVM-SystemC n Summary and outlook

Outline

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC overview

8

UVM-­‐SystemC functionality StatusTest  bench  creation  with component  classes:agent,  sequencer,   driver,  monitor,  scoreboard, etc.

þ

Test  creation with  test,  (virtual)  sequences,   etc. þConfiguration  and  factory  mechanism þPhasing  and  objections þPolicies  to print,  compare,  pack, unpack,  etc. þMessaging and  reporting þRegister  abstraction  layer  and  callbacks developmentCoverage groups developmentConstrained randomization SCV  or  CRAVE

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 4 of 24

Page 5: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

5

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM layered architecture

9

Spec

Test  cases

Scenario

Signal

Test  casesTest

Functio

nal  coverage

Functional

Command Monitor

ScoreboardSequencer

Driver Monitor

Verification component

Verification environment (test bench)

Deviceunder test

Sequences

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC phasing

10

run

reset

configure main shutdown

connect   extract check report   final

UVM  runtime  phases »»

»»

UVM  common  phases

build

end_of_elaboration

start_of_simulation

pre-­‐reset post-­‐reset

»» =  SystemC  process(es)

� � � � � � � � �

��

=  top-­‐down  execution

=  bottom-­‐up  execution

Legend

before_end_of_elaboration* end_of_simulation*

=  SystemC-­‐only  callback*

Pre-run phases Runtime phases Post-run phases

n UVM phases are mapped on the SystemC phases

n UVM-SystemC supports the 9 common phases and the (optional) refined runtime phases

n Completion of a runtime phase happens as soon as there are no objections (anymore) to proceed to the next phase

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 5 of 24

Page 6: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

6

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Component responsible for driving and monitoring the DUT

n Typically contains three components

n Sequencer n Driver n Monitor

n Can contain analysis functionality for basic coverage and checking

n Possible configurations

n Active agent: sequencer and driver are enabled

n Passive agent: only monitors signals (sequencer and driver are disabled)

n C++ base class: uvm_agent

UVM agent

11

agent

driver monitor

sequencerconfig

seq_item_port

seq_item_export

item_collected_port

trans

seq

vifvif

analysis

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC agent (1) class  vip_agent  :  public  uvm_agent  {    public:      vip_sequencer<vip_trans>*  sequencer;        vip_driver<vip_trans>*        driver;      vip_monitor*                            monitor;            UVM_COMPONENT_UTILS(vip_agent)        vip_agent(  uvm_name  name  )        :  uvm_agent(  name  ),  sequencer(0),  driver(0),  monitor(0)  {}        virtual  void  build_phase(  uvm_phase&  phase  )      {          uvm_agent::build_phase(phase);            if  (  get_is_active()  ==  UVM_ACTIVE  )          {              sequencer  =  vip_sequencer<vip_trans>::type_id::create("sequencer",  this);              assert(sequencer);              driver  =  vip_driver<vip_trans>::type_id::create("driver",  this);              assert(driver);          }            monitor  =  vip_monitor::type_id::create("monitor",  this);          assert(monitor);      }  

Dedicated base class to distinguish agents from other component types

Registers the object in the factory

Call to the factory which creates and instantiates this component dynamically

NOTE: UVM-SystemC API under review – subject to change

agent

driver monitor

sequencerconfig

seq_item_port

seq_item_export

item_collected_port

trans

seq

vifvif

analysis

Essential call to base class to access properties of the agent

Children are instantiated in

the build phase

12

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 6 of 24

Page 7: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

7

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC agent (2)

   ...        virtual  void  connect_phase(  uvm_phase&  phase  )      {            if  (  get_is_active()  ==  UVM_ACTIVE  )          {              //  connect  sequencer  to  driver              driver-­‐>seq_item_port.connect(sequencer-­‐>seq_item_export);          }        }  };   Only the connection between sequencer

and driver is made here. Connection of driver and monitor to the DUT is done

via the configuration mechanism

13

agent

driver monitor

sequencerconfig

seq_item_port

seq_item_export

item_collected_port

trans

seq

vifvif

analysis

NOTE: UVM-SystemC API under review – subject to change

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n A UVM verification component (UVC) is an environment which consists of one or more cooperating agents

n UVCs or agents may set or get configuration parameters

n An independent test sequence is processed by the driver via a sequencer

n Each verification component is connected to the DUT using a dedicated interface

n C++ base class: uvm_env

UVM verification component

14

agent

driver monitor

sequencer

seq_item_port

seq_item_export

item_collected_port

UVM  verification component  (env)config

trans

seq

vifvif

config

analysis

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 7 of 24

Page 8: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

8

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  In this example, the UVM verification component (UVC) contains only one agent. In practice, more agents are likely to be instantiated

UVM-SystemC verification component

15

class  vip_uvc  :  public  uvm_env  {    public:      vip_agent*  agent;        UVM_COMPONENT_UTILS(vip_uvc);            vip_uvc(  uvm_name  name  )        :  uvm_env(  name  ),  agent(0)  {}        virtual  void  build_phase(  uvm_phase&  phase  )      {          uvm_env::build_phase(phase);            agent  =  vip_agent::type_id::create("agent",  this);          assert(agent);      }    };  

agent

driver monitor

sequencer

seq_item_port

seq_item_export

item_collected_port

UVM  verification component  (env)config

trans

seq

vifvif

config

analysis

A UVC is considered as a sub-environment in large

system-level environments

NOTE: UVM-SystemC API under review – subject to change

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVC with AMS driver and monitor using SystemC-AMS

n Regular UVM-SystemC drivers and monitors are used in which SystemC-AMS Timed Data Flow (TDF) modules are instantiated

n Factory overrides enable configuration of the UVC’s driver or monitor for specific AMS use cases

n For the SystemC-AMS modules, TDF ports are necessary to allow read / write operations to the analog interface

n The parent driver and monitor establish the connection from the TDF ports to the interface via the configuration mechanism

agent

driver monitor

sequencer

seq_item_port

seq_item_export

item_collected_port

UVM  verification component  (env)config

trans

seq

vifvif

config

analysis

AMS monitor

AMS driver

16

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 8 of 24

Page 9: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

9

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Sequences are part of the test scenario and define streams of transactions

n The properties (or attributes) of a transaction are captured in a sequence item

n Sequences are not part of the test bench hierarchy, but are mapped onto one or more sequencers

n Sequences can be layered, hierarchical or virtual, and may contain multiple sequences or sequence items

n Sequences and transactions can be configured via the factory

UVM sequences

17

transaction

transaction

transaction

sequence

seq

seq1

seq2

trans

trans

seq1

trans

trans

seq2

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC sequence item

class  vip_trans  :  public  uvm_sequence_item  {  

 public:  

   int  addr;  

   int  data;  

   bus_op_t  op;  

 

   UVM_OBJECT_UTILS(vip_trans);  

 

   vip_trans(  const  std::string&  name  =  "vip_trans"  )    

   :  addr(0x0),  data(0x0),  op(BUS_READ)  {}  

 

   virtual  void  do_print(  uvm_printer&  printer  )  const  {  ...  }  

   virtual  void  do_pack(  uvm_packer&  packer  )  const  {  ...  }  

   virtual  void  do_unpack(  uvm_packer&  packer  )  {  ...  }  

   virtual  void  do_copy(  const  uvm_object*  rhs  )  {  ...  }  

   virtual  bool  do_compare(  const  uvm_object*  rhs  )  const  {  ...  }  

};  

Transaction defined as

sequence item User-defined data items

(randomization can be done using SCV or CRAVE)

A sequence item should implement all elementary member functions to print, pack, unpack, copy and compare the

data items

(there are no field macros in UVM-SystemC )

18

agent

driver monitor

sequencer

seq_item_port

seq_item_export

item_collected_port

trans

seq

vifvif

config

analysis

NOTE: UVM-SystemC API under review – subject to change

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 9 of 24

Page 10: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

10

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC sequence

19

template  <typename  REQ  =  uvm_sequence_item,  typename  RSP  =  REQ>  class  sequence  :  public  uvm_sequence<REQ,RSP>  {    public:      sequence(  const  std::string&  name  )            :  uvm_sequence<REQ,RSP>(  name  )  {}        UVM_OBJECT_PARAM_UTILS(sequence<REQ,RSP>);          virtual  void  pre_body()  {          if  (  starting_phase  !=  NULL  )                starting_phase-­‐>raise_objection(this);      }          virtual  void  body()  {          REQ*  req;          RSP*  rsp;          ...          start_item(req);          //  req-­‐>randomize();            finish_item(req);          get_response(rsp);      }        virtual  void  post_body()  {          if  (  starting_phase  !=  NULL  )  starting_phase-­‐>drop_objection(this);      }  };  

A sequence contains a request and (optional) response, both

defined as sequence item

Compatibility layer to SCV or CRAVE not yet available

Optional: get response

Factory registration supports template classes

Raise objection if there is no parent sequence

NOTE: UVM-SystemC API under review – subject to change

agent

driver monitor

sequencer

seq_item_port

seq_item_export

item_collected_port

trans

seq

vifvif

config

analysis

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n A test bench is the environment which instantiates and configures the UVCs, scoreboard, and (optional) virtual sequencer

n The test bench connects

n Agent sequencer(s) in each UVC with the virtual sequencer (if defined)

n Monitor analysis port(s) in each UVC with the scoreboard subscriber(s)

n Note: The driver and monitor in each agent connect to the DUT using the interface stored in the configuration database

n C++ base class: uvm_env

UVM environment (test bench)

20

Testbench  (env) config

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf

scoreboardSubscr

2evalSubscr1

conf

virtualsequencer

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 10 of 24

Page 11: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

11

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC test bench (1)

21

class  testbench  :  public  uvm_env  {    public:      vip_uvc*                uvc1;      vip_uvc*                uvc2;      virt_sequencer*  virtual_sequencer;      scoreboard*          scoreboard1;        UVM_COMPONENT_UTILS(testbench);        testbench(  uvm_name  name  )        :  uvm_env(  name  ),  uvc1(0),  uvc2(0),            virtual_sequencer(0),  scoreboard1(0)  {}        virtual  void  build_phase(  uvm_phase&  phase  )      {          uvm_env::build_phase(phase);            uvc1  =  vip_uvc::type_id::create("uvc1",  this);          assert(uvc1);          uvc2  =  vip_uvc::type_id::create("uvc2",  this);          assert(uvc2);            set_config_int("uvc1.*",  "is_active",  UVM_ACTIVE);          set_config_int("uvc2.*",  "is_active",  UVM_PASSIVE);            ...  

Definition of active or passive UVCs

All components in the test bench will be

dynamically instan-tiated so they can be

overidden by the test if needed

NOTE: UVM-SystemC API under review – subject to change

Testbench  (env) config

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf

scoreboardSubscr

2evalSubscr1

conf

virtualsequencer

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC test bench (2)

22

         ...          virtual_sequencer  =  virt_sequencer::type_id::create(                                                      "virtual_sequencer",  this);          assert(virtual_sequencer);                    scoreboard1  =                scoreboard::type_id::create("scoreboard1",  this);          assert(scoreboard1);      }          virtual  void  connect_phase(  uvm_phase&  phase  )      {          virtual_sequencer-­‐>vip_seqr  =  uvc1-­‐>agent-­‐>sequencer;            uvc1-­‐>agent-­‐>monitor-­‐>item_collected_port.connect(              scoreboard1-­‐>xmt_listener_imp);            uvc2-­‐>agent-­‐>monitor-­‐>item_collected_port.connect(              scoreboard1-­‐>rcv_listener_imp);      }    };  

Analysis ports of the monitors are connected to

the scoreboard subscribers (listeners)

Virtual sequencer points to UVC sequencer

Testbench  (env) config

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf

scoreboardSubscr

2evalSubscr1

conf

virtualsequencer

NOTE: UVM-SystemC API under review – subject to change

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 11 of 24

Page 12: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

12

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Each UVM test is defined as a dedicated C++ test class, which instantiates the test bench and defines the test sequence(s)

n Reuse of tests and topologies is possible by deriving tests from a test base class

n The UVM configuration and factory concept can be used to configure or override UVM components, sequences or sequence items

n C++ base class: uvm_test

UVM test

23

Testbench (env)

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf conf

config

virtualsequencer

scoreboardSubscr

2ref

modelSubscr

1

Test configdefaultsequence

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC test (1)

24

class  test  :  public  uvm_test  {    public:      testbench*  tb;      bool  test_pass;        test(  uvm_name  name  )  :  uvm_test(  name  ),            tb(0),  test_pass(true)  {}        UVM_COMPONENT_UTILS(test);        virtual  void  build_phase(  uvm_phase&  phase  )      {          uvm_test::build_phase(phase);          tb  =  testbench::type_id::create("tb",  this);          assert(tb);            uvm_config_db<uvm_object_wrapper*>::set(  this,            tb.uvc1.agent.sequencer.run_phase",  "default_sequence",            vip_sequence<vip_trans>::type_id::get());    }              set_type_override_by_type(  vip_driver<vip_trans>::get_type(),              new_driver<vip_trans>::get_type()  );                  ...  

Factory method to override the original driver with a new driver

Testbench (env)

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf conf

config

virtualsequencer

scoreboardSubscr

2ref

modelSubscr

1

Test configdefaultsequence

Configuration of the default sequence, which will be executed on the sequencer

of the agent in UVC1

The test instantiates the required test bench

Specific class to identify the test objects for execution in the

sc_main program

NOTE: UVM-SystemC API under review – subject to change

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 12 of 24

Page 13: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

13

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC test (2)

25

   ...        virtual  void  run_phase(  uvm_phase&  phase  )      {          UVM_INFO(  get_name(),                "**  UVM  TEST  STARTED  **",  UVM_NONE  );      }        virtual  void  extract_phase(  uvm_phase&  phase  )      {          if  (  tb-­‐>scoreboard1.error  )              test_pass  =  false;      }        virtual  void  report_phase(  uvm_phase&  phase  )      {          if  (  test_pass  )              UVM_INFO(  get_name(),  "**  UVM  TEST  PASSED  **",  UVM_NONE  );              else                  UVM_ERROR(  get_name(),  "**  UVM  TEST  FAILED  **"  );      }  };  

Report results in the report phase

Testbench (env)

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf conf

config

virtualsequencer

scoreboardSubscr

2ref

modelSubscr

1

Test configdefaultsequence

Get result of the scoreboard in the extract phase

NOTE: UVM-SystemC API under review – subject to change

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n The top-level (e.g. sc_main) contains the test(s) and the DUT

n The interface to which the DUT is connected is stored in the configuration database, so it can be used by the UVCs to connect to the DUT

n The test to be executed is either defined by the test class instantiation or by the argument of the member function run_test

The main program (top-level)

26

DUT

top  (sc_main)

Testbench (env)

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf conf

config

virtualsequencer

scoreboardSubscr

2ref

modelSubscr

1

Test configdefaultsequence

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 13 of 24

Page 14: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

14

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

int  sc_main(int,  char*[])    {            dut*  my_dut  =  new  dut("my_dut");        vip_if*  vif_uvc1  =  new  vip_if;      vip_if*  vif_uvc2  =  new  vip_if;            uvm_config_db<vip_if*>::set(0,  "*.uvc1.*",                                                                "vif",  vif_uvc1);      uvm_config_db<vip_if*>::set(0,  "*.uvc2.*",                                                                "vif",  vif_uvc2);          my_dut-­‐>in(vif_uvc1-­‐>sig_a);      my_dut-­‐>out(vif_uvc2-­‐>sig_a);        run_test("test");        sc_start();        return  0;  }  

UVM-SystemC main program

27

Instantiate the DUT and interfaces

Register the test to be executed. This function

also dynamically instantiates the test if

given as argument

Connect DUT to the interface

register interface using the configuration

database

DUT

top  (sc_main)

Testbench (env)

…..agentUVC1 (env)

MonDrv

Sqr

agentUVC2 (env)

MonDrv

Sqrconf conf

config

virtualsequencer

scoreboardSubscr

2ref

modelSubscr

1

Test configdefaultsequence

NOTE: UVM-SystemC API under review – subject to change

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Available constrained randomization libraries for SystemC n SystemC Verification Library (SCV)

n Constrained Random Verification Environment (CRAVE)

n Both APIs differ from the SystemVerilog constrained randomization API

n Preference to have aligned API across these different languages

n UVM-SystemC therefore introduces a “compatibility layer” for constrained randomization with UVM/SystemVerilog “Look & Feel”

n  Introduction of dedicated randomization variables and constraint objects, randomize() method, etc.

n To be proposed as SCV language and library extension to Accellera

n Proof-of-concept implemented using CRAVE library

Constrained randomization in UVM-SystemC

28

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 14 of 24

Page 15: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

15

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

Example: Constrained randomization in UVM-SystemC

29

class  simplesum  :  public  scvx_rand_object  {    public:        scvx_rand<  int  >  x,  y,  z;      scvx_constraint  c1;        simplesum(  scvx_name  name  )      :  x("x"),            y("y"),            z("z"),          c1("c1")        {          c1(  z()  ==  x()  +  y()  );      }        void  print_result()  const      {          cout  <<  name()  <<  ":  "                      <<  z  <<  "  ==  "  <<  x                      <<  "  +  "  <<  y  <<  endl;      }    };  //  class  simplesum    

int  sc_main(int,  char*[])  {      bool  result;        simplesum  s("simplesum");        result  =  s.randomize();        if  (result)          s.print_result();      else          cout  <<  "No  solution  found."  <<  endl;          result  =  s.randomize_with(                                  s.y()  >  10  &&  s.x()  ==  8  );        if  (result)          s.print_result();      else          cout  <<  "No  solution  found."  <<  endl;  }  

Randomization object

Implementation of constraint

Optional: Assign user-defined

names to variables and constraints

Randomize variables

Inline constraints

NOTE: UVM-SystemC API under review – subject to change

Define variable(s) to be randomized and

the constraint(s)

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n No standardized functional coverage API in SystemC available

n Proprietary/commercial SystemC coverage APIs available, but not offered (yet) for standardization

n  Introduction of a functional coverage API for UVM-SystemC with UVM/SystemVerilog “Look & Feel”

n To be proposed as SCV language and library extension to Accellera

n Proof-of-concept implementation offers:

n Coverage of variables (supports data types sc_bv, integer, and bool)

n Automatic as well as user-defined coverage bins

n Associate bins with sets of values (called multi-value bins)

n Specialized bins (e.g. to ignore values, illegal values, etc)

n Optional directives to control coverage collection and reporting

Functional coverage in UVM-SystemC

30

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 15 of 24

Page 16: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

16

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

Example: Functional coverage in UVM-SystemC (1)

31

class  cg  :  public  scvx_covergroup  {    public:      scvx_coverpoint  cp_m;      scvx_coverpoint  cp_n;        cg(  scvx_name  name,  int&  m,  int&  n  )      :  cp_m(  "cp_m",  m  ),          cp_n(  "cp_n",  n  )      {          option.auto_bin_max  =  16;            cp_m.bins("bin_a")  =  list_of(4,    0,  1,  2,  3  );          cp_m.bins("bin_b")  =  list_of(4,    4,  5,  6,  7  );                  cp_m.ignore_bins("ignore_bins_m")  =  6;          cp_n.ignore_bins("ignore_bins_n")  =  13;      }    };  

int  sc_main(int,  char*[])  {      int  m;        int  n;          int  stimuli_m[]  =  {  3,  5,  6,  5,  3,  6,  5,                                              5,  3,  3  };      int  stimuli_n[]  =  {  13,  1,  6,  3,  16,  12,                                                8,  3,  13,  3  };        cg  cg_inst("cg_inst",  m,  n);        for  (int  i  =  0;  i  <  10;  i++)      {          m  =  stimuli_m[i];          n  =  stimuli_n[i];            cg_inst.sample();      }        cg_inst.report();        return  0;  }  

Creation of single-value bins

Specialized bins to ignore values

Ability to set maximum for

automatic bins

Covergroup contains two coverpoints

Triggers the coverage sampling

Report coverage results

Instantiate covergroup

Variables to be covered

NOTE: UVM-SystemC API under review – subject to change

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

Example: Functional coverage in UVM-SystemC (2)

32

$ ./test.exe

Covergroup: cg_inst

----------------------------------------

VARIABLE Expected Covered Percent

----------------------------------------

cp_m 7 2 28.57

cp_n 15 5 33.33

----------------------------------------

TOTAL: 22 7 31.82

----------------------------------------

coverpoint: cp_m

---------------------------

Name Percent Hitrate

---------------------------

bin_a[0] 0 0

bin_a[1] 0 0

bin_a[2] 0 0

bin_a[3] 100 4

bin_b[4] 0 0

bin_b[5] 100 4

bin_b[7] 0 0

---------------------------

coverpoint: cp_n

---------------------------

Name Percent Hitrate

---------------------------

auto[0] 100 0

auto[1] 100 1

auto[2] 0 0

auto[3] 100 3

auto[4] 0 0

auto[5] 0 0

auto[6] 100 1

auto[7] 0 0

auto[8] 100 1

auto[9] 0 0

auto[10] 0 0

auto[11] 0 0

auto[12] 100 1

auto[14] 0 0

auto[15] 0 0

--------------------------- Value 6 will be ignored

Value 13 will be ignored

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 16 of 24

Page 17: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

17

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Introduction and Motivation n  Universal Verification Methodology (UVM) … what is it?

n  Why UVM in SystemC/C++/SystemC-AMS?

n UVM-SystemC overview n  UVM foundation elements

n  UVM test bench and test creation

n  Randomization and coverage

n Contribution to Accellera

n Applications and use cases of UVM-SystemC n Summary and outlook

Outline

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n Objective: seek further industry support and standardization of UVM-SystemC

n UVM-SystemC contribution to Accellera Verification WG

n UVM-SystemC Language Reference Manual (LRM)

n UVM-SystemC Proof-of-Concept implementation, released under Apache 2.0 license

n Align with SCV and Multi-Language requirements and future developments

Contribution to Accellera

34

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 17 of 24

Page 18: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

18

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Introduction and Motivation n  Universal Verification Methodology (UVM) … what is it?

n  Why UVM in SystemC/C++/SystemC-AMS?

n UVM-SystemC overview n  UVM foundation elements

n  UVM test bench and test creation

n  Randomization and coverage

n Contribution to Accellera

n Applications and use cases of UVM-SystemC n Summary and outlook

Outline

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Enables new use cases

n  New re-use scenarios

n  IP protected, language and simulator independent verification IP

n  Enables System-level UVM based verification

n  Simplifies development of UVM based verification methods for AMS systems

Applications and use cases of UVM-SystemC

36

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 18 of 24

Page 19: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

19

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

Re-use across Languages, Simulators, Abstraction Levels

37

Testbench  (env)  

….. agent  UVC1 (env)

Mon  Drv  

Sqr  

agent  UVC2 (env)

Mon  Drv  

Sqr  conf   conf  

config  

virtual  sequencer  

scoreboard Subscr  

2  ref  

model  Subscr  

1  

Test   config  default sequence

DUT  -­‐  VHDL  

AMS   DIG   SW  in

out DUT  -­‐  Verilog  

AMS   DIG   SW  in

out DUT  -­‐  SystemC  

AMS   DIG   SW  in

out DUT  -­‐  Matlab  

AMS   DIG   SW  in

out …

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

download

monitor integrate

DUT  

Testbench  (env)  

agent  UVC1 (env)

Driver  SystemC  

config  

virtual  sequence

r  

scoreboard Subscr  

2  ref  

model  Subscr  

1  

Test  

SimulaIon  -­‐  SystemC  

config  default sequence

SystemC  -­‐  Behavioral    

vif  

agent  UVC2 (env)

Monitor  SystemC  

vif  

Source: ZedBoard.org

DUT  

Testbench  (env)  

agent  UVC1 (env)

Driver  EmulaIon  

config  

virtual  sequence

r  

scoreboard Subscr  

2  ref  

model  Subscr  

1  

Test  

Real  Time  Hardware  

config  default sequence

FPGA  -­‐  EmulaIon    

vif  

agent  UVC2 (env)

Monitor  EmulaIon  

vif  

Source: ZedBoard.org

DUT  

Testbench  (env)  

agent  UVC1 (env)

Driver  Lab  equip  

config  

virtual  sequence

r  

scoreboard Subscr  

2  ref  

model  Subscr  

1  

Test  

Real  Time  Hardware  

config  default sequence

ASIC  –  1st    Silicon  

vif  

agent  UVC2 (env)

Monitor  Lab  equip  

vif  

Zynq Board (FPGA + ARM)

Re-use for emulation and lab validation

38

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 19 of 24

Page 20: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

20

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

UVM-SystemC Codegeneration

39

class  vip_agent  :  public  uvm_agent  {    public:      vip_sequencer<vip_trans>*  sequencer;        vip_driver<vip_trans>*        driver;      vip_monitor*                            monitor;            UVM_COMPONENT_UTILS(vip_agent)        vip_agent(  uvm_name  name  )        :  uvm_agent(  name  ),  sequencer(0),  driver(0),  monitor(0)  {}        virtual  void  build_phase(  uvm_phase&  phase  )      {          uvm_agent::build_phase(phase);            if  (  get_is_active()  ==  UVM_ACTIVE  )          {              sequencer  =  vip_sequencer<vip_trans>::type_id::create("sequencer",this);              assert(sequencer);              driver  =  vip_driver<vip_trans>::type_id::create("driver",  this);              assert(driver);          }            monitor  =  vip_monitor::type_id::create("monitor",  this);          assert(monitor);      }  

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  The UVM-SystemC infrastructure can also handle AMS verification

n  Transactions will program analog driver and monitors

n  Drivers generate analog signals, Monitors analyze analog signals and extracting properties like amplitude, spectrum, … and transfer them via transactions

n  AMS verification requires a tighter binding/synchronization to the time

n  Non-causalities due continuous signal behavior

n  AMS verification requires continuous distribution function (and not PWC only)

n  Randomization of DUT parameters is essential

UVM-SystemC-AMS

40

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 20 of 24

Page 21: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

21

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  UVM AMS extensions will not break the existing UVM

n  Time annotation to transaction

n  Decoupled sequence time

n  Data dependent synchronization

n  Introducing of a pre-build phase

n  Is executed before the DUT is instantiated

n  Permits the setting of parameter, which influence the DUT creation

n  Constraint randomization with continuous distribution function can be hardly realized

n  Constraints for AMS are usually much simpler

UVM-SystemC-AMS extensions

41

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

Vision

n  Translating specifications (documents, standards) to readable – also for non verification experts - test scenarios, this should also include ranges and uncertainties

n  No separation between analog/digital, hard- and software

n  “real” system-level verification

Main question: n  Will the system work for the purposes for which it will be built

UVM for System-level / Functional verification

42

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 21 of 24

Page 22: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

22

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  No executable reference model available

n  Complex stimulation and expected sequences

n  Coverage measure is different to implementation level

n  How much of the possible application scenarios, input stimuli, operating conditions, specification items are verified?

àà UVM methodology/best practices have to be extended for system level! àà UVM framework is generic enough to realize the required extensions!

Challenges for UVM System-level

43

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  Introduction and Motivation n  Universal Verification Methodology (UVM) … what is it?

n  Why UVM in SystemC/C++/SystemC-AMS?

n UVM-SystemC overview n  UVM foundation elements

n  UVM test bench and test creation

n  Randomization and coverage

n Contribution to Accellera

n Applications and use cases of UVM-SystemC n Summary and outlook

Outline

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 22 of 24

Page 23: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

23

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

Universal Verification Methodology created in SystemC/C++ n  Fully compliant with UVM standard

n  Target is to make all essential features of UVM available in SystemC/C++

n  UVM-SystemC language definition and proof-of-concept implementation contributed to Accellera Systems Initiative

n  SystemC-AMS is used for AMS system-level verification use cases

Ongoing developments n  Extend UVM-SystemC with constrained randomization capabilities using

SystemC Verification Library (SCV) or CRAVE

n  Introduction of assertions and functional coverage features

n  Add register abstraction layer and callback mechanism

n  Develop UVM based AMS and system-level verification methods

Summary and outlook

45

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

The development of the UVM-SystemC methodology and library has been supported by the European Commission as part of the Seventh Framework Programme (FP7) for Research and Technological Development in the project 'VERIFICATION FOR HETEROGENOUS RELIABLE DESIGN AND INTEGRATION' (VERDI). The research leading to these results has received funding from the European Commission under grand agreement No 287562.

Acknowledgements

46

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 23 of 24

Page 24: Introducing the Universal Verification Methodology (UVM ...nascug.org/events/20th/1-NASCUG20-UVMforSystemC-Karsten.pdf · *UVM-SystemC = UVM implemented in SystemC/C++ C++ ... seq

24

© Fraunhofer IIS/EAS Karsten Einwich

NASCUG 2014

n  SystemC, SystemC-AMS, UVM Standards:

n  www.accellera.org

n  SystemC proof-of-concept

n  www.accellera.org/downloads/standards/systemc

n  SystemC-AMS proof-of-concept

n  www.coside.de/open_source.html

n  Verdi project site (e.g. publications, tutorials for UVM SystemC)

n  www.verdi-fp7.eu

n  Crave randomization library

n  www.systemc-verification.org/

Resources

47

North American SystemC User's Group June 2, 2014

Presented during DAC 51 in San Francisco, CA Page 24 of 24