sim: cpu_sim: refactor into several files, and more oo-like style