Add flash module. Refactor the cpu implementation.