[source]

Class uvm_mem

uvm_pkg::uvm_mem + mam : uvm_mem_mam + Xadd_vregX(): void + Xdelete_vregX(): void + Xlock_modelX(): void + XsampleX(): void + add_hdl_path(): void + add_hdl_path_slice(): void + add_map(): void + backdoor_read_func(): uvm_status_e + backdoor_write() + burst_read() + burst_write() + clear_hdl_path(): void + clone(): uvm_object + configure(): void + convert2string(): string + do_compare(): bit + do_copy(): void + do_pack(): void + do_print(): void + do_read() + do_unpack(): void + do_write() + get_access(): string + get_address(): uvm_reg_addr_t + get_addresses(): int + get_backdoor(): uvm_reg_backdoor + get_block(): uvm_reg_block + get_coverage(): bit + get_default_map(): uvm_reg_map + get_frontdoor(): uvm_reg_frontdoor + get_full_hdl_path(): void + get_full_name(): string + get_hdl_path(): void + get_hdl_path_kinds(): void + get_local_map(): uvm_reg_map + get_maps(): void + get_max_size(): int unsigned + get_n_bits(): int unsigned + get_n_bytes(): int unsigned + get_n_maps(): int + get_offset(): uvm_reg_addr_t + get_parent(): uvm_reg_block + get_rights(): string + get_size(): longint unsigned + get_vfield_by_name(): uvm_vreg_field + get_virtual_fields(): void + get_virtual_registers(): void + get_vreg_by_name(): uvm_vreg + get_vreg_by_offset(): uvm_vreg + has_coverage(): bit + has_hdl_path(): bit + is_in_map(): bit + peek() + poke() + post_read() + post_write() + pre_read() + pre_write() + read() + set_backdoor(): void + set_coverage(): uvm_reg_cvr_t + set_frontdoor(): void + set_offset(): void + set_parent(): void + write() uvm_pkg::uvm_mem_mam mam

Collaboration Diagram of uvm_mem

Memory abstraction base class

A memory is a collection of contiguous locations. A memory may be accessible via more than one address map.

Unlike registers, memories are not mirrored because of the potentially large data space: tests that walk the entire memory space would negate any benefit from sparse memory modelling techniques. Rather than relying on a mirror, it is recommended that backdoor access be used instead.

Variables

Name

Type

Description

mam

uvm_mem_mam

Memory allocation manager

Memory allocation manager for the memory corresponding to this abstraction class instance. Can be used to allocate regions of consecutive addresses of specific sizes, such as DMA buffers, or to locate virtual register array.

Constructors

function new ( string name, longint unsigned size, int unsigned n_bits, string access, int has_coverage ) [source]

Create a new instance and type-specific configuration

Creates an instance of a memory abstraction class with the specified name.

size specifies the total number of memory locations. n_bits specifies the total number of bits in each memory location. access specifies the access policy of this memory and may be one of "RW for RAMs and "RO" for ROMs.

has_coverage specifies which functional coverage models are present in the extension of the register abstraction class. Multiple functional coverage models may be specified by adding their symbolic names, as defined by the uvm_coverage_model_e type. New

Enums

init_e [source]
Enum Items :
  • UNKNOWNS
  • ZEROES
  • ONES
  • ADDRESS
  • VALUE
  • INCR
  • DECR

Functions

function void configure ( uvm_reg_block parent, string hdl_path ) [source]

Instance-specific configuration

Specify the parent block of this memory.

If this memory is implemented in a single HDL variable, its name is specified as the hdl_path . Otherwise, if the memory is implemented as a concatenation of variables (usually one per bank), then the HDL path must be specified using the add_hdl_path() or add_hdl_path_slice() method. Configure

virtual function void set_offset ( uvm_reg_map map, uvm_reg_addr_t offset, bit unmapped ) [source]

Modify the offset of the memory

The offset of a memory within an address map is set using the uvm_reg_map::add_mem() method. This method is used to modify that offset dynamically.

Note

Modifying the offset of a memory will make the abstract model

diverge from the specification that was used to create it. Set_offset

virtual function void set_parent ( uvm_reg_block parent ) [source]

Set_parent

function void add_map ( uvm_reg_map map ) [source]

Add_map

function void Xlock_modelX ( ) [source]

Xlock_modelXlocal

function void Xadd_vregX ( uvm_vreg vreg ) [source]

Xadd_vregX

function void Xdelete_vregX ( uvm_vreg vreg ) [source]

Xdelete_vregX

virtual function string get_full_name ( ) [source]

Get the hierarchical name

Return the hierarchal name of this memory. The base of the hierarchical name is the root block. Get_full_name

virtual function uvm_reg_block get_parent ( ) [source]

Get the parent block. Get_parent

virtual function uvm_reg_block get_block ( ) [source]

Get_block

virtual function int get_n_maps ( ) [source]

Returns the number of address maps this memory is mapped in. Get_n_maps

function bit is_in_map ( uvm_reg_map map ) [source]

Return TRUE if this memory is in the specified address map . Is_in_map

virtual function void get_maps ( uvm_reg_map maps ) [source]

Returns all of the address maps where this memory is mapped. Get_maps

function uvm_reg_map get_local_map ( uvm_reg_map map, string caller ) [source]

Get_local_map

function uvm_reg_map get_default_map ( string caller ) [source]

Get_default_map

virtual function string get_rights ( uvm_reg_map map ) [source]

Returns the access rights of this memory.

Returns "RW", "RO" or "WO". The access rights of a memory is always "RW", unless it is a shared memory with access restriction in a particular address map.

If no address map is specified and the memory is mapped in only one address map, that address map is used. If the memory is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the memory is not mapped in the specified address map, an error message is issued and "RW" is returned. Get_rights

virtual function string get_access ( uvm_reg_map map ) [source]

Returns the access policy of the memory when written and read via an address map.

If the memory is mapped in more than one address map, an address map must be specified. If access restrictions are present when accessing a memory through the specified address map, the access mode returned takes the access restrictions into account. For example, a read-write memory accessed through a domain with read-only restrictions would return "RO". Get_access

function longint unsigned get_size ( ) [source]

Returns the number of unique memory locations in this memory. Get_size

function int unsigned get_n_bytes ( ) [source]

Return the width, in number of bytes, of each memory location. Get_n_bytes

function int unsigned get_n_bits ( ) [source]

Returns the width, in number of bits, of each memory location. Get_n_bits

static function int unsigned get_max_size ( ) [source]

Returns the maximum width, in number of bits, of all memories. Get_max_size

virtual function void get_virtual_registers ( uvm_vreg regs ) [source]

Return the virtual registers in this memory

Fills the specified array with the abstraction class for all of the virtual registers implemented in this memory. The order in which the virtual registers are located in the array is not specified. Get_virtual_registers

virtual function void get_virtual_fields ( uvm_vreg_field fields ) [source]

Return the virtual fields in the memory

Fills the specified dynamic array with the abstraction class for all of the virtual fields implemented in this memory. The order in which the virtual fields are located in the array is not specified. Get_virtual_fields

virtual function uvm_vreg get_vreg_by_name ( string name ) [source]

Find the named virtual register

Finds a virtual register with the specified name implemented in this memory and returns its abstraction class instance. If no virtual register with the specified name is found, returns null . Get_vreg_by_name

virtual function uvm_vreg_field get_vfield_by_name ( string name ) [source]

Find the named virtual field

Finds a virtual field with the specified name implemented in this memory and returns its abstraction class instance. If no virtual field with the specified name is found, returns null . Get_vfield_by_name

virtual function uvm_vreg get_vreg_by_offset ( uvm_reg_addr_t offset, uvm_reg_map map ) [source]

Find the virtual register implemented at the specified offset

Finds the virtual register implemented in this memory at the specified offset in the specified address map and returns its abstraction class instance. If no virtual register at the offset is found, returns null . Get_vreg_by_offset

virtual function uvm_reg_addr_t get_offset ( uvm_reg_addr_t offset, uvm_reg_map map ) [source]

Returns the base offset of a memory location

Returns the base offset of the specified location in this memory in an address map .

If no address map is specified and the memory is mapped in only one address map, that address map is used. If the memory is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the memory is not mapped in the specified address map, an error message is issued. Get_offset

virtual function uvm_reg_addr_t get_address ( uvm_reg_addr_t offset, uvm_reg_map map ) [source]

Returns the base external physical address of a memory location

Returns the base external physical address of the specified location in this memory if accessed through the specified address map .

If no address map is specified and the memory is mapped in only one address map, that address map is used. If the memory is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the memory is not mapped in the specified address map, an error message is issued. Get_address

virtual function int get_addresses ( uvm_reg_addr_t offset, uvm_reg_map map, uvm_reg_addr_t addr ) [source]

Identifies the external physical address(es) of a memory location

Computes all of the external physical addresses that must be accessed to completely read or write the specified location in this memory. The addressed are specified in little endian order. Returns the number of bytes transferred on each access.

If no address map is specified and the memory is mapped in only one address map, that address map is used. If the memory is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the memory is not mapped in the specified address map, an error message is issued. Get_addresses

function void set_frontdoor ( uvm_reg_frontdoor ftdr, uvm_reg_map map, string fname, int lineno ) [source]

Set a user-defined frontdoor for this memory

By default, memories are mapped linearly into the address space of the address maps that instantiate them. If memories are accessed using a different mechanism, a user-defined access mechanism must be defined and associated with the corresponding memory abstraction class

If the memory is mapped in multiple address maps, an address map must be specified. Set_frontdoor

function uvm_reg_frontdoor get_frontdoor ( uvm_reg_map map ) [source]

Returns the user-defined frontdoor for this memory

If null , no user-defined frontdoor has been defined. A user-defined frontdoor is defined by using the uvm_mem::set_frontdoor() method.

If the memory is mapped in multiple address maps, an address map must be specified. Get_frontdoor

function void set_backdoor ( uvm_reg_backdoor bkdr, string fname, int lineno ) [source]

Set a user-defined backdoor for this memory

By default, memories are accessed via the built-in string-based DPI routines if an HDL path has been specified using the uvm_mem::configure() or uvm_mem::add_hdl_path() method. If this default mechanism is not suitable (e.g. because the memory is not implemented in pure SystemVerilog) a user-defined access mechanism must be defined and associated with the corresponding memory abstraction class. Set_backdoor

function uvm_reg_backdoor get_backdoor ( bit inherited ) [source]

Returns the user-defined backdoor for this memory

If null , no user-defined backdoor has been defined. A user-defined backdoor is defined by using the uvm_reg::set_backdoor() method.

If inherit is TRUE, returns the backdoor of the parent block if none have been specified for this memory. Get_backdoor

function void clear_hdl_path ( string kind ) [source]

Delete HDL paths

Remove any previously specified HDL path to the memory instance for the specified design abstraction. Clear_hdl_path

function void add_hdl_path ( uvm_hdl_path_slice slices, string kind ) [source]

Add an HDL path

Add the specified HDL path to the memory instance for the specified design abstraction. This method may be called more than once for the same design abstraction if the memory is physically duplicated in the design abstraction. Add_hdl_path

function void add_hdl_path_slice ( string name, int offset, int size, bit first, string kind ) [source]

Add the specified HDL slice to the HDL path for the specified design abstraction. If first is TRUE, starts the specification of a duplicate HDL implementation of the memory. Add_hdl_path_slice

function bit has_hdl_path ( string kind ) [source]

Check if a HDL path is specified

Returns TRUE if the memory instance has a HDL path defined for the specified design abstraction. If no design abstraction is specified, uses the default design abstraction specified for the parent block. Has_hdl_path

function void get_hdl_path ( uvm_hdl_path_concat paths, string kind ) [source]

Get the incremental HDL path(s)

Returns the HDL path(s) defined for the specified design abstraction in the memory instance. Returns only the component of the HDL paths that corresponds to the memory, not a full hierarchical path

If no design abstraction is specified, the default design abstraction for the parent block is used. Get_hdl_path

function void get_full_hdl_path ( uvm_hdl_path_concat paths, string kind, string separator ) [source]

Get the full hierarchical HDL path(s)

Returns the full hierarchical HDL path(s) defined for the specified design abstraction in the memory instance. There may be more than one path returned even if only one path was defined for the memory instance, if any of the parent components have more than one path defined for the same design abstraction

If no design abstraction is specified, the default design abstraction for each ancestor block is used to get each incremental path. Get_full_hdl_path

function void get_hdl_path_kinds ( string kinds ) [source]

Get design abstractions for which HDL paths have been defined. Get_hdl_path_kinds

virtual function uvm_status_e backdoor_read_func ( uvm_reg_item rw ) [source]

User-defined backdoor read access

Override the default string-based DPI backdoor access read for this memory type. Backdoor_read_func

virtual function bit has_coverage ( uvm_reg_cvr_t models ) [source]

Check if memory has coverage model(s)

Returns TRUE if the memory abstraction class contains a coverage model for all of the models specified. Models are specified by adding the symbolic value of individual coverage model as defined in uvm_coverage_model_e. Has_coverage

virtual function uvm_reg_cvr_t set_coverage ( uvm_reg_cvr_t is_on ) [source]

Turns on coverage measurement.

Turns the collection of functional coverage measurements on or off for this memory. The functional coverage measurement is turned on for every coverage model specified using uvm_coverage_model_e symbolic identifiers. Multiple functional coverage models can be specified by adding the functional coverage model identifiers. All other functional coverage models are turned off. Returns the sum of all functional coverage models whose measurements were previously on.

This method can only control the measurement of functional coverage models that are present in the memory abstraction classes, then enabled during construction. See the uvm_mem::has_coverage() method to identify the available functional coverage models. Set_coverage

virtual function bit get_coverage ( uvm_reg_cvr_t is_on ) [source]

Check if coverage measurement is on.

Returns TRUE if measurement for all of the specified functional coverage models are currently on. Multiple functional coverage models can be specified by adding the functional coverage model identifiers.

See uvm_mem::set_coverage() for more details. Get_coverage

function void XsampleX ( uvm_reg_addr_t addr, bit is_read, uvm_reg_map map ) [source]
virtual function void do_print ( uvm_printer printer ) [source]

Core ovm_object operations. Do_print

virtual function string convert2string ( ) [source]

Convert2string

virtual function uvm_object clone ( ) [source]

Clone

virtual function void do_copy ( uvm_object rhs ) [source]

Do_copy

virtual function bit do_compare ( uvm_object rhs, uvm_comparer comparer ) [source]

Do_compare

virtual function void do_pack ( uvm_packer packer ) [source]

Do_pack

virtual function void do_unpack ( uvm_packer packer ) [source]

Do_unpack

Tasks

virtual function write ( uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Write the specified value in a memory location

Write value in the memory location that corresponds to this abstraction class instance at the specified offset using the specified access path . If the memory is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access). If a back-door access path is used, the effect of writing the register through a physical access is mimicked. For example, a read-only memory will not be written. Write

virtual function read ( uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Read the current value from a memory location

Read and return value from the memory location that corresponds to this abstraction class instance at the specified offset using the specified access path . If the register is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access). Read

virtual function burst_write ( uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Write the specified values in memory locations

Burst-write the specified values in the memory locations beginning at the specified offset . If the memory is mapped in more than one address map, an address map must be specified if not using the backdoor. If a back-door access path is used, the effect of writing the register through a physical access is mimicked. For example, a read-only memory will not be written. Burst_write

virtual function burst_read ( uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Read values from memory locations

Burst-read into values the data the memory locations beginning at the specified offset . If the memory is mapped in more than one address map, an address map must be specified if not using the backdoor. If a back-door access path is used, the effect of writing the register through a physical access is mimicked. For example, a read-only memory will not be written. Burst_read

virtual function poke ( uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, string kind, uvm_sequence_base parent, uvm_object extension, string fname, int lineno ) [source]

Deposit the specified value in a memory location

Deposit the value in the DUT memory location corresponding to this abstraction class instance at the specified offset , as-is, using a back-door access.

Uses the HDL path for the design abstraction specified by kind . Poke

virtual function peek ( uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, string kind, uvm_sequence_base parent, uvm_object extension, string fname, int lineno ) [source]

Read the current value from a memory location

Sample the value in the DUT memory location corresponding to this abstraction class instance at the specified offset using a back-door access. The memory location value is sampled, not modified.

Uses the HDL path for the design abstraction specified by kind . Peek

virtual function do_write ( uvm_reg_item rw ) [source]

Do_write

virtual function do_read ( uvm_reg_item rw ) [source]

Do_read

virtual function backdoor_write ( uvm_reg_item rw ) [source]

User-defined backdoor read access

Override the default string-based DPI backdoor access write for this memory type. Backdoor_write

virtual function pre_write ( uvm_reg_item rw ) [source]

Called before memory write.

If the offset , value , access path , or address map are modified, the updated offset, data value, access path or address map will be used to perform the memory operation. If the status is modified to anything other than <UVM_IS_OK>, the operation is aborted.

The registered callback methods are invoked after the invocation of this method.

virtual function post_write ( uvm_reg_item rw ) [source]

Called after memory write.

If the status is modified, the updated status will be returned by the memory operation.

The registered callback methods are invoked before the invocation of this method.

virtual function pre_read ( uvm_reg_item rw ) [source]

Called before memory read.

If the offset , access path or address map are modified, the updated offset, access path or address map will be used to perform the memory operation. If the status is modified to anything other than <UVM_IS_OK>, the operation is aborted.

The registered callback methods are invoked after the invocation of this method.

virtual function post_read ( uvm_reg_item rw ) [source]

Called after memory read.

If the readback data or status is modified, the updated readback //data or status will be returned by the memory operation.

The registered callback methods are invoked before the invocation of this method.