| |
- __builtin__.object
-
- MemoryBlock
- NaturalMemoryManager
- pcisim.lib.MyException(exceptions.Exception)
-
- NotPowerOfTwo
- OutOfMemory
class MemoryBlock(__builtin__.object) |
|
Represents a virtual memory block.
@ATTRIBS
(int) start : block start virtual address
(int) end : block end virtual address
(int) size : block virtual size |
|
Methods defined here:
- __init__(self, address=0, size=0)
- @PARAMS
(int) address : block start virtual address
(int) size : block virtual size
@NOTES
self.end address is calculated.
- calc_bounds(self)
- Calculates self.end address.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class NaturalMemoryManager(__builtin__.object) |
|
Emulates memory allocation for natural aligned addresses.
Allocation algorithms are the following:
a) Place a new block in first available position
b) Relocate blocks to tide up space
Algorithm b) is only used when free memory is not enough. Note that
if b) fails too, OutOfMemory exception is raised.
@ATTRIBS
(list)(MemoryBlock) blocks : allocated memory blocks |
|
Methods defined here:
- __init__(self, memsize)
- @PARAMS
(int) memsize : virtual memory size
- alloc(self, blksize)
- Request allocation of a MemoryBlock.
@PARAMS
(int) blksize : size of the block to allocate.
@RETURN
(MemoryBlock) allocated block
@RAISES
- OutOfMemory if no memory is available.
- NotPowerOfTwo if blksize is not naturally aligned.
- free(self)
- Frees all the allocated memory and destroyes blocks.
- get_memfree(self)
- Get free virtual memsize.
@RETURN
(int) virtual free memory size
- get_memsize(self)
- Get total virtual memsize.
@RETURN
(int) virtual memory size
- get_relocated(self)
- Get last relocated blocks.
@RETURN
(MemoryBlock)(listiterator) relocated blocks.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
|