6.5 Object Name 7 Moving Data in and out of the Simulation
Simics User's Guide  /  II Feature Overview  /  6 Configuration and Checkpointing  / 

6.6 Ready-to-run Configurations

Simics includes many customizable ready-to-run configurations. Because checkpoint files are by definition static, these example configurations are not checkpoint-based, but rather built on components and scripts to generate a working simulated machine.

The example configurations are located in separate directories for each system architecture: [simics]\targets\architecture. Each of these directories contains a number of Simics scripts (i.e., files containing Simics commands):

<machine>-common.simics
Scripts that define a complete simulated machine, i.e., both hardware and software, that can be run by Simics directly. Each common script uses the corresponding -system.include script to define the hardware, and the -setup.include script for software configuration. The -common.simics scripts may add additional hardware in some cases.

These are the files you want to use to start the standard example machines in this directory.

<machine> in the script name is either a Linux machine name, or a some other name that defines the hardware/software combination.

<machine>-<feature>-common.simics
A script that extends the -common.simics script with a new feature. Many minor features, such as the processor frequency, can be controlled using parameters to the common script, but features that are mutually exclusive are added as separate scripts. Typical examples are scripts that add different diff-files to the same disk image in the system setup.
<architecture-variant>-system.include
A script that defines the hardware of a machine. This script can be shared by several simulated machines that are based on the same hardware. The hardware setup is typically configurable using some standard parameters.
<machine>-setup.include
A script that defines the software and possibly configures the machine to run the selected software, for example setting boot path, and scripting automatic login.

The example configurations are designed to work with the disk images distributed with Simics. The machines are described in the Target Guide corresponding to each architecture.

Several machines may be defined for a given architecture, and thus the corresponding architecture directory will contain several machine-common.simics scripts.

6.6.1 Customizing the Configurations

There are several ways to customize the examples provided with Simics. They are listed below ordered by how simple they are to use.

Parameters
The machine scripts distributed with Simics can be modified by setting parameters (CLI variables) before the script is actually run. This is the easiest way to change the default configuration. Parameters can typically be used to change properties such as the amount of memory, the number of processors and the primary MAC address. The available parameters are listed in each Target Guide.

Setting parameters before the script is run can be done in two fashions:

  1. Use the startup flag -e. The flag must be repeated for each parameter to set.

    An example on Windows:

    $ simics.bat -e '$freq_mhz = 2000' -e '$host_name = "target0"'Line break
              targets/qsp-x86/firststeps.simics
    

    An example on Linux:

    $ ./simics -e '$freq_mhz = 2000' -e '$host_name = "target0"'Line break
              targets/qsp-x86/firststeps.simics
    

  2. Launch Simics without any script, set the parameters at CLI, and run the CLI command run-command-file.

    An example identical to the one above:

    $ simics.bat 
    
    simics> $freq_mhz = 2000
    simics> $host_name = "target0"
    simics> run-command-file targets/qsp-x86/firststeps.simics
    

Scripts
A simulated machine is defined by several scripts, as described above. By replacing the -common.simics file with a user defined script, the system can be configured more in detail while keeping the machine definition provided by the -system.include file. Similarly the -setup.include can be replaced to configure different software on the same machine.
Components
Components represents real hardware items such as PCI cards, motherboards, and disks. Using components to configure a machine provides freedom to set up the simulated machine in any way that is supported by the architecture. The -system.include files use components to create their machine definitions. A complete description of components is provided earlier in this chapter.
Objects and Attributes
A component is implemented by one or more configuration objects in Simics, and each object has several attributes describing it. Configuring machines on the object and attribute level is not supported in Simics, and such configurations may not work in future versions.

Below is another example of a simple configuration based on QSP-x86, that uses parameters to configure two machines slightly differently that both run in the same Simics session.

$freq_mhz = 2000
$host_name = "target0"
run-command-file "%script%/firststeps.simics"

$freq_mhz = 3000
$host_name = "target1"
run-command-file "%script%/firststeps.simics"

6.6.2 Adding Devices to Existing Configurations

The parameters available for each predefined machine allows the user to do minor modifications. It is also possible to extend the ready-to-run configurations with additional components without creating new machine setups from scratch.

Since the machine setup scripts are located in the read-only master installation of Simics, they should not be modified. User files that add new components should instead be placed in the corresponding [project]\targets\architecture directory.

Here is a short example of how to extend the QSP-x86 to add a SATA disk:

# Add disk2
$disk2 = (create-sata-disk-comp $system.disk2 size = $disk2_size)
connect $system.mb.sb.sata_slot[2] $disk2.sata_slot

instantiate-components

Notice, that script requires you to provide a disk image and a valid disk size. Essentially the script will run another script, firststeps.simics, which will create an instantiated QSP-x86 machine, then a SCSI disk is created and connected to that machine, and finally the new disk is instantiated.

It is possible to add many devices to an instantiated Simics machine in a similar manner. In the case a device must be added to the target machine before instantiation, write a script as described above.

6.5 Object Name 7 Moving Data in and out of the Simulation