M
methi
Guest
Hi,
I am working on the vhdl code of a generic shift register...
My code is as follows:
entity shifting is
generic ( left : integer );
Port ( shift_in : in std_logic;
clk_input : in std_logic;
shift_out : out std_logic);
end shifting;
architecture Behavioral of shifting is
signal shift_register : std_logic_vector ( (left-1) downto 0 ):=
(others => '0');
begin
process(clk_input)
begin
if rising_edge(clk_input) then
shift_register <= shift_register( (left-2) downto 0 ) & shift_in;
shift_out <= shift_register(left-1);
end if;
end process;
end Behavioral;
I am using this component in the top level code.
While doing generic map and port map of this components instantiation,
I dont want to assign a fixed value to "left".
I need my "left" changing every time another signal "h" changes
I tried doing this in the generic map:
generic map ( left => h)
But this gives me an error.
"h" is an integer.( have declared it as an integer in the top level
code).
Any ideas about how I can do this?
Thank you,
Methi
I am working on the vhdl code of a generic shift register...
My code is as follows:
entity shifting is
generic ( left : integer );
Port ( shift_in : in std_logic;
clk_input : in std_logic;
shift_out : out std_logic);
end shifting;
architecture Behavioral of shifting is
signal shift_register : std_logic_vector ( (left-1) downto 0 ):=
(others => '0');
begin
process(clk_input)
begin
if rising_edge(clk_input) then
shift_register <= shift_register( (left-2) downto 0 ) & shift_in;
shift_out <= shift_register(left-1);
end if;
end process;
end Behavioral;
I am using this component in the top level code.
While doing generic map and port map of this components instantiation,
I dont want to assign a fixed value to "left".
I need my "left" changing every time another signal "h" changes
I tried doing this in the generic map:
generic map ( left => h)
But this gives me an error.
"h" is an integer.( have declared it as an integer in the top level
code).
Any ideas about how I can do this?
Thank you,
Methi