bennzia
Newbie level 2
hi, i wrote a code in vhdl that: get 6 bits data the program subtract 1 until "000000"
when not "000000" the output(out1) is= 'Z'.
when "000000" the Ouput(out1) is= '0'.
the code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity delay_time is
port (t_in1 : in integer range 0 to 255;
u_clk: in std_logic;
reset: in std_logic;
out1: out std_logic
);
end delay_time;
architecture arc_dt of delay_time is
signal temp: integer range 0 to 255;
begin
process (reset,u_clk)
begin
if (reset='0') then
if (u_clk'event and u_clk='1') then
temp <= temp + 1;
end if;
end if;
end process;
process (temp)
begin
if(t_in=temp) then
out1 <= '0';
else
out1<= 'Z';
end if;
end process;
end arc_dt;
here is the simulation:
so according to the program after 7 clk (t_in=000111) the output get '0'.
but you can see that the output is 'Z' all the time, anyone can tell me what the problem? thanks.
when not "000000" the output(out1) is= 'Z'.
when "000000" the Ouput(out1) is= '0'.
the code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity delay_time is
port (t_in1 : in integer range 0 to 255;
u_clk: in std_logic;
reset: in std_logic;
out1: out std_logic
);
end delay_time;
architecture arc_dt of delay_time is
signal temp: integer range 0 to 255;
begin
process (reset,u_clk)
begin
if (reset='0') then
if (u_clk'event and u_clk='1') then
temp <= temp + 1;
end if;
end if;
end process;
process (temp)
begin
if(t_in=temp) then
out1 <= '0';
else
out1<= 'Z';
end if;
end process;
end arc_dt;
here is the simulation:
so according to the program after 7 clk (t_in=000111) the output get '0'.
but you can see that the output is 'Z' all the time, anyone can tell me what the problem? thanks.
Last edited: