ramz
Junior Member level 2
for loop in vhdl
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity control_path_new_ver is
Port ( clk : in std_logic;
rst : in std_logic;
outp : out std_logic
);
end control_path_new_ver;
architecture Behavioral of control_path_new_ver is
signal count : std_logic_vector(2 downto 0) := "000";
--signal count : std_logic_vector(2 downto 0) := "000";
begin
process(rst)
begin
if ( rising_edge(clk)) then
--variable i : std_logic_vector(2 downto 0) := "000";
if(rst = '1') then
outp <= '0';
else
for i in 0 to 3 loop
if( i = 0 ) then
outp <= '1';
count <= "001";
elsif (i = 1) then
outp <='0';
count <= "010";
elsif (i = 2) then
outp <= '1';
count <= "011";
else
outp <= '1';
count <= "100";
end if;
end loop;
end if;
end if;
end process;
end Behavioral;
can i use the increated value of i in the loop in if statement for performing comparision.. i also need how many clocks r taken to have loop completed
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity control_path_new_ver is
Port ( clk : in std_logic;
rst : in std_logic;
outp : out std_logic
);
end control_path_new_ver;
architecture Behavioral of control_path_new_ver is
signal count : std_logic_vector(2 downto 0) := "000";
--signal count : std_logic_vector(2 downto 0) := "000";
begin
process(rst)
begin
if ( rising_edge(clk)) then
--variable i : std_logic_vector(2 downto 0) := "000";
if(rst = '1') then
outp <= '0';
else
for i in 0 to 3 loop
if( i = 0 ) then
outp <= '1';
count <= "001";
elsif (i = 1) then
outp <='0';
count <= "010";
elsif (i = 2) then
outp <= '1';
count <= "011";
else
outp <= '1';
count <= "100";
end if;
end loop;
end if;
end if;
end process;
end Behavioral;
can i use the increated value of i in the loop in if statement for performing comparision.. i also need how many clocks r taken to have loop completed