Presentation is loading. Please wait.

Presentation is loading. Please wait.

BARREL SHIFTER.

Similar presentations


Presentation on theme: "BARREL SHIFTER."— Presentation transcript:

1 BARREL SHIFTER

2 A barrel shifter is a digital circuit that can shift a data word by a specified number of bits in one clock cycle. Shifts the input data in combinational manner It can be implemented as a sequence of multiplexers (mux.) or FET A common usage of a barrel shifter is in the hardware implementation of floating-point arithmetic.

3

4 PROGRAM library IEEE; use IEEE.STD_1164.all entity BARREL_SHIFTER is
Generic (N: POSITIVE:= 4); Port( DATA:in STD_LOGIC_VECTOR(N-1 down to 0)); SELEKT : in INTEGER range 0 to N-1; BARR_OUT : out STD_LOGIC_VECTOR ( N-1 down to 0)); end BARREL_SHIFTER; architechture FOR_LOOP_STYLE of BARREL_SHIFTER is begin process(SELEKT,DATA) variable VAR_BUF: STD_LOGIC_VECTOR( N-1 down to 0)); VAR_BUF:=DATA;

5 for K in 1 to SELEKT LOOP VAR_BUF := VAR_BUF(N-2 down to 0)& VAR_BUF(N-1); end loop; BARR_OUT<= VAR_BUF; end process; end FOR_LOOP_STYLE; architecture CONCURRENT_STYLE of BARREL_SHIFTER is begin BARRE_OUT<= DATA(N-1- SELEKT down to 0)& DATA(N-1 down to N- SELEKT) When SELEKT> 0; else DATA; end CONCURRENT _STYLE;


Download ppt "BARREL SHIFTER."

Similar presentations


Ads by Google