PoC.arith.shifter_barrel

This Barrel-Shifter supports:

  • shifting and rotating

  • right and left operations

  • arithmetic and logic mode (only valid for shift operations)

This is equivalent to the CPU instructions: SLL, SLA, SRL, SRA, RL, RR

Entity Declaration:

 1  port (
 2    Input           : in  std_logic_vector(BITS - 1 downto 0);
 3    ShiftAmount     : in  std_logic_vector(log2ceilnz(BITS) - 1 downto 0);
 4    ShiftRotate     : in  std_logic;
 5    LeftRight       : in  std_logic;
 6    ArithmeticLogic : in  std_logic;
 7    Output          : out std_logic_vector(BITS - 1 downto 0)
 8  );
 9end entity;
10
11
12architecture rtl of arith_shifter_barrel is
13  constant STAGES   : positive    := log2ceilnz(BITS);