answersLogoWhite

0

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

entity shiftreg is

Port ( en : in STD_LOGIC;

clock : in STD_LOGIC;

reset :in std_logic;

data_i : in STD_LOGIC_VECTOR (15 downto 0);

shift : in STD_LOGIC;

data_o : out STD_LOGIC);

end shiftreg;

architecture Behavioral of shiftreg is

signal reg: std_logic_vector (15 downto 0);

begin

process (clock, en,reg,reset)

begin

if reset<='1' then

reg<=data_i;

elsif (clock'event and clock <='1' ) then

if (en <='1') then

reg <= data_i;

elsif (en<='1' and shift<='1') then

reg <= reg (14 downto 0) & '0';

end if;

end if;

end process;

data_o <= reg (15);

end Behavioral;

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

ReneRene
Change my mind. I dare you.
Chat with Rene
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran

Add your answer:

Earn +20 pts
Q: Write VHDL Code for a 16-bit shift left register?
Write your answer...
Submit
Still have questions?
magnify glass
imp