So in this article, we will look at a piece of hardware called the shift register and their modes of operation. But we wont stop there. Because we will also look at their use case, advantages & disadvantages.
So if you are new to computer hardware or learning about what goes inside a microprocessor, then brace yourself. As this is going to be an eye opener for you on how computer works!
So are you ready? Great! Then let us go!
To start with, let us ask ourselves the basic question – What is a shift register? Because only when we know what it is, does it make sense to learn about shift register modes of operation. Right? Let us answer that first!
What Is A Shift Register?
A shift register is a piece of circuit that you will find inside a microprocessor. It is used to store and modify data. Now this is one of the simplest explanation I can give for a 2nd grade student.
But if you are some one who is studying about computers, this is just not sufficient. So I will have to explain it in a bit more detail. Alright? I will be getting a bit technical here. But it is how you will get a solid understanding of shift register. So you will have to bare it. Okay?
Technically, a shift register is made up of a bunch of Flip Flops. So as you know, a flip flop is a circuit that can store information. It can store data that is in one of the two states – 0 or 1. Right? So what happens when you connect a bunch of these flip flops together? You get a “register“.
So a register is a circuit made up of a bunch of flip flops that can store data having values in 0s or 1s. Now, if that is the definition of a register, then what is a shift register?
A shift register is a type of register where data is shifted from one flip flop to another within the register. But this shift of data does not happen by itself. Instead, it needs a clock signal to do so. So for every input clock cycle, the data get shifted from one flip flop to another. Hence the name “Shift Registers”. Aha! That name now makes so much sense. Right?
The above pic shows how it works. So as you can see here, for every clock cycle, a new input bit enters Bit0. But at the same time, existing Bit0 value shifts to Bit1, Bit1 to Bit2 and so on. But what happens to current value of Bit7? The register will just throw it out! Removed forever!
Now there is one thing for you to notice in the above pic. It is that the bit value here is shifting left. Right? Because of this, we call it a “Left Shift Register“.
But does that mean we also have a “Right Shift Register”? You bet! We do have a right shift register where input is fed to Bit7 & Bit0 will thrown out for every clock cycle!
Where Do We Use A Shift Register?
So now that we know how a Shift register works, let us see where we can use it.
Using Shift Register For Multiplication
When you shift bits in a byte to the left, the value of the byte is multiplied by 2! So we can use a left shift register whenever we want to multiply a byte by 2.
Using Shift Register For Division
When you shift a byte to the right, you are dividing it’s value by 2. So we can use a right shift register whenever we want to divide a byte by 2!
So with that, let us now look at the different modes of operation of a shift register.
Shift Register Modes Of Operation
A shift register will work in one these four modes:
- Serial In Serial Out (SISO) Mode
- Serial In Parallel Out (SIPO) Mode
- Parallel In Serial Out (PISO) Mode
- Parallel In Parallel Out (PIPO) Mode
So let us take a look at each of these modes one by one. Alright? Here we go!
Serial In Serial Out (SISO) Mode
In this mode of operation, the data is fed into the shift register serially for every clock cycle. That is, for every clock cycle, the data is shifted either to the right or left serially. The output is also taken out one bit at a time. So both inputs and outputs are serial here. Hence the name SISO. So then how does the Flip Flop connection look like? Take a look at it below:
Serial In Parallel Out (SIPO) Mode
When we use the shift register in SIPO mode, we feed the input data serially but take the output data out in parallel. But again, this happens at every clock cycle. So how does that look like? Take a look at it yourself!
So as you can see here, we are still feeding the input data serially. But the output is no more serial. We are taking all the output bits at the same time, in parallel. So what this means is that we will get full 4 bit output every clock cycle!
Parallel In Serial Out (PISO) Mode
In the case of shift register in PISO mode, we feed the input data in parallel but take the output data serially. So what this means is that we will be feeding multiple data bits as inputs for every clock cycle. But will be taking only one output bit for each clock cycle.
So then what will happen to the output of each flip flop? Well, even that will be fed as an input! So, we will be feeding two inputs after multiplexing them together. So how does that connection look like? Take a look at it below:
Parallel In Parallel Out (PIPO) Mode
And finally, we have the shift register working in PISO mode. So can you guess what in this mode? Yes. In this mode of operation, you have both input and output data running in parallel. So how does that work? Take a look at it first!
So as you can see above, there is a major change in the way we connect the flip flops. In that, you do not see them connected to each other at all. So each input bit goes to a flip flop and it’s output is directly taken out. The only connection that is common to all these flip flops are the clock and clear signal!
So there you have it. Those are the different modes in which we can design a shift register to work. In the next section let us take a look at different types of shift registers that we can use.
Types Of Shift Registers
Based on the way the data is shifted, we have 5 different types of shift registers. They are:
- Left Shift Registers
- Right Shift Registers
- Bidirectional Shift Registers
- Circular Shift Registers &
- Linear Feedback Shift Registers
Now let explain what each of these registers work like:
Left Shift Registers
We have already talked about the left shift register. So I think you are familiar with it by now. If not, let me re-iterate. So in the case of a left shift register, the data is shifted to the left on each clock cycle.
Right Shift Registers
This is just like the left shift register. But here it is shifting the data to the right on each clock cycle.
Bidirectional Shift Registers
In the case of a bidirectional shift register, we can shift the data in both the directions. So you can shift the data either to it’s left or right!
Circular Shift Registers
In the case of a circular shift register, the last output is connected back as input. So your data will not be thrown out. Instead, will be shifted either left or right in a circular fashion!
Linear Feedback Shift Registers
In this type of shift register, the input of one flip flop will be linear output value of the previous flip flop.
Advantages & Disadvantages Of A Shift Register
It is now time to talk about the advantages & disadvantages of using a shift register. So what are they?
Advantages Of A Shift Register
- They are very fast to use.
- Very quick when you want to convert data from serial to parallel or vice versa. They are faster than normal serial to parallel converter circuits.
- They are very simple in design. So you can easily rig up a circuit to create a shift register.
- We can use them to encrypt or decrypt the data.
- We can use them to a delay signal.
- It is used in CDMA to generate Pseudo Noise Sequence Number.
- We can use them to track our data!
Disadvantages Of A Shift Register
While we could see that it has major advantages, shift register has one major disadvantage. That is:
- The strength of the output current coming from a shift register is not so strong!
So there you have it. Those where some of the advantages & disadvantages of using a shift register.
And with that, I will end this article now. But if you have any doubts, do let me know. Because I will be more than happy to answer them! Alright? So see you and take care until next time! 🙂