An object can be identified using more than one name. This section describes the different ways of identifying an object.
All objects have a name that is used when printing log messages, writing checkpoints, in CLI commands, etc. The SIM_object_name function returns this object name. This name will be referred to as the object name in this section, even though an object can have several names for identification.
The object name is the name the object is given when created, or the objects location in the hierarchy.
An object can be given a name when created. The SIM_create_object, SIM_add_configuration, or SIM_set_configuration functions takes the object name as argument. The given name can be a string without dots "foo", a string with dots "cmp0.foo", an empty string "", or None. This section will describe how the given name affects the object name.
An object's hierarchical location is defined by its component and component_slot attributes. The hierarchical location for an object is the name of the component that the object's component attribute points at, and the component's component_slot attribute string, concatenated with a dot. For example, an object that belongs to a component named "cmp0" with the slot name "bar" has the hierarchical location "cmp0.bar".
All objects that reside in a slot in a component have valid component and component_slot attributes. It is the component's responsibility that the attributes are valid. The attributes are set when an object is added to a slot. A name that contains dots is a hierarchical location.
All objects also have an ID. The SIM_object_id function returns the object ID as a string. The object ID is unique, never changes, and will be saved in checkpoints. The object ID will not change even if the object is moved around in the hierarchy or is given a new name.
The object name and object ID are always unique. Creating an object and giving it a name that already exist will generate an error.
If the given name is a hierarchical location, an object will be
added to that hierarchical location even if the
component and component_slot attributes are
not set. Simics will extract the component name and slot name from the
given name. This information is then used when looking up the component
and adding the object to the slot via the component
interface. An object given the name "cmp0.cmp1.foo" belongs to the
component "cmp0.cmp1" and has the slot name "foo". Note that the
component "cmp1" in this example belongs to the component "cmp0".
An object given a name without dots, e.g., "foo", will get a name that is the hierarchical location of the object if the component and component_slot attributes are valid. Otherwise it will get the name "foo", which means that the object does not reside in any slot in a component. The object will also get an automatically assigned unique object ID, unless legacy_object_id is set. In that case the object name is used as object ID.
An object given a name with dots "cmp0.foo" gets the name "cmp0.foo" or, if it is put in the slot "bar", the name "cmp0.bar", its hierarchical location, and an object ID of the form "obj_XYZ".
An object given an empty name "", or None, will get a hierarchical location as name, if the component and component_slot attributes are valid, otherwise a name of the form "obj_XYZ". The object ID will always be of the form "obj_XYZ", identical to the object name if component and component_slot attributes are invalid.
Given Name | Name (Slot = None) | Name (Slot = bar) | ID | Name After Move |
foo | foo | cmp0.bar | obj_XYZ | cmp1.smurf |
cmp0.foo | cmp0.foo | cmp0.bar | obj_XYZ | cmp1.smurf |
None | obj_XYZ | cmp0.bar | obj_XYZ | cmp1.smurf |
The given name is the name that the user has provided. Name is the name the object gets when created, depending on if component and component_slot are set: Slot = None when they are not set; Slot = bar when they are set and component_slot is bar. ID is the unique object ID. Name After Move is the name the object gets after being moved to cmp1 to a slot named smurf.