16
Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence © Accellera Systems Initiative 1

Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

  • Upload
    others

  • View
    19

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Leveraging the UVM RAL for Memory Sub-System Verification

Tudor Timisescu, Infineon

Uwe Simm, Cadence

© Accellera Systems Initiative 1

Page 2: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Intro

• Storage elements are ubiquitous

• UVM REG– register abstraction layer

– programmer’s view

– integrates modeling, checking, stimulus generation and (some) coverage

• Registers vs. memories– read(…) vs. burst_read(…)

© Accellera Systems Initiative 2

Page 3: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Why Layer

• Common language when writing tests

• Reuse sequences– Abstract and conquer

© Accellera Systems Initiative 3

I’m talking about memories.

Vă vorbesc despre memorii.

Ich spreche über Arbeitsspeicher.

* Images from http://polandball.wikia.com (licensed under Creative Commons).

Page 4: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Real Life Example

© Accellera Systems Initiative 4

AHB Memory Sub-System

AHB

ConvertersCache

Interface to

processorInterface to

memory

Common

cache

interface

• Vertical reuse (cache verified standalone)

Page 5: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Adapter

• register operation <-> bus item

• map chops bursts into multiple operations

– deterministic algorithm

© Accellera Systems Initiative 5

Reg item(s)

Memory

sequence

Register

model

Reg item(s)Reg item(s)Adapter

Reg item(s)Reg item(s)

Bus item(s)

Page 6: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Adapter (cont’d)

© Accellera Systems Initiative 6

class ifx_ahb_reg_adapter extends uvm_reg_adapter; // … virtual function uvm_sequence_item reg2bus(const ref uvm_reg_bus_op rw); ifx_ahb_seq_item item = ifx_ahb_seq_item::type_id::create("item"); if (!item.randomize() with { item.burst_kind == SINGLE; item.size == (rw.n_bits == 8 ? BYTE : (rw.n_bits == 16 ? HALFWORD : WORD)); item.direction == rw.kind == UVM_WRITE ? WRITE : READ; item.addr == rw.addr; item.data == rw.data; }) `uvm_error("RANDERR", "Randomization error") return item; endfunction endclass

Constrain AHB burst

Page 7: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Burst Example

• mem.burst_write(…) of 16 bytes on 32 bit AHB bus

• How many possibilities?

© Accellera Systems Initiative 7

4 WORDs 8 HALFWORDs Mixture of sizes

Page 8: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Requirements

• Custom translation scheme

– Works at burst level

• Seamless integration

• Multiple DUT interfaces

• Register sequencer

– Only one interface

– Cumbersome

– Not versatile

© Accellera Systems Initiative 8

* Image from the UVM 1.1 User’s Guide.

Page 9: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Frontdoor

• briefly touched upon in the UVM user guide

• sequence

• intended to implement custom addressing schemes

• can be (mis)used for translation

© Accellera Systems Initiative 9

Memory

sequence

Register

model

Frontdoor

Reg item(s)Reg item(s)

Bus item(s)

Page 10: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Frontdoor (cont’d)

© Accellera Systems Initiative 10

class ifx_ahb_mem_frontdoor extends uvm_reg_frontdoor; // ... virtual task body(); bit[31:0] offset = rw_info.offset; int unsigned num_bytes = rw_info.value.size() * 4; while (num_bytes) begin ifx_ahb_seq_item burst = get_next_burst(offset, num_bytes); start_item(burst); finish_item(burst); num_bytes -= burst.get_num_bytes(); offset += burst.get_num_bytes(); end endtask endclass

Keep score of transferred bytes

Move to next block

Page 11: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Frontdoor (cont’d)

© Accellera Systems Initiative 11

class ifx_ahb_mem_frontdoor extends uvm_reg_frontdoor; // ... protected function ifx_ahb_seq_item get_next_burst(bit[31:0] offset, int unsigned num_bytes ); ifx_ahb_seq_item burst; `uvm_create(burst); if (!burst.randomize() with { addr == offset; direction == rw_info.kind inside { UVM_READ, UVM_BURST_READ } ? READ : WRITE; size inside { BYTE, HALFWORD, WORD }; (2 ** size) * burst_len <= num_bytes; }) `uvm_fatal("RANDERR", "Randomization error") return burst; endfunction endclass

Constrain AHB burst

Page 12: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Constraining Randomization

• Guide randomization

– E.g. not all burst kinds implemented

• Non-intrusive changes

– Declare extra constraints in sub-classes

– Polymorphism

– UVM factory

© Accellera Systems Initiative 12

Page 13: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Override 1

© Accellera Systems Initiative 13

class ahb_frontdoor_single extends ifx_ahb_mem_frontdoor; // ... virtual task body(); ifx_ahb_seq_item items[] = new[rw_info.value.size()]; foreach (items[i]) begin `uvm_create(items[i]) if (!items[i].randomize() with { burst_kind == SINGLE; size == WORD; // ... }) `uvm_fatal("RANDERR", "Randomization error") `uvm_send(items[i]); end endtask endclass // ... ifx_ahb_mem_frontdoor::type_id::set_type_override( ahb_frontdoor_single::get_type());

Know exactly how many bursts

Page 14: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Override 2

© Accellera Systems Initiative 14

class single_word_ahb_seq_item extends ifx_ahb_seq_item; // ... constraint single_word { burst_kind == SINGLE; size == WORD; } endclass // ... ifx_ahb_seq_item::type_id::set_type_override( single_word_ahb_seq_item::get_type());

Page 15: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Conclusion

• Flexible

– Registers can use adapter, memories can use frontdoor

– Write once, tweak everywhere

– Plays nice with native bus sequences

• Practical

– Abstract

– Stimulus reuse

© Accellera Systems Initiative 15

Page 16: Leveraging the UVM RAL for Memory Sub-System Verification · 2017-12-29 · Leveraging the UVM RAL for Memory Sub-System Verification Tudor Timisescu, Infineon Uwe Simm, Cadence ©

Questions

© Accellera Systems Initiative 16