Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Shift registers

 
Thread Tools Search this Thread
Old 02-16-2009, 10:13 AM   #1
Default Shift registers


Hi all, I'm using shift registers in order to instantiate multiple
cores in my system. I'm a newbie and I would like to know if my
approach is correct. Every instance of the core have a shift reg that
provide the data input and another sifth reg that takes the data
output. I use the generate statement to connect all my instances to
the various shft registers.

This is the code (I want to instantiate multiple Aquarius cores --
found on opencores.org). Can you please provide me feedback? Thanks

-------------------------------------------------------------------------------------------------------------------
--- multi_instance_aquarius
-------------------------------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;


entity multi_instance is
generic (
NINSTANCES : integer := 1;
NINPUT : integer := 15;
NOUTPUT : integer := 18
);

port (
CLK: in std_logic;
RST: in std_logic;
SHIFTIN: in std_logic_vector (0 to NINSTANCES-1);
SHIFTOUT: out std_logic_vector (0 to NINSTANCES-1);
ALOAD: in std_logic
);
end multi_instance;

architecture arch of multi_instance is

component shiftregINCOMP is
generic (
NINPUT : integer := 15
);
port (CLK, RST: in std_logic;
DATAin: in std_logic;
DATAout: out std_logic_vector (NINPUT-1 downto 0)
);
end component;

component shiftregOUTCOMP is
generic (
NOUTPUT : integer := 18
);
port (CLK, RST: in std_logic;
DATAin: in std_logic_vector (NOUTPUT-1 downto 0);
DATAout: out std_logic;
ALOAD : in std_logic
);
end component;

component top is port (

CLK_SRC : in std_logic;
RST_n : in std_logic;
LCDDBI : in std_logic_vector (7 downto 0);
KEYXI : in std_logic_vector (4 downto 0);
RXD : in std_logic;
CTS : in std_logic;
LCDRS : out std_logic;
LCDRW : out std_logic;
LCDE : out std_logic;
LCDDBO : out std_logic_vector (7 downto 0);
KEYYO : out std_logic_vector (4 downto 0);
TXD : out std_logic;
RTS : out std_logic
);
end component;

type shiftregIN is array (NINSTANCES-1 downto 0) of std_logic_vector
(NINPUT-1 downto 0);
type shiftregOUT is array (NINSTANCES-1 downto 0) of std_logic_vector
(NOUTPUT-1 downto 0);
signal DATAin : shiftregIN;
signal DATAout : shiftregOUT;

begin

generate_inst: for I in 0 to NINSTANCES-1 generate

top_inst : top
port map (
CLK_SRC => CLK,
RST_n => RST,
--------------------------------------------------------
LCDDBI => DATAin(I) (NINPUT-1 downto NINPUT-,
KEYXI => DATAin(I) (NINPUT-9 downto NINPUT-13),
RXD => DATAin(I) (NINPUT-14),
CTS => DATAin(I) (NINPUT-15),
--------------------------------------------------------
LCDRS => DATAout(I) (NOUTPUT-1),
LCDRW => DATAout(I) (NOUTPUT-2),
LCDE => DATAout(I) (NOUTPUT-3),
LCDDBO => DATAout(I) (NOUTPUT-4 downto NOUTPUT-11),
KEYYO => DATAout(I) (NOUTPUT-12 downto NOUTPUT-16),
TXD =>DATAout(I) (NOUTPUT-17),
RTS => DATAout(I) (NOUTPUT-1
);

shiftregIN_inst : shiftregINCOMP
generic map (NINPUT => NINPUT)

port map (
CLK => CLK,
RST => RST,
DATAin => SHIFTIN(I),
DATAout => DATAin(I)
);

shiftregOUT_inst : shiftregOUTCOMP
generic map (NOUTPUT => NOUTPUT)

port map (
CLK => CLK,
RST => RST,
ALOAD => ALOAD,
DATAin => DATAout(I),
DATAout => SHIFTOUT(I)
);

end generate;

end arch;

-------------------------------------------------------------------------------------------------------------------
-- shiftregin
-------------------------------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity shiftregINCOMP is
generic (
NINPUT : integer := 15
);
port (CLK, RST: in std_logic;
DATAin: in std_logic;
DATAout: out std_logic_vector (NINPUT-1 downto 0)
);
end entity;

architecture arch of shiftregINCOMP is
signal tmp : std_logic_vector(NINPUT-1 downto 0);
begin
process (CLK, RST)
begin
if RST = '0' then
tmp <= (others => '0');
elsif CLK'event and CLK = '1' then
tmp <= tmp(NINPUT-2 downto 0) & DATAin;
end if;
end process;
DATAout <= tmp;
end arch;

-------------------------------------------------------------------------------------------------------------------
-- shiftregout
-------------------------------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity shiftregOUTCOMP is
generic (
NOUTPUT : integer := 18
);
port (CLK, RST: in std_logic;
DATAin: in std_logic_vector (NOUTPUT-1 downto 0);
DATAout: out std_logic;
ALOAD : in std_logic
);
end entity;

architecture arch of shiftregOUTCOMP is
signal tmp : std_logic_vector(NOUTPUT-1 downto 0);
begin
process (CLK, RST, ALOAD)
begin
if RST = '1' then
tmp <= (others => '0');
else
if ALOAD = '1' then
tmp <= DATAin;
elsif CLK'event and CLK = '1' then
tmp <= tmp(NOUTPUT-2 downto 0) & '0';
end if;
end if;
end process;
DATAout <= tmp(NOUTPUT-1);
end arch;

-------------------------------------------------------------------------------------------------------------------

Synplify gime me a warning telling that the sensitivity list of
shiftregout is not complete. Is my design correct?
Thanks a lot!















gervaz
  Reply With Quote
Old 02-16-2009, 11:40 AM   #2
Tricky
 
Posts: n/a
Default Re: Shift registers
The warning it's giving is because you assign tmp from DATAin when
ALOAD = '1', so DATAin also needs to be in the sensitivity list.

Also, try not to use the ALOAD signal. It will be too prone to meta-
stability. Try and synchronise it if you can and put it inside the
clock.

You have also included packages when you dont need to: std_logic_arith
and unsigned. They are unnessasry in your design.


Tricky
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL sll shift question ohaqqi Hardware 4 09-29-2009 11:27 AM
Adding two registers A and B in vhdl Haai Hardware 0 08-18-2007 04:56 PM
Here's one, anyone have an answer? MF A+ Certification 9 01-04-2007 12:15 AM
"The biggest scandal to ever hit American politics" Jas DVD Video 149 12-05-2004 02:47 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46