1

I'm trying to make a (small) improvement to the leon3 processor (instruction set is SPARC v8) for an academic exercise. Before I decide what to improve, I want to profile a couple of benchmark programs that I want to tailor the improvements to.

I don't have access to a SPARC v8 machine.

Currently, I'm using an evaluation version of 'tsim' (a leon3 simulator) which does profiling at the functional level. Which is not really all that useful.

I have tried weird stuff like compiling with loop unrolling enabled and then counting the interesting instructions in the assembly code, but gcc refuses to unroll the loops, probably because some of them go too deep (e.g. 4 nested 'for' loops).

Ideally, what I'm looking for is a SPARC v8 simulator that runs the benchmark and profiles it at the instruction level (stuff like: 'smul' was executed x times) so that I can decide where to start trying with the improvement. Of course if there are other ways I can do this if not a profiler, I won't mind.

Any ideas?

ArjunShankar
  • 23,020
  • 5
  • 61
  • 83
  • 1) Unrolling is probably only worthwhile at the innermost loop, and only if its contents are very lightweight. (You can always unroll the loop yourself.) 2) Can *cachegrind* do this instruction timing? (I don't know.) – Mike Dunlavey May 13 '11 at 14:09
  • Cachegrind works on Valgrind which does not support SPARC unfortunately. :/ – BjoernD May 13 '11 at 17:45

2 Answers2

1

Simulating the processor in Modelsim could be an option. With Modelsim you can do a functional simulation of the complete LEON3 processor. Although the simulation will be quite slow and probably complete overkill for your purposes but Aeroflex Gaisler provides excellent scripts to work with Modelsim.

A student edition of modelsim can be found here:

http://www.mentor.com/company/higher_ed/modelsim-student-edition

Maurice
  • 476
  • 5
  • 13
  • 1
    It has been more than 2 years since I got around this problem, and the way I eventually did it was using ModelSim. I never came back to update this question since then. This should be the correct answer and I now mark it so. – ArjunShankar Oct 28 '13 at 11:29
1

If you really want to dig that deep into the hardware, you'll find a simulator useful that helps you with that.

Simics comes into mind. They used to have free academic licenses, but since they were bought by Intel, you now need to apply for one, which from my experience takes a couple of weeks. If you are willing to invest this time, you'll certainly get a tool that suits your needs, although they support LEON2, not LEON3, as a model, but for profiling this should be fine.

Qemu also has LEON support but as they're heavily recompiling, it will probably be hard to to instruction-level profiling with it.

BjoernD
  • 4,720
  • 27
  • 32