simuhw.memory.model package

Module contents

class simuhw.memory.model.MemorizingModel

Bases: object

The super class for all memorizing models.

abstractmethod read(address: bytes | None) bytes | None

Reads the data word from the memory device.

Parameters:

address – The memory address whose data is to be read.

Returns:

The data word read form the specified memory address.

abstractmethod reset() None

Resets the states.

abstractmethod write(address: bytes | None, data: bytes | None) None

Writes the data word to the memory device.

Parameters:
  • address – The memory address whose data is to be written.

  • data – the data word to be written to the specified memory address.

class simuhw.memory.model.MockMemorizingModel(data_func: Callable[[bytes | None], bytes | None] | None = None)

Bases: MemorizingModel

A mock memorizing model.

This model does not memorize any input data, and always outputs the same data at respective addresses. It is intended to be used for experiments and tests.

__init__(data_func: Callable[[bytes | None], bytes | None] | None = None) None

Creates a mock memorizing model.

Parameters:

data_func – The function to return a mock data according to a given address.

read(address: bytes | None) bytes | None

Reads the data word from the memory device.

Parameters:

address – The memory address whose data is to be read.

Returns:

The data word read form the specified memory address.

reset() None

Resets the states.

write(address: bytes | None, data: bytes | None) None

Writes the data word to the memory device.

Parameters:
  • address – The memory address whose data is to be written.

  • data – the data word to be written to the specified memory address.

class simuhw.memory.model.RealMemorizingModel(init_data: bytes | None = None)

Bases: MemorizingModel

A memorizing model retaining actual data.

__init__(init_data: bytes | None = None) None

Creates a memorizing model retaining actual data.

Parameters:

init – The initial data word.

read(address: bytes | None) bytes | None

Reads the data word from the memory device.

Parameters:

address – The memory address whose data is to be read.

Returns:

The data word read form the specified memory address.

reset() None

Resets the states.

write(address: bytes | None, data: bytes | None) None

Writes the data word to the memory device.

Parameters:
  • address – The memory address whose data is to be written.

  • data – the data word to be written to the specified memory address.