Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Making a shift register in VHDL

Status
Not open for further replies.

voho

Full Member level 2
Joined
Feb 24, 2004
Messages
121
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Location
Nador City
Activity points
852
Hi all,

I would like to do in VHDL à shift register with:

serial and parallele input and serial and parallele output.

Thank's in advance regards
 

vahidkh6222

Full Member level 2
Joined
Oct 11, 2005
Messages
137
Helped
6
Reputation
12
Reaction score
0
Trophy points
1,296
Activity points
2,419
Re: shift register

maybe...

Code:
-- 4-bit loadable serial-in and serial-out shift register
--     CLK: in STD_LOGIC;
--     DIN: in STD_LOGIC;
--     LOAD: in STD_LOGIC;
--     LOAD_DATA: in STD_LOGIC_VECTOR(3 downto 0);
--     DOUT: out STD_LOGIC; 
 
--**Insert the following between the 'architecture' and
---'begin' keywords**
signal REG: STD_LOGIC_VECTOR(3 downto 0);
 
--**Insert the following after the 'begin' keyword**
process (CLK)
begin
   if CLK'event and CLK='1' then
   if (LOAD='1') then
     REG <= LOAD_DATA;
   else
        REG <= REG(2 downto 0) & DIN;
   end if;
   end if;
 DOUT <= REG(3);
end process;





Code:
-- 4-bit serial-in and parallel-out shift register
--     CLK: in STD_LOGIC;
--     DIN: in STD_LOGIC;
--     DOUT: out STD_LOGIC_VECTOR(3 downto 0);
 
--**Insert the following between the 'architecture' and
---'begin' keywords**
signal REG: STD_LOGIC_VECTOR(3 downto 0);
 
--**Insert the following after the 'begin' keyword**
process (CLK)
begin
   if CLK'event and CLK='1' then  
      REG <= REG(2 downto 0) & DIN;
   end if;
 DOUT <= REG;
end process;



Code:
-- 4-bit serial-in and serial-out shift register
--     CLK: in STD_LOGIC;
--     DIN: in STD_LOGIC;
--     DOUT: out STD_LOGIC;
 
--**Insert the following between the 'architecture' and
---'begin' keywords**
signal REG: STD_LOGIC_VECTOR(3 downto 0);
 
--**Insert the following after the 'begin' keyword**
process (CLK)
begin
   if CLK'event and CLK='1' then  
      REG <= REG(2 downto 0) & DIN;
   end if;
 DOUT <= REG(3);
end process;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top