The Simics command-line uses GNU Readline to provide command-line editing and a command history buffer.
Let us go through a list of handy commands for Simics common usage:
You can also use stepi (si) to make the simulation progress step by step. You can use the step-cycle (sc) command to make the simulation progress cycle by cycle. Note that as long as you do not use timing models, si and sc are equivalent. For more information, see chapter 17.
If the processor has floating-point registers, pfregs can be used to print them out. By default, the pregs command (and other commands dependent on the CPU) uses the current CPU scheduled by the simulation. You can change the current selected CPU by using the pselect command. This won't affect the simulation scheduling.
You can inspect and change the contents of a register by using the read/write-reg commands. Using % is equivalent to the read-reg command (i.e., %pc, %eax, ...). You can inspect and change the contents of the memory by using the commands get, x and set.
To get statistics concerning the current CPU, you can use the ptime and pstats commands.
--- this is Python's print() simics> @print conf.cpu0.name cpu0 --- this is CLI's echo simics> echo `conf.cpu0.name` cpu0 simics>
Simics can load both Simics scripts (a file containing a list of acceptable commands for the Simics frontend) or Python script with the commands run-command-file and run-python-file. You can read more about Simics scripting in chapter 8.
The modules currently loaded are available through the list-modules command. If a module fails to be loaded, it will be listed by the list-failed-modules command, along with an explanation of the problem. You can use the -v argument to get the exact error message preventing the module from loading.
simics> display ptime display 1: ptime simics> si [cpu0] v:0xfffffffff0000024 p:0x000007fff0000024 nop processor steps cycles time [s] cpu0 1 1 0.0 simics> c 100 [cpu0] v:0x000007fff0102190 p:0x000007fff0102190 sub %o2, 8, %o2 processor steps cycles time [s] cpu0 101 101 0.0 simics> undisplay 1 simics>
To stop the command from being run every time, use undisplay number where number is the number that was returned by display for this specific command (in the example, 1).
The print command allows you to print out a value in different ways (binary, hexadecimal, etc.). You can control the way the command-line handles numbers with the following commands: output-radix allows you to choose a default base for printing numbers; digit-grouping can be used to group digits in a number in a more readable way.
The CLI also supports the following Unix shell-like commands: cd, date, dirs, echo, ls, popd, pushd, pwd. All of them are performed of the host machine, not on the simulated machine.