[source]

Class uvm_pkg::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

CLASS

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

variable

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

new(string name, longint unsigned size, int unsigned n_bits, string access = "RW", int has_coverage = UVM_NO_COVERAGE)

Function

new

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

Parameters:
  • name (string)

  • size (longint unsigned)

  • n_bits (int unsigned)

  • access (string)

  • has_coverage (int)

Enums

init_e
Enum Items:
  • UNKNOWNS

  • ZEROES

  • ONES

  • ADDRESS

  • VALUE

  • INCR

  • DECR

Functions

configure(uvm_reg_block parent, string hdl_path = "")

Function

configure

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

Parameters:
set_offset(uvm_reg_map map, uvm_reg_addr_t offset, bit unmapped = 0)

Function

set_offset

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

Parameters:
set_parent(uvm_reg_block parent)

Set_parent

Parameters:

parent (uvm_reg_block) --

Local

add_map(uvm_reg_map map)

Add_map

Parameters:

map (uvm_reg_map) --

Local

Xlock_modelX()

Xlock_modelXlocal

Xadd_vregX(uvm_vreg vreg)

Xadd_vregX

Parameters:

vreg (uvm_vreg) --

Local

Xdelete_vregX(uvm_vreg vreg)

Xdelete_vregX

Parameters:

vreg (uvm_vreg) --

Local

get_full_name()

Function

get_full_name

Get the hierarchical name

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

get_parent()

Function

get_parent

Get the parent block. Get_parent

Return type:

uvm_reg_block

get_block()

Get_block

Return type:

uvm_reg_block

get_n_maps()

Function

get_n_maps

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

is_in_map(uvm_reg_map map)

Function

is_in_map

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

Parameters:

map (uvm_reg_map)

get_maps(uvm_reg_map maps)

Function

get_maps

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

Parameters:

maps (uvm_reg_map)

get_local_map(uvm_reg_map map, string caller = "")

Get_local_map

Parameters:
Return type:

uvm_reg_map

get_default_map(string caller = "")

Get_default_map

Parameters:

caller (string) --

Local

Return type:

uvm_reg_map

get_rights(uvm_reg_map map = null)

Function

get_rights

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

Parameters:

map (uvm_reg_map)

get_access(uvm_reg_map map = null)

Function

get_access

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

Parameters:

map (uvm_reg_map)

get_size()

Function

get_size

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

get_n_bytes()

Function

get_n_bytes

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

get_n_bits()

Function

get_n_bits

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

get_max_size()

Function

get_max_size

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

get_virtual_registers(uvm_vreg regs)

Function

get_virtual_registers

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

Parameters:

regs (uvm_vreg)

get_virtual_fields(uvm_vreg_field fields)

Function

get_virtual_fields

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

Parameters:

fields (uvm_vreg_field)

get_vreg_by_name(string name)

Function

get_vreg_by_name

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

Parameters:

name (string)

Return type:

uvm_vreg

get_vfield_by_name(string name)

Function

get_vfield_by_name

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

Parameters:

name (string)

Return type:

uvm_vreg_field

get_vreg_by_offset(uvm_reg_addr_t offset, uvm_reg_map map = null)

Function

get_vreg_by_offset

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

Parameters:
Return type:

uvm_vreg

get_offset(uvm_reg_addr_t offset = 0, uvm_reg_map map = null)

Function

get_offset

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

Parameters:
Return type:

uvm_reg_addr_t

get_address(uvm_reg_addr_t offset = 0, uvm_reg_map map = null)

Function

get_address

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

Parameters:
Return type:

uvm_reg_addr_t

get_addresses(uvm_reg_addr_t offset = 0, uvm_reg_map map = null, uvm_reg_addr_t addr)

Function

get_addresses

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

Parameters:
set_frontdoor(uvm_reg_frontdoor ftdr, uvm_reg_map map = null, string fname = "", int lineno = 0)

Function

set_frontdoor

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

Parameters:
get_frontdoor(uvm_reg_map map = null)

Function

get_frontdoor

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

Parameters:

map (uvm_reg_map)

Return type:

uvm_reg_frontdoor

set_backdoor(uvm_reg_backdoor bkdr, string fname = "", int lineno = 0)

Function

set_backdoor

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

Parameters:
get_backdoor(bit inherited = 1)

Function

get_backdoor

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

Parameters:

inherited (bit)

Return type:

uvm_reg_backdoor

clear_hdl_path(string kind = "RTL")

Function

clear_hdl_path

Delete HDL paths

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

Parameters:

kind (string)

add_hdl_path(uvm_hdl_path_slice slices, string kind = "RTL")

Function

add_hdl_path

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

Parameters:
add_hdl_path_slice(string name, int offset, int size, bit first = 0, string kind = "RTL")

Function

add_hdl_path_slice

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

Parameters:
  • name (string)

  • offset (int)

  • size (int)

  • first (bit)

  • kind (string)

has_hdl_path(string kind = "")

Function

has_hdl_path

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

Parameters:

kind (string)

get_hdl_path(uvm_hdl_path_concat paths, string kind = "")

Function

get_hdl_path

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

Parameters:
get_full_hdl_path(uvm_hdl_path_concat paths, string kind = "", string separator = ".")

Function

get_full_hdl_path

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

Parameters:
get_hdl_path_kinds(string kinds)

Function

get_hdl_path_kinds

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

Parameters:

kinds (string)

backdoor_read_func(uvm_reg_item rw)

Function

backdoor_read_func

User-defined backdoor read access

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

Parameters:

rw (uvm_reg_item)

Return type:

uvm_status_e

has_coverage(uvm_reg_cvr_t models)

Function

has_coverage

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

Parameters:

models (uvm_reg_cvr_t)

set_coverage(uvm_reg_cvr_t is_on)

Function

set_coverage

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

Parameters:

is_on (uvm_reg_cvr_t)

Return type:

uvm_reg_cvr_t

get_coverage(uvm_reg_cvr_t is_on)

Function

get_coverage

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

Parameters:

is_on (uvm_reg_cvr_t)

XsampleX(uvm_reg_addr_t addr, bit is_read, uvm_reg_map map)
Parameters:
do_print(uvm_printer printer)

Core ovm_object operations. Do_print

Parameters:

printer (uvm_printer)

convert2string()

Convert2string

clone()

Clone

Return type:

uvm_object

do_copy(uvm_object rhs)

Do_copy

Parameters:

rhs (uvm_object)

do_compare(uvm_object rhs, uvm_comparer comparer)

Do_compare

Parameters:
do_pack(uvm_packer packer)

Do_pack

Parameters:

packer (uvm_packer)

do_unpack(uvm_packer packer)

Do_unpack

Parameters:

packer (uvm_packer)

Tasks

write(uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

write

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

Parameters:
read(uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

read

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

Parameters:
burst_write(uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

burst_write

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

Parameters:
burst_read(uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

burst_read

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

Parameters:
poke(uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, string kind = "", uvm_sequence_base parent = null, uvm_object extension = null, string fname = "", int lineno = 0)

Task

poke

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

Parameters:
peek(uvm_status_e status, uvm_reg_addr_t offset, uvm_reg_data_t value, string kind = "", uvm_sequence_base parent = null, uvm_object extension = null, string fname = "", int lineno = 0)

Task

peek

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

Parameters:
do_write(uvm_reg_item rw)

Do_write

Parameters:

rw (uvm_reg_item)

do_read(uvm_reg_item rw)

Do_read

Parameters:

rw (uvm_reg_item)

backdoor_write(uvm_reg_item rw)

Function

backdoor_write

User-defined backdoor read access

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

Parameters:

rw (uvm_reg_item)

pre_write(uvm_reg_item rw)

Task

pre_write

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 , the operation is aborted.

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

Parameters:

rw (uvm_reg_item)

post_write(uvm_reg_item rw)

Task

post_write

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.

Parameters:

rw (uvm_reg_item)

pre_read(uvm_reg_item rw)

Task

pre_read

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 , the operation is aborted.

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

Parameters:

rw (uvm_reg_item)

post_read(uvm_reg_item rw)

Task

post_read

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.

Parameters:

rw (uvm_reg_item)