Forum Discussion
Altera_Forum
Honored Contributor
12 years agofirst n is not constant it depend on table element which is definitely changed .
second , the position of each element corresponding to the same element in the other table i wrote a code put didn't know ,is it right? give a code for every element in table library IEEE; use IEEE.STD_LOGIC_1164.all; package profile_A is type A1 is array (0 to 4) of std_logic_vector( 23 downto 0); constant table1:A1:= ("011010010110001101100001","011011010110010101110010", "011000010110110101100101","011100100110100101100100","011001010111001001101001"); type A2 is array (0 to 4) of std_logic_vector( 23 downto 0); constant table2:A2:= ("011011010110010101110010","011010010110001101100001", "011000010110110101100101","011001010111001001101001","011100100110100101100100"); end profile_A; ---------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; use work.profile_A.all; entity samples is port ( s1:in A1; s2: in A2; clk:in bit; distance:out integer); end samples; architecture Behavioral of samples is signal d :integer ; begin process(clk,s1,s2) begin for idx in 0 to s1'length loop if (clk='1'or clk'event) then if s1(idx)=s2(idx)then d <= idx-1; end if; end if; end loop; end process; end Behavioral;