Implement functions in Cpu.java