# How to design a left shift register

I want a circuit in which I get the following sequence:

0001,
0010,
0100,
1000,
0001


I know that it's 4-bit shift register. But what is my approach to design this circuit?

## 2 Answers

One approach is to design the circuit as a regular two bit binary counter using a pair of flip-flops. Then you put some circuitry on the outputs that decodes the four counter states into the output sequence that you desire. Such decode functions actually already exist as standalone chips.

Here is the state table related to this:

Binary 00 -> Decode 0001

Binary 01 -> Decode 0010

Binary 10 -> Decode 0100

Binary 11 -> Decode 1000

Binary 00 -> Decode 0001

.....

[and so on]

There are other ways to make your recirculating shift register but they often have the problem of getting unwanted states in to the output stream such that more than one bit would be set at a time. The binary counter followed by decoder does not have that problem.

You may find it interesting to know that there is a commonly available chip that performs the counter and decoder operation all in one IC chip. The CD74HC4017 is one that does this with 10 output pins.

• i think this type decoder we can make using logic gates. Is it possible to make this using Flip flop? – SW. Mar 10 '14 at 6:02
• @rAsHmI - You can make the 2-bit binary counter out of two flip-flops. And yes, you can use logic gates to make the decoder functions although it may be just as easy to use some chip like a 74HC138 or 74HC139 to make the decoder all in one IC chip. – Michael Karas Mar 10 '14 at 6:38

Write Up Your Truth Table as Usual ie

     Current    Next
A B C D | A' B' C' D'
0 0 0 1 | 0  0  1  0
0 0 1 0 | 0  1  0  0
0 1 0 0 | 1  0  0  0
1 0 0 0 | 0  0  0  1


Meaning A' = D , B' = C , C' = D, D' = A

So you now have the boolean equations defining your system, so you can now design your circuit.Because you want your signals A,B,C and D to be assigned only at clock edges you would then connect each of your output signals to the output of a flip flop then connect the input of the flip flop to the relevant logic equation.In this case you would just get a shift register.