Register This! Experiences Applying UVM Registers

Slides:



Advertisements
Similar presentations
1 System Level Verification of OCP-IP based SoCs using OCP-IP eVC Himanshu Rawal eInfochips, Inc.,4655 Old Ironsides Drive, Suite 385,Santa Clara, CA
Advertisements

Using emulation for RTL performance verification
Parag Goel Sr. Corporate Application Engineer Synopsys India Pvt. Ltd.
by Adiel Khan Staff CAE Synopsys
Unconstrained UVM SystemVerilog Performance You may add your company logo to this page, ONLY Presented by Wes Queen Verifcation Manager IBM.
CSE 1302 Lecture 8 Inheritance Richard Gesick Figures from Deitel, “Visual C#”, Pearson.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.
Design Synopsys System Verilog API Donations to Accellera João Geada.
CVSQL 2 The Design. System Overview System Components CVSQL Server –Three network interfaces –Modular data source provider framework –Decoupled SQL parsing.
Gaurav Gupta Freescale Semiconductors Adiel Khan, Parag Goel, Amit Sharma, Varun S, Abhisek Verma Synopsys
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
Lecture 8 Inheritance Richard Gesick. 2 OBJECTIVES How inheritance promotes software reusability. The concepts of base classes and derived classes. To.
Workshop - November Toulouse Ronan LUCAS - Magillem Design Services 07/04/2011.
IAY 0600 Digital Systems Design
Protocols and the TCP/IP Suite
Architecture styles Pipes and filters Object-oriented design Implicit invocation Layering Repositories.
New and active ways to bind to your design by Kaiming Ho Fraunhofer IIS.
SoC Verification HW #2 TA: Wei-Ting Tu Assignment: 04/12/06
System Verilog Testbench Language David W. Smith Synopsys Scientist
Active-HDL Interfaces Building VHPI Applications C Compilation Course 9.
Optimization of Verification Effort using Reusable Sequence Collection Dipesh Handa Gaurav Chugh Gaurav Minda Kumar Rajeev Ranjan.
Boost Verification Results by Bridging the Hw/Sw Testbench Gap by Matthew Ballance Verification Technologist Mentor Graphics.
Memory Subsystem verification – Can it be taken for granted ?
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
80386DX functional Block Diagram PIN Description Register set Flags Physical address space Data types.
SVA Encapsulation in UVM enabling phase and configuration aware assertions by Mark Litterick Verification Consultant Verilab GmbH, Munich, Germany.
Source Controller software Ianos Schmidt The University of Iowa.
Way beyond fast © 2002 Axis Systems, Inc. CONFIDENTIAL Axis Common Transaction Interface (CTI) Architecture Highlights 9/11/2003 Ching-Ping Chou Axis Systems,
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
EE694v - Verification - Lect 12
L25 - PlantPAx Process Application Development Lab I
Gopakumar.G Hardware Design Group
Structural style Modular design and hierarchy Part 1
Muen Policy & Toolchain
Basic Computer Organization and Design
Working in the Forms Developer Environment
Chapter 11: File System Implementation
Data Transport for Online & Offline Processing
Chapter 12: File System Implementation
Inheritance and Polymorphism
UNIT – Microcontroller.
UVM-Multi-Language Hands-On
Structural style Modular design and hierarchy Part 1
Web Ontology Language for Service (OWL-S)
Krishnan Balakrishnan, Courtney Fricano, and Kaushal Modi
Stitching UVM Test benches into Integration-Level
Timothy Pertuit, David Lacey, Doug Gibson
Stitching UVM Test benches into Integration-Level
Yet Another Memory Manager
Yet Another Memory Manager
Lecture 22 Inheritance Richard Gesick.
Computer-System Architecture
Module 2: Computer-System Structures
ECEG-3202 Computer Architecture and Organization
Remote Management of the Field Programmable Port Extender (FPX)
ChipScope Pro Software
MLWG - User Requirements
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Srinivas Aluri Jaimin Mehta
Overview of Computer Architecture and Organization
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
ChipScope Pro Software
SystemVerilog and Verification
Module 2: Computer-System Structures
Chapter 13: I/O Systems.
Presentation transcript:

Register This! Experiences Applying UVM Registers by Kathleen Meade Verification Solutions Architect Cadence Design Systems

Register Package: Motivation Almost all devices have registers Hundreds (even thousands) of registers is not uncommon In verifying a DUT, one needs to control, observe and check register behavior Randomize a configuration and initialize register values Execute transactions to write/read registers and memories Check registers and compare to a reference model Collect coverage of device modes Much of the DUT configuration is done at the register level! Kathleen Meade, Cadence Design Systems, Inc

UVM_REG UVM_REG is the register and memory package that is included in UVM Streamlines and automates register-related activities Used to model registers and memories in the DUT Features Built on top of UVM base classes Access APIs – to write, read, update, peek, get reg values front-door and back-door access to registers and fields Hierarchical architecture Built-in sequences for common register operations Kathleen Meade, Cadence Design Systems, Inc

Configuring the DUT with uvm_reg Register Sequence Register sequences execute register operations Adapter converts register operations to bus transactions Adapter The DUT configuration determines initial register values APB UVC Master UVC drives bus transactions master agent seqr Register Model Register Block 0x1000 mode0 mode1 mode2 mode3 status 0x0000 0x0FFF memory (4K) 0x1001 0x1002 0x1003 0x1010 . . . Virtual Sequencer driver mon dut memctl mode0 mode2 mode1 mode3 status mem_inst memory 32x4096 apb_if Virtual Sequencer executes register operations and bus transactions A register model is created to shadow the registers, and memories in the DUT Kathleen Meade, Cadence Design Systems, Inc 4

Register Monitoring and Checking Predictor: write: update the model read: compare (and update) the register model Predictor receives transactions Adapter converts transactions back to register operations Adapter Predictor Component APB UVC master agent seqr Register Model Register Block 0x1000 mode0 mode1 mode2 mode3 status 0x0000 0x0FFF memory (4K) 0x1001 0x1002 0x1003 0x1010 . . . A bus monitor captures transactions on the bus and sends them via TLM driver mon Functional coverage is sampled in the register model dut memctl mode0 mode2 mode1 mode3 status mem_inst memory 32x4096 apb_if Register model contains address maps and is placed in the testbench. Also holds attributes and expected values Kathleen Meade, Cadence Design Systems, Inc 5

The Register Model Defines fields, registers, register blocks and memories for the DUT Includes attributes for registers and register fields (size, reset value, compare mask and access) Also tracks the expected values for checking Register operations are used for register-related stimulus Separating register operations from bus protocols Don’t need to learn protocol-specific details Can easily change underlying protocol Registers and blocks can be reused within and between projects Configuration sequences can be packaged and reused Kathleen Meade, Cadence Design Systems, Inc

Creating the UVM_REG Model Following the IP-XACT Hierarchy IP-XACT is the Accellera XML standard format to capture the register model (driven by the IPXACT sub-committee) User manually creates reusable UVM configuration sequences Users capture their project Register model in IPXACT UVM_reg base classes UVM config sequences Provided by Vendors testbench IP-XACT Register Generator Utility Reg classes and DB Place inside a testbench for randomizing, checking, and coverage Generated SV code extends from UVM base classes Kathleen Meade, Cadence Design Systems, Inc

IP-XACT Register Format (XML) <spirit:register> <!– CONFIG REGISTER --> <spirit:name>config_reg</spirit:name> <spirit:addressOffset>0x0010</spirit:addressOffset> <spirit:size>8</spirit:size> <spirit:reset> <spirit:value>0x00</spirit:value> <spirit:mask>0xff</spirit:mask> </spirit:reset> <spirit:field> <!– FIELD DEFINITIONS --> <spirit:name>f1</spirit:name> <spirit:bitOffset>0</spirit:bitOffset> <spirit:bitWidth>1</spirit:bitWidth> <spirit:access>read-write</spirit:access> </spirit:field> <spirit:field> <spirit:name>f2</spirit:name> <spirit:bitOffset>1</spirit:bitOffset> <spirit:bitWidth>1</spirit:bitWidth> <spirit:access>read-only</spirit:access> . . . </spirit:register> <spirit:register> <!– MODE REGISTER --> <spirit:name>mode_reg</spirit:name> <spirit:addressOffset>0x0000</spirit:addressOffset> <spirit:size>8</spirit:size> <spirit:access>read-write</spirit:access> <spirit:reset> <spirit:value>0x00</spirit:value> <spirit:mask>0xff</spirit:mask> </spirit:reset> </spirit::register> config_reg 2 6 7 f1 f2 f3 f4 mode_reg data Vendor extensions can be used in the XML file to capture additional register and field dependencies (backdoor path, constraints or coverage info) Kathleen Meade, Cadence Design Systems, Inc 8

Generated Register Definition class config_reg_c extends uvm_reg; rand uvm_reg_field f1; rand uvm_reg_field f2; rand uvm_reg_field f3; rand uvm_reg_field f4; virtual function void build(); f1 = uvm_reg_field::type_id::create(“f1"); f1.configure(this, 1, 0, "RW", 0, ‘h0, 1, 1, 1); f2 = uvm_reg_field::type_id::create("f2"); f2.configure(this, 1, 1, "RO", 0, ‘h0, 1, 1, 1); f3 = uvm_reg_field::type_id::create(“f1"); f3.configure(this, 4, 2, "RW", 0, ‘h0, 1, 1, 1); f4 = uvm_reg_field::type_id::create("f2"); f4.configure(this, 2, 6, “WO", 0, ‘h0, 1, 1, 1); endfunction `uvm_register_cb(config_reg_c, uvm_reg_cbs) `uvm_set_super_type(config_reg, uvm_reg) `uvm_object_utils(config_reg_c) function new (input string name="config_reg_c"); super.new(name, 8, UVM_NO_COVERAGE); endfunction : new endclass : config_reg_c config_reg 2 6 7 f1 f2 f3 f4 config_reg fields In the build() method, each field is created, and then configured Callback and derivation support Constructor specifies width and coverage options Kathleen Meade, Cadence Design Systems, Inc 9

Register File/Model Declaration class memctl_rf_c extends uvm_reg_block; rand mode_reg_c mode_reg; rand config_reg_c config_reg; virtual function void build(); mode_reg = mode_reg_c::type_id::create(“mode_reg“, get_full_name()); config_reg = config_reg_c::type_id::create(“config_reg“, get_full_name()); mode_reg.configure(this, null, “ctl.mode_reg”); mode_reg.build(); config_reg.configure(this, null, “ctl.config_reg”); config_reg.build(); // define address mappings default_map = create_map(“default_map”, 0, 1, UVM_LITTLE_ENDIAN); default_map.add_reg(mode_reg, ‘h0, “RW”); default_map.add_reg(config_reg, ‘h10, “RW”); endfunction `uvm_object_utils(memctl_rf_c) function new (input string name=“memctl_rf_c"); super.new(name, UVM_NO_COVERAGE); endclass Registers (can also contain fields) In the build() method, each register is created, and then configured hdl_path for backdoor access A default map is created with address offset information Change this to a graphic showing a register inside a register file inside a register model. All are generated from the XML file. Address offset The register model is similarly hierarchical and contains register files, memories and also registers Kathleen Meade, Cadence Design Systems, Inc

Instantiation and Hook-up Testbench Add a predictor Register Sequencer Create a register sequencer Predictor Component Adapter Create an adapter and implement the reg2bus and bus2reg functions APB UVC master agent driver mon seqr Register Model Register Block 0x1000 mode0 mode1 mode2 mode3 status 0x0000 0x0FFF memory (4K) 0x1001 0x1002 0x1003 0x1010 . . . Connect the predictor to the APB monitor Virtual Sequencer dut memctl mode0 mode2 mode1 mode3 status mem_inst memory 32x4096 apb_if Place components in the testbench and connect Kathleen Meade, Cadence Design Systems, Inc 11

Accessing the Register Model Each register field holds three copies of data: Mirrored: What we think is in the HW Value: A value to be randomized Desired value: A desired value for the field for reference and comparison Has an associated access policy (RW, RO, WO, W1C, etc) config_reg 2 6 7 f1 f2 f3 f4 mode_reg data RW RO

Access APIs for Registers, Fields and Memories write()/read() Write/read immediate value to the DUT set()/get() Sets or gets desired value from the register model randomize() Randomizes and copies the randomized value into the desired value of the mirror (in post_randomize()) update() Invokes the write() method if the desired value (modified using set() or randomize()) is different from the mirrored value mirror() Invokes the read() method to update the mirrored value based on the read back value. Can also compare the read back value with the current mirrored value before updating it. (for checking) value is mirrored after randomize() desired is mirrored after set() mirrored is what we think is in the hardware Use UVM_BACKDOOR mode to directly access the DUT (via HDL path) randomize(), update() and mirror() can be called on a container (block) too

UVM_REG write() API An example of the task signature for write is: Usage of write() inside a sequence looks like this: virtual task write( output uvm_status_e status, input uvm_reg_data_t value, input uvm_path_e path = UVM_DEFAULT_PATH, input uvm_reg_map map = null, input uvm-sequence_base parent = null, input int prior = -1, input uvm_object extension = null, input string fname = “”, input int lineno = 0 ); default is FRONTDOOR model.block.mode_reg0.write(status, 8’h34, UVM_BACKDOOR, .parent(this)); model.block.config_reg.write(status, 8’h20, UVM_FRONTDOOR, .parent(this)); bound by name instead of position Kathleen Meade, Cadence Design Systems, Inc

Configuring Your DUT Using uvm_reg Use the register database API to configure the DUT and update the register model To maximize automation and reuse use UVM sequences for configuration Advantages: Registers are great candidates for vertical reuse Sequences are the most natural way for UVM users Leverage built-in sequence capabilities: grab, lock, priorities, etc Easy system-level control via virtual sequences Kathleen Meade, Cadence Design Systems, Inc

Configuration Sequences class config_wr_rd_seq extends uvm_reg_sequence; memctl_rf model; rand logic [31:0] mode0, config; virtual task body(); uvm_status_e status; model.mode0_reg.write(status, mode0, .parent(this)); model.config_reg.write(status, config , .parent(this)); model.mode0_reg.read(status, mode0, UVM_BACKDOOR, .parent(this)); model.config_reg.read(status, config, UVM_BACKDOOR, .parent(this)); endtask : body `uvm_object_utils(config_wr_rd_seq) function new ( string name=“config_wr_rd_seq“ ); super.new(name); endfunction : new endclass register model The `uvm_do actions are hidden by the read/write routines Frontdoor Writes While it is possible to mirror the shadow from sequences it is not recommended (see on checking and monitoring) Backdoor Reads What about Checking? Kathleen Meade, Cadence Design Systems, Inc Where is the checking?

Checking for Correctness Register checking and coverage is useful Register field values map to DUT operation modes and designers can observe the combinations of configurations that were exercised Consistency checking against a mirror/reference can identify errors regardless of the testbench implementation or DUT complexity Where do I place the monitoring logic? Directly in sequences where I want to check? or a passive monitor? UVM_REG supports two types of monitoring: implicit and explicit Kathleen Meade, Cadence Design Systems, Inc

Checking: Implicit Monitoring The sequence automatically updates the desired value Easy to set up but dangerous, not reusable (no support for passive), no support for other activity on the bus To activate: my_reg_model.default_map.set_auto_predict(1) Use the mirror() method n a sequence body and enable the check: // Read and check the mode register via back-door access model.mode0_reg.mirror(status, UVM_CHECK, UVM_BACKDOOR, .parent(this)); model.mirror(status, UVM_CHECK, UVM_FRONTDOOR, .parent(this)); Can also mirror() the register model or any sub_container

Checking: Explicit Monitoring The bus monitor and a predictor are used for monitoring and checking Much safer and more reusable Checking logic needs to be added to module UVC Separation of the injection and monitoring paths is one of the basic concepts of UVM We recommend passive monitoring – independent capture of transactions on the bus that can be recognized as bus operations. Note: It’s OK to have a check in a sequence body if that is the purpose of the sequence, but want to be able to do independent checking too

Explicit Monitoring TLM port to collect bus transfer class reg_monitor extends uvm_env; `uvm_analysis_imp_decl(_trns) uvm_analysis_imp_trns #(bus_transfer, reg_monitor) item_collected_export; uvm_reg_predictor#(bus_transfer) predictor; bus_reg_adaptor reg2uvc; bus_map model; virtual function void build_phase ( uvm_phase phase ); super.build_phase(phase); predictor = uvm_reg_predictor#(bus_transfer)::type_id::create("predictor", this); reg2uvc=bus_reg_adaptor::type_id::create("reg2uvc"); endfunction virtual function void connect_phase ( uvm_phase phase ); super.connect_phase(phase); predictor.map=model.default_map; predictor.adapter=reg2uvc; function void write_trns(bus_transfer trans); predictor.write(trans); ….. endclass : reg_monitor TLM port to collect bus transfer Predictor Component Reg to UVC and UVC to reg converter object Register model pointer. Will be set by top test-bench Create predictor and adapter Connect address map and adapter to predictor When bus transfer is observed pass it to predictor

Coverage Model in UVM_REG The register model can include functional coverage Details of coverage points, bins are left to generator Coverage model can be very large, so instantiate/cover only what needs to be covered UVM_REG pre-defined coverage models Register bits (all bits have been read/written) Address maps (addresses have been accessed) Field values (specific values are covered) A register generator creates a coverage model for you. Uses IP-XACT vendor-extensions to enable coverage at the field-level Also allows command-line option to enable/disable register-level functional coverage generation 21

Register Debug Kathleen Meade, Cadence Design Systems, Inc

Questions? Thank You! Kathleen Meade, Cadence Design Systems, Inc