0

I found this thread regarding the instruction counter, but wanted a bit more info on how the counter works within MARS4. Are the instructions displayed Static or Dynamic? If so, is there a way to find the other one? Thank you!

1 Answers1

0

It's not the instructions that are dynamic or static, it's the count.

A count of instructions executed is a dynamic instruction-count, and the Q&A you linked says that's what MARS's counter gives you.

A static instruction-count is just code-size: look at the binary window after assembling, and subtract the last - first addresses. Instructions = bytes/4. (Minus any padding for alignment if you don't want to count that, but often you do because what really matters is code footprint in the I-cache, and size to be loaded from disk. An instruction that never runs is basically indistinguishable from padding for alignment.)

(So static I-count is pretty trivial, like line count of disassembly. But the dynamic count depends on how the program runs; that's why it's useful to have a dynamic instruction counter in a simulator.)

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847