10.4 Hypersim 10.6 System Panel
API Reference Manual  /  10 Python API  / 

10.5 Flash Memory

Flash Memory Classes and Functions

flash_memory.flash_add_model()

NAME
flash_add_model — add a new flash model
SYNOPSIS
flash_add_model(product_no, config, complete_func)

DESCRIPTION
Adds a new flash model. Instances of the new flash can then be created with the flash_create_memory and flash_create_memory_anon functions.

These are the arguments:

product_no
Product number; e.g., "28F___C3_". Underscores act as wild cards and will match any character.
config
Dictionary containing attribute: value pairs. These attributes are generic-flash-memory attributes; information on available attributes and how to configure them can be found in the reference manual.
complete_fun
Function of type complete_fun(product_no, config) that will be called just before a flash memory is instantiated. product_no is the product number specified by the user. config is the same config dictionary as passed to the flash_add_model function. The complete_fun can modify the attribute values, add new attributes or remove attributes from the configuration, based on e.g. the product_no. The complete_fun should return either an error message (i.e. a string), or a tuple (updated_config, size) where size is the size of one flash chip, in bytes.

RETURN VALUE
True if the flash model was successfully added, or False if it failed.

flash_memory.flash_create_memory()

NAME
flash_create_memory — create a list of objects representing a flash memory
SYNOPSIS
flash_create_memory(name, product_no, interleave, bus_width,
                    files = [],
                    queue = None,
                    accept_smaller_reads = 1,
                    accept_smaller_writes = 0,
                    big_endian = 0)

DESCRIPTION
Returns a list of pre_objects suitable as input for SIM_add_configuration and the total size in bytes of the flash memory. The list and the size is returned as a tuple.

The flash objects will be named, which makes them suitable for use in legacy components. New components should use the function flash_create_memory_anon instead.

Function arguments:

name
Base name for all objects (flash, ram, and image).
product_no
Product name; e.g., "28F160C3T".
interleave
Byte interleaving; one of 1, 2, 4, and 8.
bus_width
Bus width; one of 8, 16, 32, and 64.
files
Same as the file attribute of image objects. Defaults to the empty list.
queue
Queue object to use.
accept_smaller_reads
If 1 (default), the flash device will accept reads smaller than the bus width. if 0, the flash device will complain when receiving smaller reads.
accept_smaller_writes
If 1, the flash device will accept writes smaller than the bus width. If 0 (default), the flash device will complain when receiving smaller writes.
big_endian
If set, the flash device will behave as a big endian device. If not set (default), it will behave as a little endian device.

RETURN VALUE
tuple(object dict, total size in bytes)

flash_memory.flash_create_memory_anon()

NAME
flash_create_memory_anon — create a list of objects representing a flash memory
SYNOPSIS
flash_create_memory_anon(product_no, interleave, bus_width,
                         files = [],
                         queue = None,
                         accept_smaller_reads = 1,
                         accept_smaller_writes = 0,
                         big_endian = 0)

DESCRIPTION
Returns an list of pre_objects suitable as input for SIM_add_configuration and the total size in bytes of the flash memory. The list and the size is returned as a tuple.

The flash objects will be anonymous, which makes them suitable for use in new components. Legacy components should use the function flash_create_memory instead.

Function arguments:

product_no
Product name; e.g., "28F160C3T".
interleave
Byte interleaving; one of 1, 2, 4, and 8.
bus_width
Bus width; one of 8, 16, 32, and 64.
files
Same as the file attribute of image objects. Defaults to the empty list.
queue
Queue object to use.
accept_smaller_reads
If 1 (default), the flash device will accept reads smaller than the bus width. if 0, the flash device will complain when receiving smaller reads.
accept_smaller_writes
If 1, the flash device will accept writes smaller than the bus width. If 0 (default), the flash device will complain when receiving smaller writes.
big_endian
If set, the flash device will behave as a big endian device. If not set (default), it will behave as a little endian device.

RETURN VALUE
tuple(object list, total size in bytes)

10.4 Hypersim 10.6 System Panel