Function simics::api::simulator::configuration::add_configuration

source ·
pub fn add_configuration<P>(
    object_list: *mut PreConfObjectSet,
    file: P,
) -> Result<()>
where P: AsRef<Path>,
Expand description

Add a configuration

This function creates objects from the parse objects in set and adds the initialized objects to the current configuration (creating one if necessary). When called from Python (which is the intended usage), the configuration set is a sequence (list or tuple) of pre_conf_object Python objects, or a dictionary of the form {name : pre_conf_object}.

The file argument is the name of the file that a configuration was read from, and should be set to None/NULL if not used.

The following examples are written in Python. As they do not map any devices in phys_mem, they will not work as stand-alone simulations.

Example when set is a sequence:

    clock = pre_conf_object('timer', 'clock')
    clock.freq_mhz = 20
    space = pre_conf_object('phys_mem', 'memory-space')
    space.queue = clock

    SIM_add_configuration([clock, space], None)

Example when set is a dictionary:

    objects = {}
    objects['clock'] = pre_conf_object('timer', 'clock')
    objects['clock'].freq_mhz = 20
    objects['space'] = pre_conf_object('phys_mem', 'memory-space')
    objects['space'].queue = objects['clock']

    SIM_add_configuration(objects, None)

§Context

Global Context