Sim Main

From Msim

Jump to: navigation, search

sim_main is the entry point for the simulator abstraction. Everything related to the simulator can be traced from here (context loading, for example, cannot, as it has nothing to do with simulation).

Fast forwarding

The fast forwarding loop simulates a small portion of the processor. It is enough to warm up the branch predictor and caches as well as invoke various system calls. If fast forwarding is not set to 0, each context will be fast forwarded by -fastfwd X instructions.

  • Unless X == 1, in which case it will use a default value from the .arg file. In general, you won't use 1.

Statistic Clearing

After fast forwarding and before simulator, the program counter is fixed and the branch predictor and caches are cleared (in terms of statistics, not data).

Main Simulation Loop

Here is the order of operations in the main simulation loop:

  • Sanity Checks - Just some checks to make sure nothing is broken.
  • Clearing Power Stats - They need to be reset each cycle in order to record the data for a given cycle
  • CMP: Sanity Checks - If a core has no threads, it does nothing.
  • Commit
  • Update [[Functional Units|FUs]
  • Writeback
  • Wakeup memory operations
  • Wakeup
  • Selection
  • Execute
  • Dispatch
  • Register Rename
  • Fetch
  • Update delay counters
  • Update Power statistics
  • If some benchmark has committed -max:insts X instructions, stop.
  • Personal tools