Chapter 48: Here's How the Code Came About

48.

Cheng Li suddenly realized that he was in a world of cultivation, a fantasy world with all kinds of magical spells and all kinds of powerful Shentong.

It's a magical world that is by no means measurable by common sense.

Therefore, he looked at the 64K_RAM array in front of him, which was very exquisitely made, forcibly suppressed the shock in his heart, and said indifferently on his face: "Very good, in this way, we can move on to the next step." ”

The old man glanced at Cheng Li with a little meaning, and asked, "Seeing that you are not shocked at all, is there such a refining technique above the Nine Heavens?"

"This naturally has a similar refining method. ”

Cheng Li was shocked, and his heart really said that the older a person lives, the better he becomes, and this is no exception, but he can't be deceived by his drunken appearance.

"Then why were you shocked when you saw the Taiji Stone as a non-gate before?

Cheng Li said, sure enough, he accidentally revealed a small flaw just now, but Cheng Li's mind changed sharply, and he immediately thought of his words, and replied almost instantly.

"Even if you are old, you know, my memories have not been fully recovered, and most of them are still in a fragmented state. Therefore, the part of the memory about Taiji Stone may still be lost, so I am shocked.

"Otherwise, if I remember what Xuantian used to build the logic gate, I will directly teach you the best method, and we don't have to explore it ourselves.

"The Spiritual Relay method I remember to construct a logic gate is actually the most primitive method. The construction of the logic gate in the Xuantian is naturally not with a spirit relay, but with a more advanced method.

"I vaguely remember that it was built with something called a crystal spirit tube, and I can't remember exactly how it was built. I think it may be similar to the operation mechanism of Taiji Stone, Yin Sheng Stone, and Yang Sheng Stone. ”

"Crystal Spirit Tube?" Hearing Cheng Li say this, the old man frowned, because he had never heard of this kind of material.

But think about it, what a magical place it is above the nine heavens, and there are some materials that I haven't heard of, and it's normal.

So the old man picked up the wine gourd, took a sip of wine, and said haha.

"Okay, then Cheng Li boy, this 64K 'Ah Boying' has also been refined, what are you going to do next?"

Cheng Li hurriedly said: "Let's make a CPU next."

"Okay, let's get moving. ”

Cheng Li clapped his hands, and soon everyone was busy again.

"Yes, yes, connect the 16-bit counter and the 2-1 selector. Then connect them to 64K-RAM ......"

"Add a control panel here, and then connect the 8-bit adder to this set of components. ”

"Finally, add an 8-bit latch to the adder, so that the latch becomes an accumulator.

"The accumulator will be used to store the intermediate results of the adder calculations, saving the intermediate results of each operation process to be written into memory. ”

"Then, we're going to do another 64K_RAM. ”

Cheng Li looked at Zhong Wu, and then this swarthy man, who looked a little honest, picked up the sledgehammer, and waved it without saying a word.

Then after a cup of tea, another 64K_RAM was made and placed in front of Cheng Li.

"Take this 64K_RAM a little further and you get a register. ”

Registers are a special memory used to store instructions and opcodes inside the CPU, and are an indispensable element inside the CPU.

"Okay, now that you have the registers, you can start designing the opcode...... That's the hardest part. Cheng Li said with a headache.

Different logic gate circuits can construct many flip-flops with different functions, such as the D-shaped flip-flop that has been manufactured by Cheng Li before, which is a logic path with memory function, and finally a latch can be made through the D-type flip-flop.

The so-called opcode is designed by designing a special trigger, and then making this trigger can be triggered by a specific string of unique data, so as to perform a certain operation with a special function.

"How do you design this opcode?" asked the old man.

"First of all, I want to design such a logical path, the function of this logic path is to transfer the data of a certain address in RAM to the accumulator for the adder to calculate. ”

Cheng Li began to connect the logical spirit path non-stop, and then said.

Then this logic path is designed so that only when special data is entered, such as 00010000, such a byte 8 binary data, the logic path is connected and triggered. ”

In logic circuits, input data is like flipping a switch, so you can design a special logic circuit like this, and only when the switch is set to a unique value, it will be triggered.

In this way, 00010000 is artificially given a special function of the instruction code, which we also call the opcode. ”

"Because 00010000, such a binary format is not easy to remember, and we can usually identify it in hexadecimal. ”

"00010000 is converted into hexadecimal is 10, in the words of the hexagram we just defined, it is Gen Kun. ”

"Then this 'Gen Kun' is the opcode, or it can be called the code!"

This kind of unique data with a special function written according to the logic circuit can be called an opcode, or it can be called a hardware instruction, in fact, this is the most primitive code, the most primitive source of all programming language code.

Hardware instructions allow us to tell the computer what to do.

"I see, this opcode looks a bit similar to our Yin-Yang Hexagram, no, this is exactly the same form of expression! I really didn't expect the working principle of Yin-Yang Hexagram to be like this, it evolved in this way!"

At this time, Cheng Li remembered that when he first came to this world, he had lost a yin-yang hexagram in that mecha, which caused the mecha to explode.

In fact, that Yin and Yang hexagram is a piece of assembly code, which is still a little different from the operation code that Cheng Li is getting now.

The opcode that Cheng Li is getting now is actually the lowest level of machine language.

Assembly language is a programming language that is further derived from machine language.

The two are not identical.

On Qingling Island, in fact, there is already a basis for compilation, but they are all used to using the black box of the underlying spirit stone, and they have not studied its working principle deeply, and they don't know why it is, so they have been stagnant, and they don't know how to develop new interfaces, nor do they know how to improve the opcode.

But now after being demonstrated by Cheng Li like this, the old man with the deepest attainments in yin-yang arithmetic has a feeling of seeing the blue sky through the clouds and mist, if he is not in a hurry to continue watching, he is afraid that he will run to the side and have an epiphany.

"That's right, your yin-yang hexagram is actually the same kind of thing as the opcode I got now. Cheng Li said, "However, the opcode I am getting now is a machine language, and it needs to be further evolved before it can become an assembly language like the Yin-Yang hexagram." ”

Arian Lao nodded and said, "That is to say, we only need to enter the 'Genkun' data in this logical spiritual path now, then this logical spiritual path will perform the special function we want." ”

Someone exclaimed on the sidelines: "The Logic Spiritual Path can make corresponding operations according to the data we enter, and it feels like it is alive." ”

Cheng Li shook his head: "No, this is still far from life, the logical spirit path doesn't think, it's just a reflexive trigger operation." ”

The fact that the Logic Path responds to the hardware instruction of "Genkun" and acts accordingly does not mean that the computer has become a living thing.

In fact, the computer does not analyze hardware instructions to decide what to do, it only triggers actions through logic circuits.

Therefore, as long as the hardware instructions meet the design requirements of the circuit, the logic circuit will mechanically perform the corresponding operation.

Therefore, it can be said that for computers built with logic gate circuits, there is only logic, but no thinking.

So, computers are lifeless.

This is not possible unless the form in which computers are built evolves from logic gates to more advanced forms.

For example, quantum computers.

However, this is beyond Cheng Li's current ability.

At this time, he will not be ambitious, but is splicing one logical path after another in a down-to-earth manner.