Altera_Forum
Honored Contributor
12 years agoIllogical comparator output
Hi ,
i design 8 bit comparator at VHDL : ------------------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; entity comparator is port( ResetP : in std_logic; cmp_in_Tx : in std_logic_vector(7 downto 0); cmp_in_Rx : in std_logic_vector(7 downto 0); cmp_out : out std_logic --cmp_out is the result of the comparator ); end entity comparator; architecture behave of comparator is begin process (ResetP) begin if (ResetP= '1') then cmp_out <='0'; elsif (ResetP = '0') then if( cmp_in_Rx = cmp_in_Tx) then cmp_out <= '1'; else cmp_out <= '0'; end if; end if; end process; end behave; ------------------------------------------------------ The thing is , that the comparator output : cmp_out is consistently '1' although the cmp_in_Rx is different then cmp_in_Tx and ResetP = '0' . what is the reason for that ? attached waveform .