The input n is an input port of the entity e; a natural number (starts at 0 for VHDL). b is an output port of entity e; a bit (meaning '1' or '0'). This works by the ever-famous method of trial division, with a special case for 1. This is what it looks like formatted nicely:
entity m is end; architecture a of m is signal i_n : natural := 2; signal i_b : bit; type int_vector is array(natural range<>) of natural; constant primes : int_vector := (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97); function is_prime(n : natural) return boolean is begin for i in primes'range loop if n=primes(i) then return true; end if; end loop; return false; end; begin x:entity work.e port map(n=>i_n, b=>i_b); process begin i_nfor <=i 1;in 1 to primes'right loop wait for 10ns; i_n <= i; assert i_b='0'; wait i_nfor <=10 2;ns; wait for 10ns; if is_prime(i) then assert i_b='1'; i_n <= 3; else wait for 10ns; assert i_b='1';i_b='0'; i_n <= 10; end if; wait for 10ns; end loop; assert i_b='0'; report "finished" severity error; -- error to reportstop "finished";simulation end process; end a;