|Board Name||Power PC|
|CPU Model||IBM PowerPC 600, PowerPC 7xx, PowerPC 970 and other PowerPC families.|
|Runs on Simulator?||YES|
|Non-volatile Memory||Non-volatile memory unspecified.|
|Serial Ports||Serial Ports Unspecified.|
PSIM is a program written in extended ANSI-C that emulates the Instruction Set Architecture of the PowerPC microprocessor family. It is freely available in source code form under the terms of the GNU General Public License (version 2 or later).
The publication The PowerPC Architecture: A specification for a new family of RISC processors </cite> describes the PowerPC Instruction Set Architecture has having three levels of compliance:
UEA - User Instruction Set Architecture "the registers, instructions, storage model, and execution model that are available to all application programs" VEA - Virtual Environment Architecture "the features of the architecture that permit application programs to create or modify code, to share data among programs in a multiprocessing system, and to optimize the performance of storage accesses" OEA - Operating Environment Architecture "the features of the architecture that permit operating systems to allocate and manage storage, to handle errors encountered by application programs, to support I/O devices, and to provide the other services expected of secure, modern, multiprocessor operating systems" PSIM, both implements all three levels of the PowerPC Instruction Set Architecture, and includes, for each level, a number of simulated run-time environments:UEA PSIM can run static programs compiled for any of the following operating systems:
VEA Support for environmental features of the Instruction Set Architecture including: Symetric multi-processing Cache manipulation Time base registers OEA Details of the target PowerPC Platform being modeled can be specified including: firmware (Motorola BUG or OpenFirmware) memory and I/O address maps attached devices interrupt controller (OpenPIC) configuration In addition, PSIM, to the execution unit level, models the performance of most of the current PowerPC implementations (contributed by Michael Meissner). This detailed performance monitoring (unlike many other simulators) resulting in only a relatively marginal reduction in the simulators performance.
This document, firstly explains how to build and run PSIM. It then goes on to discuss the details of the internals of this simulator.
The most recent formal release of PSIM is version 2.1. In addition to describing that release of PSIM, this document also describes extensions that have been proposed for a future release of the PSIM Architecture
Downloading and Executing
To build PSIM you will need the following:
gdb-4.16.tar.gz Available from your favorite GNU ftp site gcc GCC version two includes suport for long long (64bit integer) arrithemetic which PSIM uses. Hence it is recommended that you build PSIM using GCC.
Updates to GDB
From time to time, problems involving the integration of PSIM into gdb are found. While eventually each of these problems is resolved there can be periouds during which a local hack may be needed.
At the time of writing the following were outstanding:
ATTACH command ftp://ftp.ci.com.au/pub/psim/gdb-4.15+attach.diff.gz or ftp://cambridge.cygnus.com/pub/psim/gdb-4.15+attach.diff.gz PSIM, unlike the other simulators included with GDB, is able to load the description of a target machine (including the initial state of all processor registers) from a file. Unfortunatly GDB does not yet have a standard command that facilitates the use of this feature. Until such a command is added, the above patch (hack?) can be used to extend GDB's attach command so that it can be used to initialize the simulators configuration from a file. GDB insns, stalls and cycles pseudo registers ftp://ftp.ci.com.au/pub/psim/gdb-4.16+count.diff.gz or ftp://cambridge.cygnus.com/pub/psim/gdb-4.16+count.diff.gz More recent versions of PSIM include partial support for the pseudo registers cycles, insns and stalls which are used to access profiling information. Before they can be used with gdb-4.16 (built with a more recent PSIM), the above patch should be applied. Reconize svr4 target ftp://ftp.ci.com.au/pub/psim/gdb-4.16+svr4.diff.gz or ftp://cambridge.cygnus.com/pub/psim/gdb-4.16+svr4.diff.gz This patch to gdb's configuration files adds additional targets for which PSIM will be built.
Using PSIM from within GDB
If you built PSIM with gdb then the following is a quick start tutorial.
At present GDB, if configured big-endian (say) unlike PSIM, does not support the debugging of little endian binaries. If you find that your program won't run at all, make certain that GDB and your program's endianness match.
The most important thing is that before you can run the simulator you must enable it. For the simulator, gdb is started like any program:
$ powerpc-unknown-eabi-gdb psim-test/uea/envp.be Next the simulator is enabled. The command target sim accepts the same options as can be specified on the PSIM command line.
(gdb) target sim To trace the communication between psim and gdb specify `target sim -t gdb'. Once enabled, the binary needs to be loaded, any breakpoints of interest set, and the program run:
(gdb) load (gdb) break main (gdb) run . . .
code on this board? What gdb setup? BDM, stub, etc?