Master Craftsman Builds a CPU by Hand

To gain a deeper understanding of the CPU, the master craftsman spent a full six months to “solder point by point” and made a CPU by himself, as shown in the masterpiece below. Related articles:How does the CPU recognize the code we write?

Master Craftsman Builds a CPU by Hand

According to the master craftsman, he mainly used the following three raw materials:

Diodes, transistors, and resistors.

šŸ‘‰Can a CPU be made with a bunch of switches?

The following discusses the process of the master craftsman’s self-made CPU.

Registers

Generally speaking, the structure of a CPU can be roughly divided into the arithmetic logic unit, register unit, and control unit, etc.

The first part he tackled was the register part of the CPU.

The master craftsman designed a 6-bit shift register, as shown in the figure below. Is it different from what you imagined?

Master Craftsman Builds a CPU by Hand

Its function is not only to store but also to shift data left or right under the control of a clock signal.

Program Counter

The second structure the master craftsman dealt with was the Program Counter (PC).

Simply put, its function is to record the position of the program’s operation. This was also the most time-consuming and complex part of the entire project, taking a full three months.

The functions involved in the Program Counter are numerous. For example, the most basic is that after reading each byte of instruction, the count must automatically increment by 1; after the CPU restarts, the count will reset to zero.

Moreover, under different conditions, it must also be able to achieve direct jumps, function calls, returns from functions, and other functionalities.

Hard work pays off; after three months of frustrating time, he managed to complete the most complex module. Power-on testing also went smoothly.

ROM and RAM

The hard drive (ROM) and memory (RAM) are two relatively large parts outside the CPU. The master craftsman used the easily operable HM628512 chip to make ROM and RAM. Below are the HM chip (top), RAM (middle), and ROM (bottom):

Master Craftsman Builds a CPU by Hand

Master Craftsman Builds a CPU by Hand

Master Craftsman Builds a CPU by Hand

After assembling the ROM and RAM, the basic modules of the CPU are basically complete.

Instruction Decoder

Next is to build the instruction decoder.

It is mainly used to parse and execute the CPU instructions sent here:

Master Craftsman Builds a CPU by Hand

Then add the arithmetic logic unit (ALU) for addition, subtraction, multiplication, and division:

Master Craftsman Builds a CPU by Hand

Finally, a general cache must be soldered on; this CPU, made entirely of transistors, diodes, and resistors, is complete! Just looking at the dense components speaks volumes about the magnitude of the project.

Binary Coding

Because this CPU’s instruction set and architecture are self-developed, there is no compatible programming language.

So how can it run?

Purely handwritten original code—binary programming!

Master Craftsman Builds a CPU by Hand

After that, it unexpectedly entered the ancient programming mode—”扣” program:

Master Craftsman Builds a CPU by Hand

With all preparations complete, the moment to witness the miracle has come.

Power-On Testing

Initially, the program did not run smoothly. Even though the master craftsman restarted several times, the marquee effect occasionally still had issues. So, the master craftsman reprogrammed, made all the modifications, and restarted the “扣” program. This time, there were no anomalies.

Master Craftsman Builds a CPU by Hand

This article is reproduced from “STM32 Embedded Development”.

(End)

More exciting:

Yan Shi│Reflections and Suggestions on the “Predicament” of Young Teachers in Higher Education

怐Directory怑”Computer Education” 2022 Issue 10

怐Directory怑”Computer Education” 2022 Issue 9

怐Directory怑”Computer Education” 2022 Issue 8

怐Directory怑”Computer Education” 2022 Issue 7

怐Editorial Board Message怑Professor Li Xiaoming from Peking University: Thoughts from the “Year of Classroom Teaching Improvement”…

Professor Chen Daoxu from Nanjing University: Teaching students to ask questions and teaching students to answer questions, which is more important?

怐Yan Shi Series怑: Development Trends in Computer Disciplines and Their Impact on Computer Education

Professor Li Xiaoming from Peking University: From Fun Mathematics to Fun Algorithms to Fun Programming—A Path for Non-Majors to Experience Computational Thinking?

Reflections on Several Issues in Building a First-Class Computer Discipline

New Engineering and Big Data Professional Construction

Other stones can be used to attack jade—Compilation of Research Articles on Computer Education at Home and Abroad

Leave a Comment