------------------------------------------------------------------------------- -- Title : test des filtres bas niveau -- Project : ------------------------------------------------------------------------------- -- File : test_gradient.vhd -- Author : -- Company : -- Last update : 1999/11/19 -- Platform : ------------------------------------------------------------------------------- -- Description : -- -- ------------------------------------------------------------------------------- -- Modification history : -- 1999/10/11 : created ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY test_gradient IS END test_gradient; USE work.utils.ALL; ARCHITECTURE par_constantes OF test_gradient IS COMPONENT dut PORT (h : IN std_ulogic; -- horloge init : IN std_ulogic; -- reset pixel : IN natural RANGE 0 TO 255; pix_calcul : OUT natural RANGE 0 TO 255; ready_in : IN std_ulogic; -- protocole d'entree ack_in : OUT std_ulogic; ready_out : OUT std_ulogic; ack_out : IN std_ulogic); END COMPONENT; SIGNAL h, h1, h2, init, ready_in, ack_in, ready_out, ack_out : std_ulogic; SIGNAL pixel, sortie : integer; -- contrainte differree FOR d1 : dut USE ENTITY work.filtre(gradient); TYPE tableau IS ARRAY (natural RANGE <>) OF natural RANGE 0 TO 255; CONSTANT entrees : tableau := (12, 120, 5, 67, 10, 7, 116, 85, 27, 32, 255, 254, 253); CONSTANT result : tableau := ( 21,45, 94); CONSTANT tcirc : time := 100 ns; -- 10megaH CONSTANT t1 : time := 115 ns; -- 10megaH CONSTANT t2 : time := 125 ns; -- 10megaH BEGIN -- par_constantes d1: dut PORT MAP (h, init, pixel, sortie, ready_in,ack_in,ready_out, ack_out); init <= '1', '0' AFTER (tcirc + 10 ns); pour_circ : horloge(h, tcirc , 0 ns); pour_entr: horloge(h1, t1, 33 ns); pour_sort: horloge( h2, t2, 8 ns); stimu : PROCESS (h1, init, ack_IN ) VARIABLE i : natural; BEGIN -- PROCESS stimu IF init = '1' THEN -- asynchronous reset (active low) ready_IN <= '0'; pixel <= 127; -- pas 0 i := 1; ELSIF ack_in = '1' THEN ready_IN <= '0'; ELSIF front_descendant(h1) THEN -- front descendant pixel <= entrees(i); ready_IN <= '1'; i := i+1; IF i = entrees'length THEN i:= 1; END IF; END IF; END PROCESS stimu; PROCESS BEGIN -- PROCESS FOR i IN result'range LOOP WAIT UNTIL front_montant(h2) ; IF ready_out = '1' THEN ASSERT sortie /= result(i) REPORT "test " & character'val(49+i) & " correct" SEVERITY warning; END IF; ack_OUT <= ready_out; -- recopie pour valider le protocole END LOOP; -- i END PROCESS; END par_constantes;