nats_
Newbie level 6
Hi all,
i searched to see if there were other threads that could help me solve this, but found nothing useful enough..
i'm new at VHDL, and i have a problem-
i'm supposed to create a generic shift register that also samples the the mid-values (as oppose to just the last output)
my problem is that for some reason (i'm probably doing something horribly wrong..) the DATA_OUT & DATA_OUT_FULL signals don't seem to be getting any values, or to respond to the Enable signal.
any help would be much appriciated
this is my code:
---------- Post added at 17:28 ---------- Previous post was at 16:58 ----------
i should add that i am not allowed to declare any other unit (FF for example)
i searched to see if there were other threads that could help me solve this, but found nothing useful enough..
i'm new at VHDL, and i have a problem-
i'm supposed to create a generic shift register that also samples the the mid-values (as oppose to just the last output)
my problem is that for some reason (i'm probably doing something horribly wrong..) the DATA_OUT & DATA_OUT_FULL signals don't seem to be getting any values, or to respond to the Enable signal.
any help would be much appriciated
this is my code:
Code:
library IEEE;
use IEEE.std_logic_1164.all;
entity shift_register is
generic (
G_SHIFT_REGISTER_SIZE : integer := 4;
G_DATA_WIDTH : integer := 8
);
port (
CLK : in std_logic;
RESET : in std_logic;
Data_in : in std_logic_vector (G_DATA_WIDTH-1 downto 0);
Enable : in std_logic;
Data_out : out std_logic_vector (G_DATA_WIDTH-1 downto 0);
Data_out_full : out std_logic_vector (G_SHIFT_REGISTER_SIZE*G_DATA_WIDTH-1 downto 0)
);
end entity shift_register;
architecture shift_register_arch of shift_register is
type t_shift_reg is array (G_SHIFT_REGISTER_SIZE-1 downto 0) of std_logic_vector (G_DATA_WIDTH-1 downto 0);
component shift_register is
generic (
G_SHIFT_REGISTER_SIZE : integer := 4;
G_DATA_WIDTH : integer := 8
);
port (
CLK : in std_logic;
RESET : in std_logic;
Enable : in std_logic;
Data_in : in std_logic_vector (G_DATA_WIDTH-1 downto 0);
Data_out : out std_logic_vector (G_DATA_WIDTH-1 downto 0);
Data_out_full : out std_logic_vector (G_SHIFT_REGISTER_SIZE*G_DATA_WIDTH-1 downto 0)
);
end component shift_register;
signal connect_sig : std_logic_vector (G_DATA_WIDTH*(G_SHIFT_REGISTER_SIZE+1)-1 downto 0);
begin
connect_sig(G_DATA_WIDTH-1 downto 0) <= Data_in;
shift_register_gen: for i in G_SHIFT_REGISTER_SIZE-1 downto 0 generate
reg_u: shift_register
port map (
CLK => CLK,
RESET => RESET,
Enable => Enable,
Data_in => connect_sig((i+1)*G_DATA_WIDTH-1 downto i*G_DATA_WIDTH),
Data_out => connect_sig((i+2)*G_DATA_WIDTH-1 downto (i+1)*G_DATA_WIDTH),
--Data_out_full => connect_sig((i+2)*G_DATA_WIDTH-1 downto G_DATA_WIDTH)
);
end generate shift_register_gen;
-- Connecting outside the process
--------------------------------------------------
data_out <= connect_sig(G_DATA_WIDTH*(G_SHIFT_REGISTER_SIZE+1)-1 downto G_DATA_WIDTH*(G_SHIFT_REGISTER_SIZE));
Data_out_full <= connect_sig((G_SHIFT_REGISTER_SIZE+1)*G_DATA_WIDTH-1 downto G_DATA_WIDTH);
shift_reg_proc: process (CLK, RESET, Enable)
begin
if (RESET = '1') then --a-synchronous reset
for i in G_SHIFT_REGISTER_SIZE-1 downto 0 LOOP
connect_sig(i+G_DATA_WIDTH) <= '0';
end LOOP;
elsif (RESET = '0') then
if (clk'Event and CLK = '1') then
if (Enable = '1') then
for i in G_DATA_WIDTH*(G_SHIFT_REGISTER_SIZE+1)-1 downto G_DATA_WIDTH LOOP
connect_sig(i) <= connect_sig(i-1);
end LOOP;
for i in G_DATA_WIDTH-1 downto 0 LOOP
connect_sig(i) <= Data_in(i);
end LOOP;
for i in G_DATA_WIDTH*(G_SHIFT_REGISTER_SIZE+1)-1 downto G_DATA_WIDTH LOOP
Data_out_full(i-G_DATA_WIDTH) <= connect_sig(i);
end LOOP;
for i in G_DATA_WIDTH-1 downto 0 LOOP
Data_out(i) <= connect_sig(i+G_DATA_WIDTH*G_SHIFT_REGISTER_SIZE-1);
end LOOP;
end if;
end if;
end if;
end process shift_reg_proc;
end architecture shift_register_arch;
configuration cfg_shift_register of shift_register is
for shift_register_arch
end for;
end cfg_shift_register;
---------- Post added at 17:28 ---------- Previous post was at 16:58 ----------
i should add that i am not allowed to declare any other unit (FF for example)