Completed working code for final CPU design.