aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue747/fa_tb.vhdl
blob: 600c02f47a19ce46bfd1ea75cc9f5654f62aaf57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
library ieee;
use ieee.std_logic_1164.all;

entity fa_tb is
end fa_tb;

architecture fa_behave of fa_tb is
  signal a, b, ci, co, s : std_ulogic;

begin
  DUT : entity work.fa
    port map(a  => a,
             b  => b,
             ci => ci,
             s  => s,
             co => co);

  process
    type pattern_type is record
      a, b, ci, s, co : std_ulogic;
    end record;

    type pattern_array is array (natural range <>) of pattern_type;
    constant patterns : pattern_array :=
      (('0', '0', '0', '0', '0'),
       ('0', '0', '1', '1', '0'),
       ('0', '1', '0', '1', '0'),
       ('0', '1', '1', '0', '1'),
       ('1', '0', '0', '1', '0'),
       ('1', '0', '1', '0', '1'),
       ('1', '1', '0', '0', '1'),
       ('1', '1', '1', '1', '1'));

  begin
    for i in pattern_array'range loop
      a  <= pattern_array(i).a;
      b  <= pattern_array(i).b;
      ci <= pattern_array(i).ci;

      wait for 1 ns;
      
      assert s = pattern_array(i).s
        report "bad sum value" severity error;

      assert co = pattern_array(i).co
        report "bad co value" severity error;

    end loop;

    assert false
      report "end of test" severity note;

    wait;
  end process;

end fa_behave;