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 !!!
Sometime, we will need to shift one byte a bit to the left or to the right in computers. This thing is needed in some cases. Let’s look at the right shifter and read explanation below to understand it:
In the diagram, you can see the key feature that makes the right shifter work is the way wires are connected. There is not any complicated structure that needs to be built with the shifter. The first output bit in the R1 register connects to the second input bit in the R2 register, the second for the third and then continues for remaining bits in the byte of R1. Eventually, we have a separate eighth bit.
So, when the “e” signal from R1 is “on” and “s” signal from R2 is “on” then “off”, the signal from first to seventh output bits of R1 register will be transported to output bits that are from second to eighth of R2. The eighth output bit of R1 will be transported to another part of computers.
The eighth output bit of R1 will be called “shift out”. This “shift out” will connect to another part of computers. Now, look at the R2, you will need a bit for the first input bit of R2 because R1 does not connect to the first bit of R2. That first bit is called “shift in”. This “shift in” comes from another part of the computer, and can be the “shift out” of another register.
Now, you can see that the byte that is in the R1 register will be shifted one bit to the right in the R2 register. And one bit from somewhere in the computer can go in the first bit of R2 register to complete a shifting of byte in R1.
For example, if we have a byte of 00111000 in R1 register, we will have 00011100 in R2 register. You can see that the original byte is shifted one bit to the right. If the “shift in” is “1”, the result in R2 will be 10011100.
Likewise, we also have left shifter that work in the opposite way. Look at the picture below to understand this type of shifter:
You can see it is opposite to the right shifter. Now, the eighth output bit in the R1 register will connect to the seventh input bit in the R2 register, the seventh output bit of the R1 register will connect to the sixth input of the R2 register and continue for the remaining bits. Eventually, we have the first output bit in R1 remaining. The “shift out” now will be the first output bit of R1 register.
So, when the “e” signal from R1 is “on” and “s” signal from R2 is “on” then “off”, the output bits from eighth to second bits of R1 register will be transported to output bits that are from seventh to first of R2. The first output bit of R1 will be transported to another part of computers.
The “shift in” will be the eighth input bit in the R2 register now. As you can see, the byte in R1 register is shifted one bit to the left in the R2 register and one bit from somewhere in the computer can go in the eighth bit of R2 register to complete a shifting of byte in R1.
For example, if we have a byte of 00111000 in R1 register, we will have 01110000 in R2 register. You can see that the original byte is shifted one bit to the left. If the “shift in” is “1”, the result in R2 will be 01110001.
You will wonder what these shifters are used for? Yeah, it is used in multiplication with two in computers. Because computers use binary systems in calculations, multiplying with two will occur regularly. When you use the left shifter, the result will be two times the original value. Conversely, when you use the left shifter, the result will be a half the original value.
For example, with a binary number of 00000001 (value of 1), when you use the left shifter with it, you will receive 00000010 (value of 2). Another, with 00011000 (value of 24), you will receive 00110000 (value of 48). In reality, you only need to think binary numbers like decimal numbers when performing shifting. For example, with a number of 10 in the decimal system, you can use the left shifter with it, you will receive 100. It is very easy!!!
Now, we will perform a familiar work that is abstracting these shifters for building larger structures easier. Look at the symbol below and remember them for left and right shifters:
Thanks for reading and see you later!!!
0 Nhận xét