README 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. PSIM 1.0.1 - Model of the PowerPC Environments
  2. Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>.
  13. ----------------------------------------------------------------------
  14. PSIM is a program written in extended ANSI-C that implements an
  15. instruction level simulation of the PowerPC environment. It is freely
  16. available in source code form under the terms of the GNU General
  17. Public License (version 3 or later).
  18. The PowerPC Architecture is described as having three levels of
  19. compliance:
  20. UEA - User Environment Architecture
  21. VEA - Virtual Environment Architecture
  22. OEA - Operating Environment Architecture
  23. PSIM both implements all three levels of the PowerPC and includes (for
  24. each level) a corresponding simulated run-time environment.
  25. In addition, PSIM, to the execution unit level, models the performance
  26. of most of the current PowerPC implementations (contributed by Michael
  27. Meissner). This detailed performance monitoring (unlike many other
  28. simulators) resulting in only a relatively marginal reduction in the
  29. simulators performance.
  30. A description of how to build PSIM is contained in the file:
  31. ftp://ftp.ci.com.au/pub/psim/INSTALL
  32. or ftp://cambridge.cygnus.com/pub/psim/INSTALL
  33. while an overview of how to use PSIM is in:
  34. ftp://ftp.ci.com.au/pub/psim/RUN
  35. or ftp://cambridge.cygnus.com/pub/psim/RUN
  36. This file is found in:
  37. ftp://ftp.ci.com.au/pub/psim/README
  38. or ftp://cambridge.cygnus.com/pub/psim/README
  39. Thanks goes firstly to:
  40. Corinthian Engineering Pty Ltd
  41. Cygnus Support
  42. Highland Logic Pty Ltd
  43. who provided the resources needed for making this software available
  44. on the Internet.
  45. More importantly I'd like to thank the following individuals who each
  46. contributed in their own unique way:
  47. Allen Briggs, Bett Koch, David Edelsohn, Gordon Irlam,
  48. Michael Meissner, Bob Mercier, Richard Perini, Dale Rahn,
  49. Richard Stallman, Mitchele Walker
  50. Andrew Cagney
  51. Feb, 1995
  52. ----------------------------------------------------------------------
  53. What features does PSIM include?
  54. Monitoring and modeling
  55. PSIM includes (thanks to Michael Meissner)
  56. a detailed model of most of the PowerPC
  57. implementations to the functional unit level.
  58. SMP
  59. The PowerPC ISA defines SMP synchronizing instructions.
  60. This simulator implements a limited, but functional,
  61. subset of the PowerPC synchronization instructions
  62. behaviour. Programs that restrict their synchronization
  63. primitives to those that work with this functional
  64. sub-set (eg P() and V()) are able to run on the SMP
  65. version of PSIM.
  66. People intending to use this system should study
  67. the code implementing the lwarx instruction.
  68. ENDIAN SUPPORT
  69. PSIM implements the PowerPC's big and little (xor
  70. endian) modes and correctly simulates code that
  71. switches between these two modes.
  72. In addition, psim can model a true little-endian
  73. machine.
  74. ISA (Instruction Set Architecture) models
  75. PSIM includes a model of the UEA, VEA and OEA. This
  76. includes the time base registers (VEA) and HTAB
  77. and BATS (OEA).
  78. In addition, a preliminary model of the 64 bit
  79. PowerPC architecture is implemented.
  80. IO Hardware
  81. PSIM's internals are based around the concept
  82. of a Device Tree. This tree intentionally
  83. resembles that of the Device Tree found in
  84. OpenBoot firmware. PSIM is flexible enough
  85. to allow the user to fully configure this device
  86. tree (and consequently the hardware model) at
  87. run time.
  88. Run-time environments:
  89. PSIM's UEA model includes emulation for BSD
  90. based UNIX system calls.
  91. PSIM's OEA model includes emulation of either:
  92. o OpenBoot client interface
  93. o MOTO's BUG interface.
  94. Floating point
  95. Preliminary support for floating point is included.
  96. Who would be interested in PSIM?
  97. o the curious
  98. Using psim, gdb, gcc and binutils the curious
  99. user can construct an environment that allows
  100. them to play with PowerPC Environment without
  101. the need for real hardware.
  102. o the analyst
  103. PSIM includes many (contributed) monitoring
  104. features which (unlike many other simulators)
  105. do not come with a great penalty in performance.
  106. Thus the performance analyst is able to use
  107. this simulator to analyse the performance of
  108. the system under test.
  109. If PSIM doesn't monitor a components of interest,
  110. the source code is freely available, and hence
  111. there is no hinderance to changing things
  112. to meet a specific analysts needs.
  113. o the serious SW developer
  114. PSIM models all three levels of the PowerPC
  115. Architecture: UEA, VEA and OEA. Further,
  116. the internal design is such that PSIM can
  117. be extended to support additional requirements.
  118. What performance analysis measurements can PSIM perform?
  119. Below is the output from a recent analysis run
  120. (contributed by Michael Meissner):
  121. For the following program:
  122. long
  123. simple_rand ()
  124. {
  125. static unsigned long seed = 47114711;
  126. unsigned long this = seed * 1103515245 + 12345;
  127. seed = this;
  128. /* cut-cut-cut - see the file RUN.psim */
  129. }
  130. Here is the current output generated with the -I switch on a P90
  131. (the compiler used is the development version of GCC with a new
  132. scheduler replacing the old one):
  133. CPU #1 executed 41,994 AND instructions.
  134. CPU #1 executed 519,785 AND Immediate instructions.
  135. .
  136. .
  137. .
  138. CPU #1 executed 1 System Call instruction.
  139. CPU #1 executed 207,746 XOR instructions.
  140. CPU #1 executed 23,740,856 cycles.
  141. CPU #1 executed 10,242,780 stalls waiting for data.
  142. CPU #1 executed 1 stall waiting for a function unit.
  143. .
  144. .
  145. .
  146. CPU #1 executed 3,136,229 branch functional unit instructions.
  147. CPU #1 executed 16,949,396 instructions that were accounted for in timing info.
  148. CPU #1 executed 871,920 data reads.
  149. CPU #1 executed 971,926 data writes.
  150. CPU #1 executed 221 icache misses.
  151. CPU #1 executed 16,949,396 instructions in total.
  152. Simulator speed was 250,731 instructions/second
  153. What motivated PSIM?
  154. As an idea, psim was first discussed seriously during mid
  155. 1994. At that time its main objectives were:
  156. o good performance
  157. Many simulators loose out by only providing
  158. a binary interface to the internals. This
  159. interface eventually becomes a bottle neck
  160. in the simulators performance.
  161. It was intended that PSIM would avoid this
  162. problem by giving the user access to the
  163. full source code.
  164. Further, by exploiting the power of modern
  165. compilers it was hoped that PSIM would achieve
  166. good performance with out having to compromise
  167. its internal design.
  168. o practical portability
  169. Rather than try to be portable to every
  170. C compiler on every platform, it was decided
  171. that PSIM would restrict its self to supporting
  172. ANSI compilers that included the extension
  173. of a long long type.
  174. GCC is one such compiler, consequently PSIM
  175. should be portable to any machine running GCC.
  176. o flexibility in its design
  177. PSIM should allow the user to select the
  178. features required and customise the build
  179. accordingly. By having the source code,
  180. the compiler is able to eliminate any un
  181. used features of the simulator.
  182. After all, let the compiler do the work.
  183. o SMP
  184. A model that allowed the simulation of
  185. SMP platforms with out the large overhead
  186. often encountered with such models.
  187. PSIM achieves each of these objectives.
  188. Is PSIM PowerPC Platform (PPCP) (nee CHRP) Compliant?
  189. No.
  190. Among other things it does not have an Apple ROM socket.
  191. Could PSIM be extended so that it models a CHRP machine?
  192. Yes.
  193. PSIM has been designed with the CHRP spec in mind. To model
  194. a CHRP desktop the following would need to be added:
  195. o An apple ROM socket :-)
  196. o Model of each of the desktop IO devices
  197. o An OpenPIC device.
  198. o RTAS (Run Time Abstraction Services).
  199. o A fully populated device tree.
  200. Is the source code available?
  201. Yes.
  202. The source code to PSIM is available under the terms of
  203. the GNU Public Licence. This allows you to distribute
  204. the source code for free but with certain conditions.
  205. See the file:
  206. ftp://archie.au/gnu/COPYING
  207. For details of the terms and conditions.
  208. Where do I send bugs or report problems?
  209. There is a mailing list (subscribe through majordomo@ci.com.au) at:
  210. powerpc-psim@ci.com.au
  211. If I get the ftp archive updated I post a note to that mailing list.
  212. In addition your welcome to send bugs or problems either to me or to
  213. that e-mail list.
  214. This list currently averages zero articles a day.
  215. Does PSIM have any limitations or problems?
  216. PSIM can't run rs6000/AIX binaries - At present PSIM can only
  217. simulate static executables. Since an AIX executable is
  218. never static, PSIM is unable to simulate its execution.
  219. PSIM is still under development - consequently there are going
  220. to be bugs.
  221. See the file BUGS (included in the distribution) for any
  222. other outstanding issues.