extracting more with uvm - t&vs/ option in scoreboard / sequences •otherwise, multiple...

29
Do More With UVM Rambabu Maddali Audience Communications Systems India Pvt Ltd

Upload: others

Post on 11-Mar-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Do More With UVM

Rambabu Maddali Audience Communications Systems India Pvt Ltd

Page 2: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Why UVM?

• Scalability and Reusability

• Has the best features of OVM and VMM

• UVM config db and factory are very powerful features

• Easy porting from module level to top level

• Easy to understand environments

• Better control of debug information, testcase writing

• Structured communication mechanism between different modules in TB o Abstracted communication

• Creating error tests is made easy o No need to touch working tests

• Rich portfolio of verification components (UVCs)

2014-09-02

2

Page 3: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

UVC structure

3

2014-09-02

I N T E R F A C E

I N T E R F A C E

Environment

Agent

Driver Monitor

Cfg

Cfg

Agents

Generic UVM structure only defines the structure, no naming conventions

Sequencer

Page 4: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

UVC structure

4

2014-09-02

I N T E R F A C E

I N T E R F A C E

Environment

Agent

Driver Monitor

Cfg

Cfg

Agents

Generic UVM structure only defines the structure, no naming conventions

Sequencer

Sequence Sequence

Page 5: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Audience UVC structure

5

2014-09-02

I N T E R F A C E

I N T E R F A C E

<uvc>_env

<uvc>_mst_agt

<uvc>_mst_drv

<uvc>_mst_mon

<uvc>_mst_cfg

<uvc>_cfg

<uvc>_slv_agt

<uvc>_mst_seqr

To make it same look and feel, we define the names of components of UVCs, instance names

Sequence Sequence

Page 6: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Audience UVC structure

6

2014-09-02

I N T E R F A C E

I N T E R F A C E

<uvc>_env

<uvc>_mst_agt

<uvc>_mst_drv

<uvc>_mst_mon

<uvc>_mst_cfg

<uvc>_cfg

<uvc>_slv_agt

<uvc>_mon

<uvc>_mst_seqr

Adding Bus Monitor at UVC environment level and making the agent specific monitors having only master/slave sepcifc checkers helps in reducing the number of active monitors Otherwise, UVC configuration at top level would need changes to module level environments

Sequence Sequence

Page 7: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Audience UVC structure

7

2014-09-02

I N T E R F A C E

I N T E R F A C E

<uvc>_env

<uvc>_mst_agt

<uvc>_mst_drv

<uvc>_mst_mon

<uvc>_mst_cfg

<uvc>_cfg

<uvc>_slv_agt

<uvc>_mon

<uvc>_mst_seqr

We even fix the filenames of the UVC sv directory & UVC template is script generated

To make it same look and feel, we define the names of components of UVCs, instance names

Sequence Sequence

Page 8: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Clocks and Resets for UVC

• Adding reset related code in the initial UVC development makes the UVC usable in environments where Reset is applied more than once

• Always define clocking block inside interface and use those clocking block events, instead of posedge of clock / negedge of clock

o Later if we decide to move the sampling of signals from posedge to negedge, adaptation would be easy

2014-09-02

8

task wait_for_req(); while(vif.req == 0) @(posedge vif.clk); $display(“req asserted”); …. endtask

task wait_for_req(); while(vif.req == 0) @vif.cb; `uvm_info(…); …. endtask

Page 9: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Integration of RAL

9

2014-09-02

RAL RAL

RAL Adapter RAL Adapter

BUS Driver BUS Driver BUS Monitor BUS Monitor

Register sequences and Register information

Register sequences and Register information

Register Reset check / read-write check sequences

Up to date information of module’s configuration for scoreboard

Page 10: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Integration of RAL

10

2014-09-02

RAL RAL

RAL Adapter RAL Adapter

BUS Driver BUS Driver BUS Monitor BUS Monitor

Register sequences and Register information

Register sequences and Register information

Register Reset check / read-write check sequences

Up to date information of module’s configuration for scoreboard

Bus Driver and Monitor could be moved from Bus1 to Bus2 anytime during the project without changing testcases / scoreboards

Page 11: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

RAL - TB & DUT Synchronization

11

2014-09-02

task body(); #10000; `uvm_do(seq1); endtask

task body(); do begin rdata = reg_model.reg.get_mirrored_value(); while(rdata == 1); `uvm_do(seq1); endtask

Without RAL With RAL integrated

• Synchronizing DUT configuration with TB to start a sequence is similar to an approach based on adhoc delays or based on internal signals

o when RAL is integrated in TB, it is different

Page 12: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

RAL - Replacing Processors

12

2014-09-02

TB_TOP

Processor Processor

ModN ModN Mod1 Mod1

TB TB

General testcase, processor code works as FW

Bus bridge

Page 13: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

RAL - Replacing Processors

13

2014-09-02

TB_TOP

Processor Processor

ModN ModN Mod1 Mod1

TB TB

RAL based sequences can be used to drive the traffic using UVM sequences Few scenarios could be easily created

Bus bridge

Page 14: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

RAL - Replacing Processors

14

2014-09-02

TB_TOP

Processor Processor

ModN ModN Mod1 Mod1

TB TB

RAL based sequences can be used to drive the traffic using UVM sequences Few scenarios could be easily created

Bus bridge

RAL can be configured to drive traffic after the bridge as well

Page 15: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Layered Sequences

• Layered sequences help in scalability of tests

o To make it more scalable, have common testcase sequences with dummy body() which will be extended for final test sequences

• Raise/drop objections

• This way, any pre_body / post_body() need to be added to a class of tests, can be easily achieved

• Code to wait for C-code to finish for SoC tests can be put in post_body()

2014-09-02

15

class chip_test extends uvm_test; …. endclass class c_chip_test extends uvm_test; …. ( defines pre_body() & post_body() ) endlcass class sv_chip_test extends uvm_test; …. ( defines pre_body() & post_body() ) endlcass

class test1 extends c_chip_test; …. endclass class test20 extends sv_chip_test; …. endlcass

Page 16: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Handling join_any

• Fork – join_any + disable o Caution is needed while using fork-join_any

o After fork-join_any is done, only one thread would have completed execution and other threads started inside the fork are still running

o Sometime, need to stop the other threads

o If other threads need to be stopped, disable fork can be used

o However, disable fork will terminate all child threads in a thread, where it is called

• Affect might be at a place one don’t expect

o EXAMPLE diagram in next slide

• Code in red box would terminate thread0() as well once thread2() is completed

• Where as code in green box works as intended, kills thread1() once thread2() is over

16

2014-09-02

Page 17: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Thread1 of join_any

Thread2 of join_any

Thread0 from join_none, should be run for ever

fork thread0(); Join_none fork thread1(); thread2(); join_any disable fork;

fork thread0(); Join_none fork begin fork thread1(); thread2(); join_any disable fork; end join

Task start

Task end

Example of join_any

2014-09-02

17

Page 18: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Extendibility

• Add hookup tasks inside monitor / sequence library code

o So that, if user wants to add some specific code, one can extend the class and define this tasks

o With this, one need not copy the whole code from monitor / sequence and edit that

• Otherwise, any updates to common UVC are not ported to user’s environment

o Especially after capturing the data from the interface signals into monitor item / before driving the data item onto interface

• Use RAL based sequences to configure the DUT, instead of using system bus UVC sequences

o This will make porting tests from one environment to other environment easy, where system bus is not same

2014-09-02

18

Page 19: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Controlling the LOG

• No hard and fast rules to determine the Verbosity for UVM_INFO messages

• After adapting the UVM, now we have few guidelines on how we can determine on the verbosity for messages

o During development of UVM code, recommend to use UVM_NONE

o Once the UVC / scoreboard / Monitor is working properly, then increase the level of verbosity level for all UVM_INFO messages

o UVM_LOW for messages which occur once in a while ( like interrupts, exception )

o UVM_MEDIUM for messages which are important to track the flow of testcase

o Any other messages UVM_HIGH, UVM_FULL

• Avoid using $display as UVM_INFO is available

2014-09-02

19

Page 20: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Performance - Reduce usage of system tasks

• Avoid using system tasks inside active threads of monitors / sequences

o Use them in new() or similar tasks which are called once, so that system task is not called too many times

20

2014-09-02

class monitor; task run(); forever begin @vif.cb; if(vif.req ==1 && vif.resp == 0 && $test$plusargs(“check_resp”)) `uvm_error(“ERR”,“err with resp”); end endtask : run endclass

class monitor; bit check_resp; task new(); check_resp = $test$plusargs(“check_resp”); endtask task run(); forever begin @vif.cb; if(vif.req ==1 && vif.resp == 0 && check_resp == 1) `uvm_error(…); end endtask : run endclass

Page 21: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Performance with UVM

• While adding checkers / scoreboards at top level, for design correctness, ensure proper knobs are added to enable/disable them

o Otherwise, simulation performance is observed to be low with all checkers/scoreboards at top level

o Make the knobs controllable through run-time arguments to avoid multiple compilations

• At top level, tests can be written with SV by using sequences to drive transactions at bus level for system bus instead of processor C / ASM code

• Any checks that are done for every clock, will reduce the performance

2014-09-02

21

Page 22: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Constraints

• Avoid writing unnecessary constraints in sequence items, especially for UVCs

• Add constraints only on need basis

o Ex: delay, byte_en

22

2014-09-02

class seq_item; …. int dly; bit [3:0] byte_en; constraint c_dly { dly < 10; } constraint c_byte_en { soft byte_en == 4’hf; } endclass

Constraints in seq_item This constraint make user extend the item and modify the constraint for achieving dly >= 10

For byte_en, even if user wants all possible values, unless .byte_en != 4’hf is given all the time, byte_en would be 4’hf

Page 23: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Few Techniques we followed @ Audience Inc

• Interafces

o Multiple interfaces of same type

• Ex: If 20 ahb interfaces are needed, tough to manage without array of interfaces

• Use scripting to create the SV code with portno appended

• Assertions

o Add assertions in the UVC protocol checkers / design configuration checks / scoreboards so that coverage collection of such assertions is made easy

2014-09-02

23

Page 24: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Passing Interfaces

24

2014-09-02

tb_top

DUT DUT

tb

mod1 mod1

mod2 mod2

mod3 mod3

Instaniate interfaces at tb_top and virtual interfaces at tb

Page 25: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Passing Interfaces

25

2014-09-02

tb_top

DUT DUT

tb

mod1 mod1

mod2 mod2

mod3 mod3

Connect tb_top interfaces to tb virtual interfaces using config_db

Page 26: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Passing Interfaces

26

2014-09-02

tb_top

DUT DUT

tb

mod1 mod1

mod2 mod2

mod3 mod3

Now tb can connect the virtual interfaces to respective mod envs/ components

Page 27: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Useful techniques for quick results

• Code development o Use plusargs / plusargs based variables to try more than one variant of implementation

/ option in scoreboard / sequences • Otherwise, multiple compilations will lead to more time to close on the implementation

• Code debugging o When a debug is targeted for a specific monitor / scoreboard, better enable the full

verbosity only for those modules instead of making +UVM_VERBOSITY=UVM_FULL • Following cmd argument will set the verbosity of specified instance to UVM_FULL, keeping

whole other environment’s verbosity to default

o +uvm_set_verbosity="uvm_test_top.tb0.inst1.inst2.inst3*",_ALL_,UVM_FULL,run

• UVC hand-off o Develop sequence library containing sequences which will be needed by the UVC user

(write/read/write-and-read/wait-readdata)

• Testcase development o Develop random tests and constrain those tests to create directed testcases

o Try to keep number of tests to minimal to avoid more changes for a new requirement / constraint in design configuration

2014-09-02

27

Page 28: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Acknowledgements

• Thanks to Kartik Raju and other members of the VLSI team at Audience Inc, who are very objective oriented and always open for new ideas and methodologies

2014-09-02

28

Page 29: Extracting More with UVM - T&VS/ option in scoreboard / sequences •Otherwise, multiple compilations will lead to more time to close on the implementation •Code debugging o When

Thank You

29

2014-09-02