Class uvm_pkg::uvm_mem_mam
Collaboration Diagram of uvm_mem_mam
Name |
Type |
Description |
---|---|---|
default_alloc |
Variable default_alloc Region allocation policy This object is repeatedly randomized when allocating new regions. |
Constructors
- new(string name, uvm_mem_mam_cfg cfg, uvm_mem mem = null)
Function
new
Create a new manager instance
Create an instance of a memory allocation manager with the specified name and configuration. This instance manages all memory region allocation within the address range specified in the configuration descriptor.
If a reference to a memory abstraction class is provided, the memory locations within the regions can be accessed through the region descriptor, using the uvm_mem_region::read() and uvm_mem_region::write() methods.
- Parameters:
name (string)
cfg (uvm_mem_mam_cfg)
mem (uvm_mem)
Enums
- alloc_mode_e
Type
alloc_mode_e
Memory allocation mode
Specifies how to allocate a memory region
-
GREEDY
-
Consume new, previously unallocated memory
-
THRIFTY
-
Reused previously released memory as much as possible (not yet implemented)
- Enum Items:
GREEDY
THRIFTY
-
- locality_e
Type
locality_e
Location of memory regions
Specifies where to locate new memory regions
-
BROAD
-
Locate new regions randomly throughout the address space
-
NEARBY
-
Locate new regions adjacent to existing regions
- Enum Items:
BROAD
NEARBY
-
Functions
- reconfigure(uvm_mem_mam_cfg cfg = null)
Function
reconfigure
Reconfigure the manager
Modify the maximum and minimum addresses of the address space managed by the allocation manager, allocation mode, or locality. The number of bytes per memory location cannot be modified once an allocation manager has been constructed. All currently allocated regions must fall within the new address space.
Returns the previous configuration.
if no new configuration is specified, simply returns the current configuration.
- Parameters:
cfg (uvm_mem_mam_cfg)
- Return type:
- reserve_region(bit[63:0] start_offset, int unsigned n_bytes, string fname = "", int lineno = 0)
Function
reserve_region
Reserve a specific memory region
Reserve a memory region of the specified number of bytes starting at the specified offset. A descriptor of the reserved region is returned. If the specified region cannot be reserved, null is returned.
It may not be possible to reserve a region because it overlaps with an already-allocated region or it lies outside the address range managed by the memory manager.
Regions can be reserved to create "holes" in the managed address space.
- Parameters:
start_offset (bit[63:0])
n_bytes (int unsigned)
fname (string)
lineno (int)
- Return type:
- request_region(int unsigned n_bytes, uvm_mem_mam_policy alloc = null, string fname = "", int lineno = 0)
Function
request_region
Request and reserve a memory region
Request and reserve a memory region of the specified number of bytes starting at a random location. If an policy is specified, it is randomized to determine the start offset of the region. If no policy is specified, the policy found in the uvm_mem_mam::default_alloc class property is randomized.
A descriptor of the allocated region is returned. If no region can be allocated, null is returned.
It may not be possible to allocate a region because there is no area in the memory with enough consecutive locations to meet the size requirements or because there is another contradiction when randomizing the policy.
If the memory allocation is configured to THRIFTY or NEARBY , a suitable region is first sought procedurally.
- Parameters:
n_bytes (int unsigned)
alloc (uvm_mem_mam_policy)
fname (string)
lineno (int)
- Return type:
- release_region(uvm_mem_region region)
Function
release_region
Release the specified region
Release a previously allocated memory region. An error is issued if the specified region has not been previously allocated or is no longer allocated.
- Parameters:
region (uvm_mem_region)
- release_all_regions()
Function
release_all_regions
Forcibly release all allocated memory regions.
- convert2string()
Function
convert2string
Image of the state of the manager
Create a human-readable description of the state of the memory manager and the currently allocated regions.
- for_each(bit reset = 0)
Function
for_each
Iterate over all currently allocated regions
If reset is TRUE , reset the iterator and return the first allocated region. Returns null when there are no additional allocated regions to iterate on.
- Parameters:
reset (bit)
- Return type:
- get_memory()
Function
get_memory
Get the managed memory implementation
Return the reference to the memory abstraction class for the memory implementing the locations managed by this instance of the allocation manager. Returns null if no memory abstraction class was specified at construction time.
- Return type:
CLASS
uvm_mem_mam
Memory allocation manager
Memory allocation management utility class similar to C's malloc() and free(). A single instance of this class is used to manage a single, contiguous address space.