Recently, I’ve passed a course on Coursera, which is called nand2tetris. The course itself is about building your own computer from the ground up. Though it will be better to quote the instructor himself, what the course is about:
The course guides students and self-learners through the construction of a modern, full-scale computer system – hardware and software – from the ground up. In the process, the students practice many major computer science (CS) abstractions studied in typical CS courses and make them concrete through 12 guided implementation projects.
And so, when I implemented the last module/project from the course, I got a Pong game, written in Jack language (your own language, implemented during the course).
Afterwards, the game is compiled through your own toolchain back into binary code and running on your own CPU. Both toolchain and CPU developed during the course.
If you are interested in the crash course for “How does computers work”, read the article.