--========================================================== -- Design units : AssocMemBehave -- (entitiy, architecture and configuration) -- -- File name : AssocMemBehave.vhd -- -- Purpose : Behavioral Description of Associative Memory -- as specification -- -- Limitations : None -- -- Library : WORK -- -- Dependencies : None -- -- Author : Hans-Peter Eich, REFT -- -- Simulator : Synopsys V3.1a on SUN SPARCstation 10 -- ------------------------------------------------------------- -- Revision list -- Version Author Date Changes -- -- V1.0 hpe 02.04.95 new -- V2.0 cjt 18.10.95 ESA-Standard, reset on active low --=========================================================== LIBRARY IEEE; USE work.ELEMpack.all; USE IEEE.std_logic_1164.all; ENTITY AssocMemBehave IS GENERIC (M: Positive; -- Word length N: Positive); -- Memory width PORT (Data : IN std_logic_vector(M-1 DOWNTO 0); -- Data In Mask : IN std_logic_vector(M-1 DOWNTO 0); -- Mask In Address : IN std_logic_vector(N-1 DOWNTO 0); -- Address In Store : IN std_logic; -- Store enable Search : IN std_logic; -- Search enable Reset : IN std_logic; -- Reset on active low End1 : OUT std_logic; -- End indicator Result : OUT std_logic_vector(M-1 DOWNTO 0));-- Result out END AssocMemBehave; --==========================ARCHITECTURE===================== ARCHITECTURE Behavior OF AssocMemBehave IS BEGIN P0: PROCESS TYPE std_logic_matrix IS ARRAY (Integer range <>,Integer range <>) OF std_logic; VARIABLE Memory : std_logic_matrix(N-1 DOWNTO 0,M-1 DOWNTO 0); VARIABLE Match : std_logic_vector(N-1 DOWNTO 0); VARIABLE Hit : std_logic := '0'; VARIABLE Res : std_logic_vector(M-1 DOWNTO 0); VARIABLE First_Address : Integer := 0; BEGIN IF Store='1' THEN Write_Adr : FOR I0 IN N-1 DOWNTO 0 LOOP IF Address(I0) = '1' THEN Write_Word : FOR J0 IN M-1 DOWNTO 0 LOOP IF Mask(J0) = '0' THEN Memory(I0,J0) := Data(J0); END IF; END LOOP Write_Word; END IF; END LOOP Write_Adr; END IF; IF Reset='0' THEN Init_Column: FOR I1 IN N-1 DOWNTO 0 LOOP Init_Row: FOR J1 IN M-1 DOWNTO 0 LOOP Memory(I1,J1) := '0'; END LOOP Init_Row; END LOOP Init_Column; End1 <= '0'; END IF; IF Search='1' THEN Init_Match: FOR I2 IN N-1 DOWNTO 0 LOOP Match(I2) := '0'; END LOOP Init_Match; Search_Adr: FOR I3 IN 0 to N-1 LOOP Search_Word: FOR J3 IN M-1 DOWNTO 0 LOOP IF Mask(J3) = '0' AND Data(J3)=Memory(I3,J3) THEN Match(I3):= '1'; END IF; END LOOP Search_Word; END LOOP Search_Adr; First_Address := 0; Hit := '0'; Priority: WHILE First_Address