1entity driver1 is 2end entity; 3 4architecture test of driver1 is 5 6 type u is (A, B, C); 7 8 type uv is array (natural range <>) of u; 9 10 function func (x : uv) return u is 11 begin 12 --report "func called"; 13 for i in x'range loop 14 -- report u'image(x(i)); 15 end loop; 16 for i in x'range loop 17 if x(i) = A then 18 return A; 19 end if; 20 end loop; 21 return B; 22 end function; 23 24 subtype r is func u; 25 26 signal s : r := B; 27 signal k : r := C; 28begin 29 30 one: process is 31 begin 32 assert s = B; 33 s <= A; 34 wait for 1 ns; 35 36 assert s = A; 37 s <= B; 38 wait for 1 ns; 39 40 assert s = B; 41 null; 42 wait for 1 ns; 43 44 assert s = A; 45 46 wait; 47 end process; 48 49 two: process is 50 begin 51 assert s = B; 52 s <= B; 53 wait for 1 ns; 54 55 assert s = A; 56 null; 57 wait for 1 ns; 58 59 assert s = B; 60 s <= A; 61 wait for 1 ns; 62 63 assert s = A; 64 65 wait; 66 end process; 67 68 three: process is 69 begin 70 k <= C; 71 wait for 1 ns; 72 assert k = B; 73 wait; 74 end process; 75 76end architecture; 77