shiny1
Junior Member level 1
Hi All,
I wrote a 4bit updown binary counter component which gives 0-15 and 15-0 based on my requirement. Now I wrote a Lookup table where I can use this components output as input. Also I need to change data inputs to the look up table based on the counter output . For Example if Counter output= "0000" - "1111" my datainput should be '0', for the next cycle it should be '1'. So I thought I should write a loop but I don't know how.
For simplicity I am not adding the counter code but I can assure you its working.
I wrote a 4bit updown binary counter component which gives 0-15 and 15-0 based on my requirement. Now I wrote a Lookup table where I can use this components output as input. Also I need to change data inputs to the look up table based on the counter output . For Example if Counter output= "0000" - "1111" my datainput should be '0', for the next cycle it should be '1'. So I thought I should write a loop but I don't know how.
For simplicity I am not adding the counter code but I can assure you its working.
Code:
use ieee.numeric-std.all;
use ieee.std_logic_unsigned.all;
entity tp(datag : inout std_logic := '0';
counteo : inout std_logic_vector (3 downto 0 );
outp : inout std_logic);
end tp;
architecture behavioral of tp is
begin
component count is port (
----t he output is the one am including here
countero: out std_logic_vector ( 3 down to 0 ));
component Lookup is port (
inp : in std_logic_vector ( 3 downto 0 );
writeen : in std_logic;
Data : in std_logic;
Outp: inout std_logic;
RamData : in std_logic_vector (15 downto 0 ) ;
Mode_ram : in std_logic);
end component;
signal write_en : std_logic := '0';
begin
LUT : Lookup port map (countero , write_en,data,outp,"1111111110000111",'1');'
process
variable i : integer;
begin
-- I need to write a loop which allows me to change write en and data pins based on countero
i := 0;
i:= conv_integer(countero);
while (i< 15) loop
data := '0';
write_en = '0';
end loop;
i := '0';
i := conv_integr (countero);
while (i< 15 ) loop --- am assuming this goes to nxt cycle of 0-15
data := '1';
write : = '0';
end loop;
------------------------- The loop code is not working not at all!!!!! Its not going into the loop at all...Pls Help
end process;
end behavioral;
Last edited: