All things in all posts will help you visualize about the way that computers work generally. Note that it is not the real structure of modern computers, but the way that modern computers work is nearly the same as in my posts. I am sure that if you understand about the way that computers work in my posts, you will easy to learn about all fields of computer afterward. Thank you !!!
In a previous posts, we mentioned the way that byte of data from one register to another register. But, they do not have participation of the clock in the central processing unit (CPU), we only mention briefly. Now, in this post, we will mention ALU operations on two bytes with the participation of clock.
As you know, the clock will control every action in the CPU according to cycles. Each cycle will control one small function in constructing the real function in the CPU. ALU operations also follow this method and are also controlled by clock. Now, we will come to operation of adding two binary numbers for understand the way that CPU work:
I will use the term “control unit” for representing the action of the clock because the clock must connect to many gates for controlling actions in cycles perfectly. The components of the control unit, I will introduce to you later in many next posts. Now, let us come to the way of adding two bytes in computers first.
In the first cycle of the clock, the control unit will enable one register for the byte of data in this register on the bus. Concurrently, the control unit also sets the register TMP to save the byte of data that is on the bus. Finishing the first cycle of clock, we have the first byte in the TMP register.
In the second cycle of the clock, the control unit will enable another register for the byte of data in this register on the bus. Concurrently, the control unit will set the ALU operation of ADD (by three bits of 'op' code) for the byte that is saved in TMP register and the byte that is on the bus and set the result into the ACC register.
In the third cycle of the clock, the control unit will enable the ACC register for the result on the bus and set the result to any register or RAM.
That is all three cycles of the clock that the CPU can conduct to add two binary numbers and save the result. You may wonder how computers perform complex programs based on simple things like ALU calculations? The answer is that computers will conduct very very many simple things like ALU operations for complex programs.
You can think of the fact that the clocks of computers can work at several gHz (several billions cycles per second) and the addition calculation above only takes three cycles. The number of simple things that a CPU can conduct is really enormous per second. So, complex programs may be conducted on computers easily.
Hope you like this post. Thanks for reading and see you later!!!
0 Nhận xét