Vous êtes sur la page 1sur 3

Getting Started:

Simics Installation:
1- Create a directory on your local machine
2- Copy the simics installation file, simics-pal-3.0.31-linux.tar there.
3- tar xvf simics-pal-3.0.31-linux.tar. This created simics-3.0-install folder.
4- cd simics-3.0-install/
5- sh install-simics.sh //install the simics-3.0.31 directory structure
6- Go to the main directory.
7- mkdir workspace //this will be the working space

Notes:

1- simics-3.0.31/x86-linux/lib //this is the directory that has the g-cache.so and all the other shared object files.
2- In order to compile, type make clean; make g-cache

Booting up the simulator:


1- cd YourMainDirectory/simics-3.0.31/targets/theDesiredTarget/
2- Edit the following file, dredd-common.simics,
3- Change the disk image, the processor count, the processor speed, and the memory size.
4- Go to the workspace, execute

./simics YourPath/simics-3.0.31/targets/YourTargetMachine/dredd-common.simics

//this boots from the disk image and brings up a n processor target system. Note that it brings up a
graphical console window, and you may have to click (or select some options using arrow keys and hit
enter) on the console window to get the booting of the target machine going.

If it asks for username and password, which are "root" and "123456". Once it successfully boots up you can create a
checkpoint for the point beyond the boot up. You cut the simulation and you get the host prompt on the host machine
by pressing Ctrl-C.

After booting, in order to save a checkpoint, write this command “write-configuration mycheckpoint”. In order to exit
simics, just print q, or quit. The simulation back to the point at which the configuration was created, by doing the
following: ./simics mycheckpoint //from the workspace directory, which is where the checkpoint is stored

Next step is to get the benchmarks loaded on to the target machine. This basically requires some way of copying the
binaries and the input files for the benchmarks. Though Simics allows the file system of the host machine to be visible
to the target machine, apparently this did not work for the x86 target. Therefore, you typically need to create a CDROM
image of the benchmark binaries and input files, and then "insert" the CDROM into the target machine.

The following steps explain how to do this for the mcf benchmark, which is an integer benchmark under Spec 2006.
1- First step to copying files from host machine to target machine is to create an iso file. Go to the directory which
has all the binary and input files (whatever files you want to send to the target machine).
2- cd YourDirectory/mcf
3- mkisofs -l -L -o mcf.iso * // * implies all the files in this directory. This creates the mcf.iso file. Move it to the
workspace directory.

In order to "insert" this CDROM image (iso file) to the target machine, you need to bring up the target machine by using
the mycheckpoint image you created earlier: (type the following commands)

1- ./simics mycheckpoint
2- con0.switch-to-text-console //this switches from the default graphical console to a faster text console; should
really be part of some script to avoid having to type this each time after the booting is done. When you create
another checkpoint after loading all the benchmarks, that will include the effect of this command anyway.
3- new-file-cdrom mcf.iso //this will create the cdrom from the iso file, and will return the name of the cdrom,
say mcf.
4- cd0.insert mcf //mcf is what the previous command returned
5- c //continue the target machine
6- mount -o loop /dev/cdrom1 /tmp //this command should be executed on the target machine's console
window. Now the files inside the iso will be present in the /tmp directory on the target machine.
7- mkdir /run (on the host machine, not on simics console)
8- cp -r /tmp/* /run //create /run directory and copy the files from /tmp to /run
9- cd /run

You can now start running the benchmark on the target machine:

1- ./mcf inp.in & //this returns a pid (process id) which you can then use to affinitize the process to a particular
core. [1819] //say this is the pid it returns
2- taskset -p 8 1819 //this associates the process 1819 with core 3, because 8 =>
00000000000000000000000000001000. If you choose mask of 9, that means the process 1819 will only be
timesliced between core 3 and core 0.

So, once you load the benchmark or benchmarks to the target machine, you can start them off, affinitize them to
different cores and then create a checkpoint.

Note that until this point we have not yet attached any timing models. All this is the function simulation of the target
machine with n processors. So to attach the timing piece, we need to set up the caches and memory hierarchy
correctly. This is where you have to write a python script to attach the cache models. Note that, simics documentation
gives examples of such a script. You can use these scripts. (simics user manual).

These scripts should do the following:

1- defines the knobs (parameters) and the connections for the L1 I and D caches, the id-splitter, L2 caches,
memory latency etc.
2- This file also controls how many cycles to runs before the caches are deemed sufficiently warm so that the stats
may be reset.
3- Further, it controls the simulation and when to collect statistics.

Some useful tips:

Consider this command, ./simics -stall -e name="whatever" test.simics

1- -stall should be always there if you need to collect statistics. If no statistics is to be collect, replace it with -
fast.
2- -e flag is used to pass parameters to the .simics (python script)

The cache modules where your code should be implemented is under this path:

/yourDirectory/simics-3.0.1/src/extensions/g-cache

/yourDirectory/simics-3.0.1/src/extensions/g-cache-common

After you make any changes, you need to compile using the command mentioned on page 1.

Vous aimerez peut-être aussi