25
Modeling Usable & Reusable Transactors in SystemVerilog Janick Bergeron, Scientist Verification Group, Synopsys Inc [email protected]

Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

Modeling Usable &Reusable Transactorsin SystemVerilog

Janick Bergeron, ScientistVerification Group, Synopsys [email protected]

Page 2: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (2) CONFIDENTIAL

TransactorsDefinition

• Building blocks of verification environmentsBus-functional modelsMonitorsCheckersGenerators

• Few instancesCreated at the start of simulationRemain in existence for duration

• Data and transactions flow through themGenerationObservationSchedulingTransformationProcessing

Page 3: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (3) CONFIDENTIAL

Verification EnvironmentTransactors

BFM

Driver

MonitorAssertionsAssertions

Generator

CheckerSelf CheckSelf Check

DUTDUT

TestTest

Transactors

Page 4: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (4) CONFIDENTIAL

TransactorCategories

• Active transactorsInitiate transactionsSupply data to other sideExample: AHB master, Ethernet Tx

• Reactive transactorsTransaction initiated by other sideReact by supplying requested dataExample: AHB slave

• Passive transactorsTransaction initiated by other sideCollect transaction data from other sideNo interaction with monitored interfaceExample: AHB bus monitor

Page 5: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (5) CONFIDENTIAL

Verification ProcessWhy Should You Care About Transactors?

• Verification >60% of design effort• Transactors enable abstraction & automation

Debug test& design

RegressionResults

SimulateSimulate

Write newtest

Write newtest

Codemodifications

MINIMIZE!MINIMIZE!

Identifynext testIdentifynext test

Page 6: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (6) CONFIDENTIAL

TransactorsImplementation

• Simple to write transactors thatAlways do the right thingOperate as fast as possible

• How can an environmentIntegrate a scoreboard?Add functional coverage?

• How can a testIntroduce delays?Respond with "retry", "abort" or not respond?Inject errors?

Without rewriting/modifyingoriginal transactor

Page 7: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (7) CONFIDENTIAL

Traditional TransactorsProcedural Interface

• Complex control interfaceConfiguration commandsTransaction commandsException commands

• Creates new programming language

Different concernsSame mechanism

Different concernsSame mechanism

TestRich set ofcommands

Rich set ofcommands

Grow incomplexityGrow in

complexity

Desired function mustexist in a command

Desired function mustexist in a command

Becometest-specificBecome

test-specificAlways modifyingtransactor

Always modifyingtransactor

Page 8: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (8) CONFIDENTIAL

Usable & Reusable Transactors

• SeparateConfigurationTransactionsExceptions

• Minimize code required for additional tests• Support

Random configurationRandom stimulusSelf-checking operationsFunctional coverageUser-defined exceptionsBlock-level verificationSystem-level verification

Requires HVLfeatures

Requires HVLfeatures

Page 9: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (9) CONFIDENTIAL

Object-Oriented TransactorsConfiguration Interface

• Implement using class• Configure using configuration class

Can be randomizedPass via constructor and optional reconfigure() method

class mii_cfg;rand bit is_100Mb;

endclass

class mii;protected mii_cfg cfg;...function new(mii_cfg cfg, ...);

this.cfg = cfg;endfunction;function void reconfigure(mii_cfg cfg);

...endfunction;

endclass

May have toreset transactorMay have to

reset transactor

Page 10: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (10) CONFIDENTIAL

Object-Oriented TransactorsTransaction Interface

• Data-flow based transaction interfaceTransaction descriptorsSee "Modeling Data and Transactions", DesignCon '05

class mii;eth_frame_channel in_chan;eth_frame_channel out_chan;...function new(..., eth_frame_chan in_chan = null,

eth_frame_chan out_chan = null, ...);if (in_chan == null) in_chan = new;this.in_chan = in_chan;

if (out_chan == null) out_chan = new;this.out_chan = out_chan;...

endfunction;endclass

Page 11: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (11) CONFIDENTIAL

Object-Oriented Transactors Transaction Interface

• Flow of data between producer and consumer automatically regulated

As fast asslowest

component

As fast asslowest

component

Page 12: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (12) CONFIDENTIAL

Object-Oriented Transactors Transaction Interface

• Can implement various transaction completion models

BlockingNonblockingOut-of-orderRequest / Response

Page 13: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (13) CONFIDENTIAL

Object-Oriented Transactors Transaction Interface

• Key to transactor reuse across environments

Test

MII BLKMII

MACMAC BLK

Test

MII BLKMII

MII BLKMII

MAC

Test

IP

MAC BLK

IP BLK

Test

MAC BLKCustom

MAC

Page 14: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (14) CONFIDENTIAL

Object-Oriented Transactors Transaction Interface

• Allows port of block level tests to chip level

Z

BUS IF

PHY IF

Z-1

TestTest ... in the

system... in thesystem

X

AX

B

CBlock-level

test ...Block-level

test ...

Page 15: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (15) CONFIDENTIAL

Object-Oriented Transactors Transaction Interface

• Components unaware of other endpoint

Test Test

TL DUT

Syst

emC

Syst

emVe

rilog

RTL DUT

Page 16: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (16) CONFIDENTIAL

Object-Oriented Transactors Transaction Interface

• Interface between testbench and emulator

EmulatedDUT

Test

EmulatedBFM

Emulator Box

Emulator-specificcommunication

Emulator-specificcommunication

Page 17: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (17) CONFIDENTIAL

Object-Oriented TransactorsException Interface

• Reusable transactors need mechanism to provide services to verification environment

Introducing delaysSynchronizing different transactorsFeedbackRecording input into scoreboardComparing output with expected valuesSampling data for functional coverageModifying transactions to inject errorsDeviate from default behavior

• Flexible enough to satisfy unpredictable needs of verification environments and testcases

Without modifying transactor

Page 18: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (18) CONFIDENTIAL

Object-Oriented TransactorsException Interface

Test

delay(10);

resp = NAK;

GenerictransactorsGeneric

transactors

Test completelyspecified in one fileTest completely

specified in one file

Able to executetest-specified

code

Able to executetest-specified

code

• Callbacks used to implement exceptionsSame languageUser-defined functionality

Page 19: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (19) CONFIDENTIAL

Reusable TransactorsCallback Methods

• Callback methods are virtual methods in façade class invoked by the transactor itself

Empty by defaultCan be extended with user-defined code

class mii_cback; virtual task callback(...);endtask

endclasstask main();

...while (1) begin

...cb.callback(...);...

endendtask

DefaultDefault

class my_mii_cback extends mii_cback;virtual task callback(...);

...endtask

endclass User-definedextension

User-definedextension

Façade classFaçade class

Page 20: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (20) CONFIDENTIAL

Reusable TransactorsCallback Methods

• Provide rich set of callback methodsAfter a new transaction is about to be started

• Allow delay insertion• Allow modifying or dropping the transaction

Before a major decision is about to be acted upon• Allow the default decision to be changed

Before sub-transactions or data is transmitted• Allow delay insertion• Allow modifying or dropping

After sub-transactions or data has been received• Allow modifying or dropping

After a transaction has been completed• Allow modifying or prevent forwarding to higher layers

In the body of every loop• Supply loop index via argument• Allow modifying the subject of the iteration

If protocolallows it

If protocolallows it

Page 21: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (21) CONFIDENTIAL

Reusable TransactorsCallbacks Methods

• Transactors have list of registered callback extensions

Individual extensions for different purposesNo modifications of existing callback functionality

class error_inject extends apb_master_cback;...

endclassclass scoreboarding extends apb_master_cback;...

endclassclass fctcvr_model extends apb_master_cback;...

endclass

Page 22: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (22) CONFIDENTIAL

Extensible TransactorsUser-Defined Transactions

• Use callback to interpret transaction descriptor

Can be overloaded to modify transaction executionCan be overloaded to define new transactions

class my_mii_cback extends mii_cback;virtual function bit exec(transaction tr);

exec = 0;if (tr.kind = MY_TRANSACTION) begin

...exec = 1;

endendfunction

endclass

User-definedextension

User-definedextension

class mii_cback; virtual function bit exec(transaction tr);

exec = 0;endfunction

endclass

task main();...while (1) begin

transaction tr;in_chan.get(tr);...if (cb.exec(tr)) next;...

endendtask

DefaultDefault

Page 23: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (23) CONFIDENTIAL

Transactor ImplementationClass Hierarchy

DUT/Test-specificDUT/Test-specific

Protocol-genericProtocol-generic test_usb_host_cbackusb_host_cbackvmm_xactor_callbacks sb_usb_host_cback

vmm_xactor usb_host

GenericGenericusb_host_cfg dut_usb_cfg

test_usb_cfg

usb_transactionvmm_data dut_usb_transaction

test_usb_transaction

Page 24: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

© 2004 Synopsys, Inc. (24) CONFIDENTIAL

Useable & Reusable TransactorsFor more information

• SystemVerilog Verification Methodology Manual

Kluwer Academic Publishers, 2005

• "Modeling Data and Transactions"DesignCon '05, Santa Clara, CA

• Reference Verification MethodologyVera User's Guide, 6.2 and later

Page 25: Modeling Usable & Reusable Transactors in …vlsi2005/keynotes/janick...Example: AHB master, Ethernet Tx • Reactive transactors Transaction initiated by other side React by supplying

Modeling Usable &Reusable Transactorsin SystemVerilog

Janick Bergeron, ScientistVerification Group, Synopsys [email protected]