OpenCores
URL https://opencores.org/ocsvn/or2k/or2k/trunk

Subversion Repositories or2k

[/] [or2k/] [trunk/] [analysis-bin/] [insnanalysis/] [README] - Diff between revs 26 and 28

Show entire file | Details | Blame | View Log

Rev 26 Rev 28
Line 24... Line 24...
 
 
And run a test (it needs the or32-elf- toolchain) with:
And run a test (it needs the or32-elf- toolchain) with:
 
 
$ make test
$ make test
 
 
To run the program itself, just give it a binary blob of instructions (usually
 
the output of objcopy -O binary).
 
 
 
Static analysis:
Static analysis:
 
 
For instance the Linux kernel ELF for OR1K can be prepared with the following
To generate a raw binary representation of the instructions that end up in
command:
something like the Linux kernel, take the ELF file that results from compilation
 
and pass it to or32-elf-objcopy like the following:
 
 
$ or32-elf-objcopy -O binary -j .text -S vmlinux vmlinux.text.bin
$ or32-elf-objcopy -O binary -j .text -S vmlinux vmlinux.text.bin
 
 
It is passed to the program like so, and the output is captured by redirecting
Use the -f flag to indicate the input file, and -o to indicate the output file.
stdout.
 
 
 
$ ./insnanalysis vmlinux.text.bin > vmlinux.insnanalysis
$ ./insnanalysis -f vmlinux.text.bin o vmlinux.insnanalysis
 
 
Dynamic analysis with binary execution log from or1ksim:
Dynamic analysis with binary execution log from or1ksim:
 
 
As of revision 202 of the OpenRISC repository, or1ksim is capable of generating
As of revision 202 of the OpenRISC repository, or1ksim is capable of generating
an execution trace log in binary format, logging each instruction executed.
an execution trace log in binary format, logging each instruction executed.
Line 58... Line 55...
The output can be switched between human readable strings and CSV format (ready
The output can be switched between human readable strings and CSV format (ready
to be imported into a spreadsheet application) by uncommenting one of  the
to be imported into a spreadsheet application) by uncommenting one of  the
"#define DISPLAY_" defines in the instruction set header. The program must be
"#define DISPLAY_" defines in the instruction set header. The program must be
recompiled if this is changed.
recompiled if this is changed.
 
 
 
Individual instruction analysis:
 
 
 
Instead of only breaking the instruction up and recording statistics on an
 
opcode basis - the instructions can be tracked in their entireity and statistics
 
on the most frequently seen entire instruction presented. Use the -u flag when
 
running the program. Note that this will make execution time longer. For a
 
binary trace of Linux booting 1.7GB in size, a 2.5GHz Intel Core 2 Duo machine
 
took 30 minutes to parse with the -u option.
 
 
 
 
TODO:
TODO:
 o Collect and display information about l.j and l.jal instruction immediates
 o Collect and display information about l.j and l.jal instruction immediates
 o Add an easy way to switch between human readable and CSV output
 o Add an easy way to switch between human readable and CSV output
 o Figure out how to tack this thing onto a simulator (or1ksim maybe) to give
 o Figure out how to tack this thing onto a simulator (or1ksim for now) to give
   results of execution when that finishes executing, or just how to get the
   results of execution when that finishes executing, or just how to get the
   simulator to output a binary dump of executed instructions to be fed through
   simulator to output a binary dump of executed instructions to be fed through
   this
   this
 o Add support for a list of binary files to be specified at the command line
 o Add support for a list of binary files to be specified at the command line
 o Allow statistics to be collated over different files - this would allow each
 o Allow statistics to be collated over different files - this would allow each
   function to be broken out of a library, or application, and in that regard
   function to be broken out of a library, or application, and in that regard
   the instruction sequence data would then be accurate for static analysis.
   the instruction sequence data would then be accurate for static analysis.
 
 
 
 
July 24, 2010 - Julius Baxter
July 25, 2010 - Julius Baxter
July 25, 2010 - Julius Baxter
July 25, 2010 - Julius Baxter

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.