The left shift and right shift operation
 

The effect of a left/right shift operation:

The bits are shifted one position to left/right
The open bit position is filled with a 0 bit

Fixed shift operations do not require any circuit to perform
 

We can redirect the input signals to perform a fixed shift operation:

The bits are shifted one position to left/right
The open bit position is filled with a 0 bit

Controlled shift operations do require a circuit
 

Shift operation controlled by a control (input) signal:

If the control signal Ctrl=0, the Shifter circuit will perform a left shift
If the control signal Ctrl=1, the Shifter circuit will perform a right shift

How to construct a simple shifter circuit
 

We can construct the previous (simple) shifter circuit using 2 way multiplexor circuits:

How to construct a simple shifter circuit
 

For a 4 bit shifter, we need to use 4 multiplexors (one for each bit):

How to construct a simple shifter circuit
 

Connect the (shift) control signal c to the selection input of each multiplexor:

How to construct a simple shifter circuit
 

If c=0, the first input (right one) will be selected:

How to construct a simple shifter circuit
 

Redirect the input signals to the active mux inputs so the result is left-shifted:

How to construct a simple shifter circuit
 

If c=1, the 2nd input (left one) will be selected:

How to construct a simple shifter circuit
 

Redirect the input signals to the active mux inputs so the result is right-shifted:

How to construct a simple shifter circuit
 

The shifter circuit:

The EDiSim circuit program is shown on next slide - it uses the built-in Mux component

EDiSim definition
 

Define Shifter c  d3 d2 d1 d0 | z3 z2 z1 z0;              

   /* Bit 3 */  Mux aa c | ZERO     d2 | z3;
   /* Bit 2 */  Mux aa c | d3       d1 | z2;
   /* Bit 1 */  Mux aa c | d2       d0 | z1;
   /* Bit 0 */  Mux aa c | d1     ZERO | z0;
  
Endef;
  

Notice the built-in Mux component uses 2 | characters
See this webpage for detail usage information: click here