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?
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?
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):
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:
Then add the arithmetic logic unit (ALU) for addition, subtraction, multiplication, and division:
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!
After that, it unexpectedly entered the ancient programming modeā”棔 program:
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.
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