Class uvm_mem_mam
Name |
Type |
Description |
---|---|---|
default_alloc |
Region allocation policy This object is repeatedly randomized when allocating new regions. |
Constructors
- function new ( string name, uvm_mem_mam_cfg cfg, uvm_mem mem ) [source]
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.
Enums
Functions
- function uvm_mem_mam_cfg reconfigure ( uvm_mem_mam_cfg cfg ) [source]
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.
- function uvm_mem_region reserve_region ( bit[63:0] start_offset, int unsigned n_bytes, string fname, int lineno ) [source]
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.
- function uvm_mem_region request_region ( int unsigned n_bytes, uvm_mem_mam_policy alloc, string fname, int lineno ) [source]
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.
- function void release_region ( uvm_mem_region region ) [source]
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.
- function uvm_mem_region for_each ( bit reset ) [source]
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.
- function uvm_mem get_memory ( ) [source]
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.
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.