flash_memory
import flash_memory
flash_memory.flash_add_model(product_no, config, complete_func)
Add a new flash model.
Adds a new flash model. Instances of the new flash can then be created with the flash_memory.flash_create_memory and flash_memory.flash_create_memory_anon functions.
These are the arguments:
product_noconfigattribute: 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_funcomplete_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.Returns true if the flash model was successfully added or False if it failed.
flash_memory.flash_create_memory(
name,
product_no,
interleave,
bus_width,
files=[],
queue=None,
accept_smaller_reads=1,
accept_smaller_writes=0,
big_endian=0
)
Creates a list of objects representing a flash memory.
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_memory.flash_create_memory_anon instead.
nameproduct_nointerleavebus_widthfilesfile attribute of image objects. Defaults to the empty list.queueaccept_smaller_readsaccept_smaller_writesbig_endianReturns a tuple with (object dict, total size in bytes).
flash_memory.flash_create_memory_anon(
product_no,
interleave,
bus_width,
files=[],
queue=None,
accept_smaller_reads=1,
accept_smaller_writes=0,
big_endian=0
)
Creates a list of objects representing a flash memory.
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_memory.flash_create_memory instead.
product_nointerleavebus_widthfilesfile attribute of image objects. Defaults to the empty list.queueaccept_smaller_readsaccept_smaller_writesbig_endianReturns a tuple with (object list, total size in bytes).