basic cpu simulation loop