Chapter 49: Build a CPU

49.

Indeed, this logical path is only a logical operation, not a thinking process. The old man agreed.

"Okay, now that we've designed the first hardware instruction, it's not enough, if we want to complete more complex operations, we need more hardware instructions. ”

Cheng Li continued to design a new logical path.

"This is a logic path that is used to execute the stop command, and as long as you enter a 11111111 into this logic path, you can stop the adder. ”

"11111111 conversion to hexadecimal system is FF, and changing to hexagram is 'every day'. ”

This adds another opcode.

"In addition, there are these hardware instructions to reset and zero, save data, transfer data, perform subtraction ......"

As Cheng Li was busy designing a logical spiritual path, one operation code after another was edited by Cheng Li.

In the end, there were 7 operating codes listed by Cheng Liluo.

"'Genkun' code, which performs the function of extracting data. ”

"'Gengen' code, save the data. ”

"'Cankun' code, execute addition. ”

"'Cangun' code, perform subtraction. ”

"'Kankan' code, which performs addition carrying. ”

"'Kanxun' code, executing subtraction debits. ”

"'Daily' code, stop the operation. ”

Cheng Li let out a long breath and said.

"Well, there are these 7 opcodes, which basically meet the function of basic operations. ”

Cheng Li wiped the beads of sweat from his forehead, looking out of breath.

The old man said inconsiderately: "Are there only these 7?"

The Yin-Yang Mouths on the underlying spirit stones are actually the opcodes that have been edited, and there are currently 109 Yin-Yang Mouths that have been found on Qingling Island.

And Cheng Li only made 7 operation codes now, so he will feel less when he is old.

"Enough is enough, we just want to make a calculator now, instead of directly optimizing the spirit armor, with these 7 opcodes, it is no problem to calculate how many bits of data you want.

"For the rest, when the underlying spirit stone is cracked, directly take the core secret pattern set of the spirit armor and use it. Cheng Li waved his hand and said.

"Otherwise, to continue writing the opcode, you need to design the instruction set...... It's what you call the Core Secret Pattern Collection, which is beyond my capabilities. If I was given enough time to figure it out, I might be able to figure it out, but in just 8 days, I would definitely not have time to get it. So at this time it is better to use off-the-shelf. ”

Cheng Li slandered in his heart: "I am just a programmer, not a hardware architect, and I am not an expert in CPU design, so it is too difficult for me to design a set of CPU instruction sets." ”

The instruction set of the CPU is the set of all opcodes, that is, the hardware instruction set.

With an instruction set, you can code the hardware and tell the computer to do all sorts of things.

Therefore, the instruction set is equivalent to the "machine language" where humans and computers communicate directly.

With machine language, assembly language can be developed.

With assembly language, high-level languages can be developed.

Therefore, the CPU instruction set is the lowest level of the program, and it is also the most core program.

Such a core thing is naturally not something that Cheng Li can make up by himself in just a few days.

"Yes, so you still have to wait until the underlying spirit stone is cracked, and then use the inherited spirit armor core secret pattern set. The old man nodded.

The Spirit Armor Core Secret Pattern Set on Qingling Island is actually a complete set of instructions.

Therefore, now that time is pressing, since there is a ready-made instruction set, Cheng Li does not need to work thanklessly to redesign a new set.

What he has to do now is just to make a calculator that can perform automatic calculations and has enough computing power to crack the underlying spirit stone, as long as the underlying spirit stone is cracked and the core secret pattern set of the spirit armor is obtained, Cheng Li will not need to worry about the rest of the matter.

So, with those 7 opcodes, it's enough.

"Now, we're going to connect these logic paths to the registers, and then we're writing these opcodes into the registers. ”

"As a result, we have now made 2 64K_RAM.

"One becomes a register dedicated to the opcode.

"One is a memory dedicated to data. ”

"The length of an opcode is 8-bit binary, or 2-bit hexadecimal. That's 1 byte. ”

64K_RAM, it is 65536*8_RAM, that is, there are 65536 numbers in it, and each number has 8 digits.

"We can use 4-digit hexadecimal to identify these 65,536 numbers, and the address of each number. ”

Each such address is called a memory address.

Because each address can store 8 bits of binary data, each address can hold exactly one opcode.

"So we used the address of 'Qiandui Tiantian' to store the 'Genkun' code. ”

The above sentence is translated in Earth dialect.

In the 76FF address, write the '10' code.

"Then, put the remaining 7 opcodes into the register......"

"Alright, you're done!"

Cheng Li clapped his hands excitedly.

In front of Cheng Li's eyes was an incomparably complicated logical path with a length and width of 20 meters, which was enough to put down a room.

But in Cheng Li's eyes, this incomparably complicated logical path can be clearly divided into three parts.

"This piece is an addition machine that specializes in calculations, and this is the operation unit. ”

"This piece is the RAM dedicated to storing data, which is the storage unit. ”

"This piece is a register dedicated to storing the opcode, which is the control unit. ”

"Computing unit, storage unit, control unit, with these three parts, and combine them, this is a CPU!" Cheng Li excitedly.

"Xiyu Yu?" the old man wondered.

"Well, it's the central processing unit, which you can understand as the core computing unit of the spiritual power computer. Cheng Li replied.

"Now, we have a CPU, plus this control panel as an input device, and a magic lantern as an output device.

"A real spiritual power computer is completely done!"

When everyone present heard this, they all cheered.

They all looked at Cheng Li with extremely admiring eyes.

Just now, many people can't understand the process of designing logical paths, writing opcodes, and creating triggers.

Even if everyone present is a person who has a certain degree of knowledge of yin-yang arithmetic, there are still many people who can't understand it.

But that doesn't prevent them from feeling unaware.

Compared to the addition machine made in the afternoon.

The spiritual power computer that Cheng Li is now making is undoubtedly much more perfect.

Not only does it have data storage capabilities, but it also has opcodes to control operations and can perform more complex calculations.

Even from the perspective of Qingling Island, this spiritual power computer really has the functions of a calculator.

And this is a calculator that can run independently without the need for a bottom spirit stone at all!

Even the old man was a little excited at this time.

"Now that it's done, what are you waiting for, let's start testing. ”

But at this time, Fang Xiaochun suddenly stopped.

"Wait a minute. ”