Research Of A Barrel Shifter Design

Abstract

In this paper we have acquired knowledge about barrel shifter, its architecture, its implementation, its functionality, its types. We also have proposed different designs for shifting operations. Then we have concise our discussion towards the barrel shifter which is reversible and works for both directions and its advantages over data irreversible logical shifter circuit. The design, which has been taken into consideration, consists of the reversible logic gates, namely Fredkin and Feynman. Fredkin gate can be made to work like a 2: 1 MUX. A reversible shifter which can perform arithmetic and logical shifting, in both directions, can be made using these logical gates.

Keywords-Barrel shifter, Feynman gate, Fredkin gate, Bidirectional logical shifter.

Introduction

A Barrel Shifter is a type of bit rotating digital circuit that has an ability to shift data words in a single clock operation while normal shift registers shifts only one bit in a single clock operation. Shifting of data is an essential function of arithmetic operation. Barrel shifter in common is used for implementing floating-point arithmetic unit. In floating-point addition or subtraction operation, the significance of the two numbers must be aligned, in which it is required to shift the smaller number towards the right direction, to increase its exponent, till it will become equal to larger number’s exponent. It is a combinational logic circuit. It contains n inputs, n outputs and control inputs equal to log2n. Bits are shifted to the preferred number of bit positions in a single clock cycle. In one single clock cycle bits are shifted to favored number of bits. For implementation, an n-bit shifter requires logic levels, equal to log2n. In one cycle of clock, a 4-bit shifter is capable of shifting data by 2 locations. For example, if the original data was 0111, after one cycle of clock result will be 1101. There are four types of shifters namely consistent, math, barrel, and channel shifter. Barrel shifter does shifting operations like left shifting, right shifting, logical right and logical left shifting and arithmetic right shifting. Apart from shifting operation it has a rotate operation like right and left rotations.

Barrel Shifter Functionality

In one clock cycle, a barrel shifter, which is a digital circuit, can rotate/shift a data, by some given number of bits. It receives n-bit input data with k-bit shift value and produces n-bit shifted result, ((n, k) barrel shifter). This shifter is implemented such that, depending on the shift amount, each output can be connected to any input, similar to the multiplexer, so it can be implemented as a sequence of multiplexers. This is achieved by making a connection between the output of one MUX and input of the next MUX, depending on shift amount. For an n sized word, number of MUXes required is equal to n*log2 (n). A logarithmic n bit shifter requires log2n stages every bit of shifting value, B, controls a distinct shifter stage. Controls data in a stage and it is shifted by bits if =1; otherwise it is not shifted.

Architecture

Array shifters, logarithmic shifters are two common architectures. An array shifter decodes the given shifting value to individual shifting bit lines that work overall values of input data. At every crossing point whether any input data value will be transferred to the output lines or not, is determined by the gate, controlled by a shifting bit line. With this design, only a single gate is there in between data lines of input and output, and this makes it fast. The limitation of the design is that a decoder requires more area. In n-bit Logarithmic shifter, there are log2n stages. Each bit of the shifting amount is given to a distinct shifter stage; each stage is handling the power of- two shifts. The input data may be shifted by each stage in sequence. The Logarithmic shifter is slow compared to array shifter since it has number gate between data lines of input and output, and area required is less compared to array shifter. A barrel shifter is a digital logic circuit (combinational circuit) and any combinational circuit can be made using multiplexers. A simple barrel shifter of 2-bit using multiplexer having 4-bit data input, 4-bit data output, and 2-bit data control input can be seen below. In general, the design of an (n, k) barrel shifter needs n multiplexers such that each is having 2^k inputs.

Operation Control Bita. Logical Left Shifting

In logical left shifting, the given data shifting takes place bitwise, towards left direction and LSB bits are appended with zero. The amount of bit shifting is not user-defined and at a time only 2n bits get shifted where n=0, 1, 2, 3…. E. g. 4-bit shifting of 110010101 is possible whereas 3-bit shift is not possible.

  1. LOGICAL RIGHT SHIFTING
  2. In logical right shifting, the given data shifting takes place bitwise towards the right side and MSB bits are appended with zero. The amount of bit shifting is not user-defined, only 2n bits are shifted at one time where values of n are n=0, 1, 2, 3…E. g. 4-bit shifting of 110010101 is possible whereas 3-bit shifting is not possible.

  3. LOGICAL ROTATION IN RIGHT
  4. In logical right rotation, the provided data is rotated bitwise towards the right side and extra hardware is needed to wrap LSB bits for right rotation. The amount of bits to be rotated is not defined by a user, only 2n bits are rotated at one time where n=0, 1, 2, 3…For example, 4-bit rotation of 110010101 is possible whereas 3-bit rotation is impossible.

  5. LOGICAL LEFT ROTATION
  6. In this, the given data is rotated bitwise towards the left side and extra hardware is needed to wrap LSB bits for left rotation. The amount of bits to be rotated is not user-defined only 2n bits are rotated at one time where n=0, 1, 2, 3…E. g. 4-bit rotation of 110010101 is possible whereas 3-bit rotation is not possible.

  7. ARITHMETIC RIGHT SHIFTING
  8. In this data is shifted bitwise towards right direction considering the sign of number and MSB bits are appended by 1 if the number is negative else appended by 0. E. g. 3-bit right arithmetic shifting of 1010011100 is given as 1111010011.

  9. ARITHMETIC LEFT SHIFTING
  10. It is similar to logical left shifting. In this, the number is shifted bitwise in the left direction and LSB is appended with 0.

Implementation Of Design

Directions of shifting and rotation: Shifting and rotation direction is set by simply reversing input, output vectors to make the rotation and shifting operation simple.

Logical Shift Operation: The logical shift operation inserts 0 values for each shift operation. The input vector is shifted in the selected direction according to the number of bits in the select indication.

Rotate Operation: In rotation operation bits which are shifted out of vector MSB is shifted to LSB vectorC. Shift and Rotate Operation: let say A to be the input operand, B to be the shift/rotate the amount, and y to be the shifted/rotated output. Let A be an n bit value, where n is an integer power of two. Thus, B is a log2 (n) bit integer. Therefore, B is a log2 (n) bit integer values from 0 to n 1. Each MUX with one of its inputs as 0 can be changed by an ‘and’ gate with 2 inputs, one the data bit and other, in order to optimize the design. A similar unit that performs the right rotations, instead of the right shifts, can be designed by modifying the connections to the more significant multiplexors. If the connections to the highly significant MUX can be modified, then a similar unit, which performs rotation towards the right instead of shifting in the right direction, can be designed. Fig. 9 shows an 8bit right rotator which has three stages with -bits, bit, and bit rotation. The more significant multiplexors receive distinct inputs from the logical right shifter and right rotator. In rotator since all bits are routed to output no need for interconnect lines carrying zeros. In place of this interconnect lines are inserted such that it enables routing of low order data to the high order Multiplexer in stage controlled by. Changing shifter to rotator may not change area or delay of circuit theoretically. But longer interconnect line may result in increased delay and area.

A Reversible Bidirectional Barrel Shifter

A One-to-one mapping holds up in between inputs and outputs, in reversible logic. In an irreversible circuit eradicating a bit is proportional to the dissemination of kTln2 joules of energy in form of heat where k is Boltzmann's constant and T represents the environmental temperature in Kelvin. This dissemination of kTln2 joules of heat energy can be eliminated if operations are executed with reversible logic circuits [2]. The given reversible barrel shifter which is bidirectional, which can perform arithmetic shifts as well as logical shifts, can do logical and arithmetic left shift and logical and arithmetic right shift. An n-input, k-output Boolean type function is called reversible if Total outputs are same as the total number of inputs and each input arrangement maps to unique output arrangement.

The reversible Fredkin and Feynman gates are the basic building blocks of our proposed design. With one input as 0, a Feynman gate can be used to copy data. Also, depending on the first input a Fredkin gate can swap other two inputs, and hence can be used as a 2: 1 MUX. A Barrel shifter can be either unidirectional, by letting data shifting to be only in the left direction (or right direction), or bi-directional which allows data shifting or rotation in left as well as right direction. The given reversible bidirectional arithmetic and logical barrel shifter can do logical left shift, arithmetic left shift, logical right shift and arithmetic right shift operations. Operations which an (8, 3) reversible bidirectional arithmetic and logical shifter can function are exhibited in Table I for distinct values of control signals left, SRA and SLA. Depending on the values of these three control signals, the barrel shifter can do diverse functions such as logical left shifting, logical right shifting, etc.

The Reversible arithmetic and logical barrel shifter’s design module can be split into four sections: (i) Data reversal control unit-I, (ii) Arithmetic right shift control unit, (iii) Shifter unit which consists of three sub-modules that Arithmetic left shift control unit, (iv) Data reversal control unit-II. 1) Control Unit-I for Reversing Data: As it can be noticed from Table III, the control signal ‘left’ controls the direction of shifting operation on the reversible barrel shifter. The barrel shifter executes the function of shifting in left direction if the value of control signal ‘left’ is 1 that is, it can either perform arithmetic left shifting or logical left shifting. Else, if ‘left’=0 the function of shifting in the right direction is executed, which includes, arithmetic right shifting or logical right shifting. Fredkin gate’s two outputs can be used as 2: 1 multiplexer. We observed that for an n bit input data k-bit left shifting operation can be executed as follows: (i) perform input bits’ reversal, (ii) shift these reversed bits k times in right direction, and (iii) again perform bit reversal operation. 2) Control Unit for arithmetic right shifting: The arithmetic right shifting operation is controlled by this unit.

The arithmetic right shifting function is executed if ‘SRA’ control signal’s value is equal to 1 else unaltered data is copied to the next stage. Feynman gates are used to create copies of data, as fan-out is not allowed in reversible logic. 3) Shifting Unit: This unit is in charge of the amount of shifting performed. The control signals S2, S1, and S0 control the shifter unit. This unit can be split into three modules. In accordance with the values of the control signals S2, S1, and S0, the input bits are right shifted by,, and bits, by the first, second and third stages of the shifter unit. For the value of S2 equal to1, input bits are shifted towards the right by bits, else input bits remain unchanged. For S1 equal to 1, input bits carried on to the second stage are shifted towards the right by bits, else they stand unaltered. For S0 equal to 1 the output of stage-II is shifted towards the right by bits, else the output bits stand unaltered. 4) Control Unit for Arithmetic Left Shifting: This unit is controlled by the ‘SLA’ control signal, and is responsible for executing the arithmetic left shifting. For ‘SLA’ = 1, the sign bit which is essential for performing the arithmetic left shifting, is retained by this unit, else if ‘SLA’= 0, the LSB of shifter unit is copied forward. [image: Image result for reversible bidirectional barrel shifter]5) Control Unit II for Data Reversal: The ‘left’ control signal controls this unit. For the value of ‘left’ =1, a left-shifted result is generated and input to this unit is reserved, else the input is copied to the output.

Conclusion

Various operations and designs of digital shifter circuits have been presented in this paper. Two architectures namely array shifters and logarithmic shifters exist, array shifter being fast but consume more area and logarithmic shifter being slower but consume lesser area as compared to array shifter. In general, the design of an (n, k) barrel shifter need n multiplexers. A shifter can perform logical and arithmetic left shift, logical and arithmetic right shift, and logical left and right rotation. We have observed Feynman and Fredkin are the fundamental reversible gates used to design the proposed bidirectional and logical shifter. The shifter is capable of performing logical and arithmetic left shift and logical and arithmetic right shift. Dissemination of heat energy of kTln2 joules occurs in an irreversible logic circuit. can be eliminated with reversible logic circuits.

15 Jun 2020
close
Your Email

By clicking “Send”, you agree to our Terms of service and  Privacy statement. We will occasionally send you account related emails.

close thanks-icon
Thanks!

Your essay sample has been sent.

Order now
exit-popup-close
exit-popup-image
Still can’t find what you need?

Order custom paper and save your time
for priority classes!

Order paper now