Building a CPU in a circuit simulation framework[1] was one of my favorite, and most illuminating, projects I've done.
A great book to learn more: http://www.amazon.com/Computer-Systems-Programmers-Perspecti...
[1] http://tams-www.informatik.uni-hamburg.de/applets/hades/webd...