3 PSIM 1.0.1 - Model of the PowerPC Environments
6 Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 ----------------------------------------------------------------------
26 PSIM is a program written in extended ANSI-C that implements an
27 instruction level simulation of the PowerPC environment. It is freely
28 available in source code form under the terms of the GNU General
29 Public License (version 2 or later).
31 The PowerPC Architecture is described as having three levels of
34 UEA - User Environment Architecture
35 VEA - Virtual Environment Architecture
36 OEA - Operating Environment Architecture
38 PSIM both implements all three levels of the PowerPC and includes (for
39 each level) a corresponding simulated run-time environment.
41 In addition, PSIM, to the execution unit level, models the performance
42 of most of the current PowerPC implementations (contributed by Michael
43 Meissner). This detailed performance monitoring (unlike many other
44 simulators) resulting in only a relatively marginal reduction in the
45 simulators performance.
48 A description of how to build PSIM is contained in the file:
50 ftp://ftp.ci.com.au/pub/psim/INSTALL
51 or ftp://cambridge.cygnus.com/pub/psim/INSTALL
53 while an overview of how to use PSIM is in:
55 ftp://ftp.ci.com.au/pub/psim/RUN
56 or ftp://cambridge.cygnus.com/pub/psim/RUN
58 This file is found in:
60 ftp://ftp.ci.com.au/pub/psim/README
61 or ftp://cambridge.cygnus.com/pub/psim/README
64 Thanks goes firstly to:
66 Corinthian Engineering Pty Ltd
68 Highland Logic Pty Ltd
70 who provided the resources needed for making this software available
73 More importantly I'd like to thank the following individuals who each
74 contributed in their own unique way:
76 Allen Briggs, Bett Koch, David Edelsohn, Gordon Irlam,
77 Michael Meissner, Bob Mercier, Richard Perini, Dale Rahn,
78 Richard Stallman, Mitchele Walker
85 ----------------------------------------------------------------------
88 What features does PSIM include?
90 Monitoring and modeling
92 PSIM includes (thanks to Michael Meissner)
93 a detailed model of most of the PowerPC
94 implementations to the functional unit level.
99 The PowerPC ISA defines SMP synchronizing instructions.
100 This simulator implements a limited, but functional,
101 subset of the PowerPC synchronization instructions
102 behaviour. Programs that restrict their synchronization
103 primitives to those that work with this functional
104 sub-set (eg P() and V()) are able to run on the SMP
107 People intending to use this system should study
108 the code implementing the lwarx instruction.
112 PSIM implements the PowerPC's big and little (xor
113 endian) modes and correctly simulates code that
114 switches between these two modes.
116 In addition, psim can model a true little-endian
119 ISA (Instruction Set Architecture) models
121 PSIM includes a model of the UEA, VEA and OEA. This
122 includes the time base registers (VEA) and HTAB
125 In addition, a preliminary model of the 64 bit
126 PowerPC architecture is implemented.
130 PSIM's internals are based around the concept
131 of a Device Tree. This tree intentionally
132 resembles that of the Device Tree found in
133 OpenBoot firmware. PSIM is flexible enough
134 to allow the user to fully configure this device
135 tree (and consequently the hardware model) at
138 Run-time environments:
140 PSIM's UEA model includes emulation for BSD
141 based UNIX system calls.
143 PSIM's OEA model includes emulation of either:
145 o OpenBoot client interface
147 o MOTO's BUG interface.
152 Preliminary support for floating point is included.
155 Who would be interested in PSIM?
159 Using psim, gdb, gcc and binutils the curious
160 user can construct an environment that allows
161 them to play with PowerPC Environment without
162 the need for real hardware.
167 PSIM includes many (contributed) monitoring
168 features which (unlike many other simulators)
169 do not come with a great penalty in performance.
171 Thus the performance analyst is able to use
172 this simulator to analyse the performance of
173 the system under test.
175 If PSIM doesn't monitor a components of interest,
176 the source code is freely available, and hence
177 there is no hinderance to changing things
178 to meet a specific analysts needs.
181 o the serious SW developer
183 PSIM models all three levels of the PowerPC
184 Architecture: UEA, VEA and OEA. Further,
185 the internal design is such that PSIM can
186 be extended to support additional requirements.
189 What performance analysis measurements can PSIM perform?
191 Below is the output from a recent analysis run
192 (contributed by Michael Meissner):
194 For the following program:
199 static unsigned long seed = 47114711;
200 unsigned long this = seed * 1103515245 + 12345;
202 /* cut-cut-cut - see the file RUN.psim */
205 Here is the current output generated with the -I switch on a P90
206 (the compiler used is the development version of GCC with a new
207 scheduler replacing the old one):
209 CPU #1 executed 41,994 AND instructions.
210 CPU #1 executed 519,785 AND Immediate instructions.
214 CPU #1 executed 1 System Call instruction.
215 CPU #1 executed 207,746 XOR instructions.
217 CPU #1 executed 23,740,856 cycles.
218 CPU #1 executed 10,242,780 stalls waiting for data.
219 CPU #1 executed 1 stall waiting for a function unit.
223 CPU #1 executed 3,136,229 branch functional unit instructions.
224 CPU #1 executed 16,949,396 instructions that were accounted for in timing info.
225 CPU #1 executed 871,920 data reads.
226 CPU #1 executed 971,926 data writes.
227 CPU #1 executed 221 icache misses.
228 CPU #1 executed 16,949,396 instructions in total.
230 Simulator speed was 250,731 instructions/second
235 As an idea, psim was first discussed seriously during mid
236 1994. At that time its main objectives were:
241 Many simulators loose out by only providing
242 a binary interface to the internals. This
243 interface eventually becomes a bottle neck
244 in the simulators performance.
246 It was intended that PSIM would avoid this
247 problem by giving the user access to the
250 Further, by exploiting the power of modern
251 compilers it was hoped that PSIM would achieve
252 good performance with out having to compromise
256 o practical portability
258 Rather than try to be portable to every
259 C compiler on every platform, it was decided
260 that PSIM would restrict its self to supporting
261 ANSI compilers that included the extension
264 GCC is one such compiler, consequently PSIM
265 should be portable to any machine running GCC.
268 o flexibility in its design
270 PSIM should allow the user to select the
271 features required and customise the build
272 accordingly. By having the source code,
273 the compiler is able to eliminate any un
274 used features of the simulator.
276 After all, let the compiler do the work.
281 A model that allowed the simulation of
282 SMP platforms with out the large overhead
283 often encountered with such models.
286 PSIM achieves each of these objectives.
289 Is PSIM PowerPC Platform (PPCP) (nee CHRP) Compliant?
293 Among other things it does not have an Apple ROM socket.
296 Could PSIM be extended so that it models a CHRP machine?
300 PSIM has been designed with the CHRP spec in mind. To model
301 a CHRP desktop the following would need to be added:
303 o An apple ROM socket :-)
305 o Model of each of the desktop IO devices
309 o RTAS (Run Time Abstraction Services).
311 o A fully populated device tree.
314 Is the source code available?
318 The source code to PSIM is available under the terms of
319 the GNU Public Licence. This allows you to distribute
320 the source code for free but with certain conditions.
324 ftp://archie.au/gnu/COPYING
326 For details of the terms and conditions.
329 Where do I send bugs or report problems?
331 There is a mailing list (subscribe through majordomo@ci.com.au) at:
333 powerpc-psim@ci.com.au
335 If I get the ftp archive updated I post a note to that mailing list.
336 In addition your welcome to send bugs or problems either to me or to
339 This list currently averages zero articles a day.
342 Does PSIM have any limitations or problems?
344 PSIM can't run rs6000/AIX binaries - At present PSIM can only
345 simulate static executables. Since an AIX executable is
346 never static, PSIM is unable to simulate its execution.
348 PSIM is still under development - consequently there are going
351 See the file BUGS (included in the distribution) for any
352 other outstanding issues.