home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mips / 1062 < prev    next >
Encoding:
Text File  |  1992-11-21  |  2.9 KB  |  88 lines

  1. Newsgroups: comp.sys.mips
  2. Path: sparky!uunet!ornl!rsg1.er.usgs.gov!news.cs.indiana.edu!umn.edu!csus.edu!netcom.com!netcom!mjohnson
  3. From: mjohnson@netcom2.Netcom.COM (Mark Johnson)
  4. Subject: Re: MIPS R3000 unknown opcodes
  5. In-Reply-To: najmi@ece.ucdavis.edu's message of 21 Nov 92 00:34:35 GMT
  6. Message-ID: <MJOHNSON.92Nov22073801@netcom2.Netcom.COM>
  7. Sender: mjohnson@netcom.com (Mark Johnson)
  8. Organization: Netcom Online Communications Service
  9. References: <19476@ucdavis.ucdavis.edu>
  10. Distribution: usa
  11. Date: Sun, 22 Nov 1992 15:38:01 GMT
  12. Lines: 74
  13.  
  14.  
  15. In article <19476@ucdavis.ucdavis.edu> najmi@ece.ucdavis.edu (Azfar Najmi) writes:
  16.    > There are a number of opcodes in the output [of pixstats] for
  17.    > which we cannot seem to find definitions.  (We've looked in
  18.    > the "MIPS RISC Architecture" by Gerry Kane).
  19.  
  20.  
  21.  
  22. Indian proverb: Give a man a fish, and he eats for one day.
  23.                 Teach a man to fish, and he eats for a lifetime.
  24.  
  25. The thing to do is PERFORM EXPERIMENTS.  Be active.  Try stuff.
  26. Force the answer out of the machine against its will.
  27.  
  28.  
  29. Here is an algorithm that will solve your problem.
  30.  
  31.    1. Obtain a list of opcodes for the R2000/R3000.  Number
  32.       them from 0 to n.  Since you have the Kane book, this
  33.       step is Completed.
  34.  
  35.    2. Write the C program "helloworld.c":
  36.          #include <stdio.h>
  37.          main() { printf("Hello, world\n"); }
  38.  
  39.    3. Use the "-S" option of the C compiler to generate assembly
  40.       language from the C code: cc -S helloworld.c .  Save
  41.       the assembly sourcecode.
  42.  
  43.    4. Assemble the assembly sourcecode with "as" and pixify
  44.       the binary with "pixie".  Run the pixified binary and
  45.       generate the pixstats.
  46.  
  47.    5. These pixstats are the Control in your experiment.
  48.       Save them.
  49.  
  50.    6. Let i = 0
  51.  
  52.    7. Copy the helloworld assembly sourcecode from step 3 and
  53.       modify the copy by adding one instruction to the code.
  54.       This instruction uses opcode number  i  .
  55.  
  56.    8. Run this new assemly sourcecode through the assembler,
  57.       then pixify the binary, then execute the pixified binary,
  58.       then generate the pixstats.
  59.  
  60.    9. Compare the pixstats from step 8 with the Control
  61.       pixstats from step 5.  This tells you ALL of the
  62.       pixstats categories that opcode number  i  is counted
  63.       in.  Yes, some opcodes are counted in several
  64.       pixstats categories.
  65.  
  66.   10. Increment  i  .  If i >= n , halt,  Otherwise go to step
  67.       number 7.
  68.  
  69.  
  70. When you do this, you will discover that "cop1" is a
  71. category that counts instructions that are executed
  72. by Coprocessor 1 -- which is the R3010 Floating Point
  73. Coprocessor.  See Kane for details.
  74.  
  75. You'll discover that "spec" are special opcodes --
  76. opcodes deemed by the author of pixstats to be
  77. special.
  78.  
  79. You'll discover that the instructions "ctc1", "cfc1",
  80. "mtc1", and "mfc1" (which operate upon the two sets
  81. of registers within coprocessor 1) get counted in a
  82. most unconventional and amusing way.
  83.  
  84.  
  85. Have fun,
  86.  
  87.   Mark Johnson
  88.