I want to implement open collector protocol. When I try to set inout type port to 'Z' value, which is pulled up, it just continue to hold its previous value. To elucidate, I have just written the following VHDL code which first set o_sample_trig to 0 then set to to 'z' ( high impedance) state, since the o_sample_trig pin is pulled up it should immediately go to '1' state, but instead continue sending '0'! please advise me.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--********************************************
entity TopLvl is
port(
clk,reset : in std_logic;
max_tick: out std_logic;
o_sample_trig: inout std_logic
);
end TopLvl;
--***************************************************
architecture Behavioral of TopLvl is
signal timer1_reg,timer1_next : integer range 0 to 23999999:=0;
attribute PULLUP: string;
attribute PULLUP of o_sample_trig : signal is "TRUE";
begin
process ( clk ,reset)
begin
if(reset ='1') then
timer1_reg <= 0;
elsif ( clk'event and clk='1' ) then
timer1_reg <= timer1_next;
end if;
end process;
--**************************************************
process ( clk ,timer1_reg)
begin
Timer1_next <= timer1_reg+1;
if (timer1_reg >= 100 and timer1_reg < 150) or (timer1_reg >= 200 and timer1_reg < 225) or (timer1_reg = 300) then
o_sample_trig<='0';
elsif (timer1_reg >= 150 and timer1_reg < 200) or (timer1_reg >= 225 and timer1_reg < 300) or (timer1_reg >= 400) then
o_sample_trig<='Z';
end if;
if (timer1_reg >= 151 and timer1_reg < 199 and o_sample_trig = '1') then
max_tick<= '1';
end if;
end process;
end Behavioral;