aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/vests/vhdl-93/clifton-labs/compliant/functional/std_logic_1164/test_xor_table.vhdl
blob: 32e55cd6d566a31b3be0a2c57b837095e1fc5cad (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
entity test is
end test;

library ieee;
use ieee.std_logic_1164.all;

package foo is
  TYPE stdlogic_table IS ARRAY(std_ulogic, std_ulogic) OF std_ulogic;
    -- truth table for "xor" function
    CONSTANT xor_table : stdlogic_table := (
    --      ----------------------------------------------------
    --      |  U    X    0    1    Z    W    L    H    -         |   |
    --      ----------------------------------------------------
            ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ),  -- | U |
            ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ),  -- | X |
            ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ),  -- | 0 |
            ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ),  -- | 1 |
            ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ),  -- | Z |
            ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ),  -- | W |
            ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ),  -- | L |
            ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ),  -- | H |
            ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' )   -- | - |
    );
end foo;

use work.foo.all;

library ieee;
use ieee.std_logic_1164.all;

architecture only of test is

begin  -- only
  process
  begin  -- process
    assert xor_table( 'U', 'U' ) = 'U' report "TEST FAILED-UxU";
    assert xor_table( 'U', 'X' ) = 'U' report "TEST FAILED-UxX";
    assert xor_table( 'X', '-' ) = 'X' report "TEST FAILED-Xx-";
    assert xor_table( '0', '1' ) = '1' report "TEST FAILED-0x1";
    assert xor_table( 'H', 'Z' ) = 'X' report "TEST FAILED-HxZ";
    assert xor_table( 'Z', 'W' ) = 'X' report "TEST FAILED-ZxW";
    assert xor_table( 'L', '1' ) = '1' report "TEST FAILED-Lx1";
    assert xor_table( 'H', '1' ) = '0' report "TEST FAILED-Hx1";
    assert xor_table( '0', 'L' ) = '0' report "TEST FAILED-0xL";
    assert xor_table( 'Z', 'L' ) = 'X' report "TEST FAILED-ZxL";
    assert xor_table( 'Z', 'H' ) = 'X' report "TEST FAILED-ZxH";
    wait;
  end process;
end only;