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
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
-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
<machine>-setup.include
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.
There are several ways to customize the examples provided with Simics. They are listed below ordered by how simple they are to use.
Setting parameters before the script is run can be done in two fashions:
-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"' targets/qsp-x86/firststeps.simics
An example on Linux:
$ ./simics -e '$freq_mhz = 2000' -e '$host_name = "target0"' targets/qsp-x86/firststeps.simics
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
-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.-system.include
files use components to
create their machine definitions. A complete description of components is
provided earlier in this chapter.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"
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.