aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/vests/vhdl-93/billowitch/compliant/tc1703.vhd
blob: 2c8d26f89d05b914fc2b2bca9bfe54e245f9849f (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- Copyright (C) 2001 Bill Billowitch.

-- Some of the work to develop this test suite was done with Air Force
-- support.  The Air Force and Bill Billowitch assume no
-- responsibilities for this software.

-- This file is part of VESTs (Vhdl tESTs).

-- VESTs is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; either version 2 of the License, or (at
-- your option) any later version. 

-- VESTs is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-- for more details. 

-- You should have received a copy of the GNU General Public License
-- along with VESTs; if not, write to the Free Software Foundation,
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

-- ---------------------------------------------------------------------
--
-- $Id: tc1703.vhd,v 1.2 2001-10-26 16:29:42 paw Exp $
-- $Revision: 1.2 $
--
-- ---------------------------------------------------------------------

ENTITY c09s02b00x00p05n01i01703ent IS
END c09s02b00x00p05n01i01703ent;

ARCHITECTURE c09s02b00x00p05n01i01703arch OF c09s02b00x00p05n01i01703ent IS
  signal s : boolean := false;
BEGIN

  TESTING: PROCESS
    type result_type is (fail, pass);
    variable result : result_type := fail;
    variable i, j   : integer;
    variable k   : integer := 0;
  BEGIN
    --
    -- Test all sequential statements in this process
    --
    s <= true;                        -- signal assignment        
    j := 1;                           -- variable assignment
    i := 0;
    
    L1: while  ( i < 10 )  loop       -- conditional loop
      if i > 2 then
        exit;
      end if;
      case i is
        when 0 =>
          L2: for j in 1 to 3 loop
            case j is
              when 3 =>       -- should never execute because of
                i := i + 1; -- alternative 2
                k := 1;
                exit;
                assert false
                  report "exit in loop 2 case failed."
                  severity note;
              when 2 =>
                i := i + 1;
                next L1;
                k := 1;
                assert false     -- should never execute
                  report "next in loop 2 case failed."
                  severity note;
              when 1 =>
                assert false
                  report "first iteration of loop 2."
                  severity note ;
                next;     -- applies to loop L2
              when others =>
                --
                -- This should never be executed but is
                -- required by the 1076-1987 spec. which
                -- says the subtype of 'j' is the same as
                -- the base type (integer) and not constrained
                -- to the range "1 to 3".
                --
                k := 1;
                assert false
                  report "Should never get here."
                  severity note ;
            end case;
            k := 1;
            assert false      -- should never execute
              report "next in loop 2 failed."
              severity note;
          end loop L2;
        when 2 =>
          s <= false after 5 ns;
          wait for 6 ns;
          assert not s
            report "wait statement in loop L1 failed."
            severity note ;
          
          i := i +1;
        when 1 =>
          null;
          assert false
            report "null statement and next statement worked."
            severity note ;
          i := i +1;
        when others =>
          k := 1;
          assert false
            report "exit in if statement in loop L1 failed."
            severity note ;
          exit;
      end case;
    end loop L1;

    wait for 50 ns;

    assert NOT(s=false and k = 0 and j=1) 
      report "***PASSED TEST: c09s02b00x00p05n01i01703" 
      severity NOTE;
    assert (s=false and k = 0 and j=1) 
      report "***FAILED TEST: c09s02b00x00p05n01i01703 - Process statement execution failed." 
      severity ERROR;
    wait;
  END PROCESS TESTING;

END c09s02b00x00p05n01i01703arch;