def open_log(self, logger): """logger:object -> ... Begins logging activity with the logger object passed. """ self.log = MemoryLogger(logger) self.log.buffer('created {0}-Kb of {1}-byte address space' .format(str(self._address_space)[:-3], (self._size/self._addressable)), level.INFO)
class BaseMemory(LoggerClient): def open_log(self, logger): """logger:object -> ... Begins logging activity with the logger object passed. """ self.log = MemoryLogger(logger) self.log.buffer('created {0}-Kb of {1}-byte address space' .format(str(self._address_space)[:-3], (self._size/self._addressable)), level.INFO) def open_monitor(self, monitor): self.log.write("Attempted to attach monitor", level.ERROR) def get_memory(self): """-> memory:object Returns a reference to the newly created memory object """ return self def get_word_size(self): """Returns the size of a word in bits. Description: Returns an integer value representing the size of a word. Purpose: Returns a value that can be used in calculations and formatting. Restrictions: N/A Exceptions: N/A Returns: Integer size of a word in bits. """ pass def get_word_spacing(self): """Returns the size in bits of the smallest addressable unit. Description: ISAs specify different addressing methods, a common example at time of writing is byte-addressing which allows 8b blocks of memory to be addressed. This differs from word size: a 32 bit word in a byte-addressed system would have four addresses (skipping over endianness) each pointing to one of the bytes (0..3) of the word. This allows, for example, four shorts to be stored in the same space as an int. Purpose: Word spacing may be used to compute alignment. Restrictions: N/A Exceptions: N/A Returns: Integer size of addressign unit. """ pass def add_segment(self, name, start, end): pass def get_slice(self, end=None, start=None): pass