rahulzambre
Newbie level 2
plz give me vhdl code for left shifter with variable as soon as possible. it's urgent
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
drwho78 said:
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
ENTITY shift_reg IS
GENERIC(number_of_bits : integer;
);
PORT( reset : in std_logic;
init_value : in std_logic_vector(number_of_bits-1 downto 0); -- outside of this block
clk : in std_logic;
data_in : in std_logic;
data_out : out std_logic
);
END shift_reg;
architecture behave of shift_reg is
begin
process(clk)
variable reg: std_logic_vector(number_of_bits-1 downto 0);
variable i: integer;
begin
if reset = '1' then
reg := init_value;
elsif rising_edge(clk) then
for i in number_of_bits-1 downto 1 loop
reg(i):=reg(i-1);
end loop;
reg(0):=data_in;
end if;
data_out <= reg(number_of_bits-1);
end process;
end behave;