
Processor Design: An Introduction (1998) - rolph
http://www.gamezero.com/team-0/articles/math_magic/micro/index.html
======
userbinator
I've taught this stuff before and I find it best to start with boolean logic
and combinatorial circuits, then sequential ones, but don't just jump into
building a CPU right away; instead, after discussing clocked/sequential logic
and registers/memory ("storage loops"), I discuss a counter, then connect the
output of the counter to the address inputs of a memory to create a machine
that just reads memory. Adding an "accumulator" and adder turns that into a
rudimentary adding machine, and I note that such a machine was already able to
save --- or eliminate, depending on your viewpoint (although I rarely will go
on an ethical tangent) --- countless hours of human labour at the beginning of
the last century. I then slowly evolve the adding machine into something
closer to a CPU by making it capable of other operations than adding (and this
is also a good time to show the elegance of two's complement), gradually
turning the numbers stored in memory into not just data to be added, but
operation codes, and eventually, with the addition of control flow and
indirection instructions, memory addresses too.

This "bottom-up" approach tends to bore some students, but in my experience
also leads to far deeper understanding than more superficial ones that skip
over a lot of the intermediate steps. It helps to keep the interest by showing
these machines actually working, either with actual logic chips and a
breadboard, or a simulator; and of course give the students hands-on
experience if possible.

~~~
Ao7bei3s
As a student, I found the bottom-up approach quite interesting in a lab
format. (Though it was an FPGA lab - learning about CPU architecture was a
side benefit. And it was at M.Sc. level, so we were somewhat familiar with the
basics.)

We built some fundamental blocks in VHDL (e.g. buffers, mux, adder, memory,
decoder, ALU), combined them into a basic CPU with fetch/decode/execute
stages, added a load/store unit and control flow instructions to make it
turing complete, then added optimizations like pipelining. We wrote some code
to run on it. Then we switched to a LEON3 off the shelve softcore and
implemented our own AMBA peripherals to interface with some real
sensors/actors.

The ability to view the NAND gates your code synthesizes was great. Tracking
signal propagation delays motivated certain basic design decisions very well.
Writing code that runs on a CPU that you also wrote is so incredibly
rewarding. (And it's interesting when a bug can be either in your program or
your CPU.) And finally integrating a real-world softcore really showed how
practical this can actually be even outside of Intel / AMD.

~~~
marvelous
I find the gigatron very interesting for this. It bypasses all the
vhdl/tooling complexity. [https://gigatron.io/](https://gigatron.io/)

------
davidivadavid
In a similar vein, recently released on the MIT OpenCourseWare Youtube
channel, the material from 6.004, Computation Structures:

[https://www.youtube.com/playlist?list=PLUl4u3cNGP62WVs95MNq3...](https://www.youtube.com/playlist?list=PLUl4u3cNGP62WVs95MNq3dQBqY2vGOtQ2)

~~~
bogomipz
This looks great. I hadn't seen this before. Thanks for sharing.

------
trollied
I'm reminded of nandgame - Teaches you to build a CPU/ALU bitwise from scratch
[http://nandgame.com/](http://nandgame.com/)

It's good fun :-)

~~~
wolfgke
MHRD is a similar game:
[https://store.steampowered.com/app/576030/MHRD/](https://store.steampowered.com/app/576030/MHRD/)

Also cf. (somewhat different, but related spirit) Silicon Zeroes
([https://store.steampowered.com/app/684270/Silicon_Zeroes/](https://store.steampowered.com/app/684270/Silicon_Zeroes/))
from the makers of Manufactoria.

------
rolph
there is a light treatment of instruction decoding here, [about 2/3 way
through] targeted to similar level of pre exposure :

[https://hackernoon.com/how-does-a-cpu-work-
af3488d182a2](https://hackernoon.com/how-does-a-cpu-work-af3488d182a2)

the primary post is cut short but i like it for the level of detail presented
to someone with toe in the door digital hardware skills.

~~~
mlukaszek
Ben Eater has an excellent step by step tutorial on creating a complete
(simple) computer on a bunch of breadboards. It's fascinating to watch, and he
does a great job explaining all the details. Highly recommended.

[https://eater.net/8bit](https://eater.net/8bit)

------
mekane8
I have to mention "But How Do It Know?" here as well. I came across it from a
previous HN discussion and picked up a copy. It's really, really good. And
it's a really easy read.
[http://www.buthowdoitknow.com/](http://www.buthowdoitknow.com/)

------
gtycomb
This body of knowledge taught to us from early 1960's onwards is remarkable,
they accomplished so much in the world. Clever 'graphical' algorithms like
Karnaugh Maps that subsume more theoretical structures such as Boolean
Lattices are a delight

