Project

General

Profile

Download (3.36 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
-- Copyright (C) 2001 Bill Billowitch.
3

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

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

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

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

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

    
24
-- ---------------------------------------------------------------------
25
--
26
-- $Id: tc1523.vhd,v 1.2 2001-10-26 16:29:41 paw Exp $
27
-- $Revision: 1.2 $
28
--
29
-- ---------------------------------------------------------------------
30

    
31
package c08s09b00x00p07n01i01523pkg is
32

    
33
  -- Global procedure.
34
  procedure proc1;
35

    
36
  -- Global function.
37
  function  func1 return INTEGER;
38

    
39
end c08s09b00x00p07n01i01523pkg;
40

    
41
package body c08s09b00x00p07n01i01523pkg is
42

    
43
  procedure proc1 is
44
    -- Local variables
45
    variable  INTV  : INTEGER := 0;
46

    
47
  begin
48
    -- Check initialization.
49
    assert (INTV = 0);
50

    
51
    -- Loop until the indicated condition has been met.
52
    loop
53
      -- Execute some meaningful function.
54
      null;
55

    
56
      -- Increment the counter.
57
      INTV := INTV + 1;
58

    
59
      -- If the condition has been met, terminate the loop.
60
      if  (INTV = 10) then
61
        return;
62
      end if;
63

    
64
      -- Verify that we have not exceeded the limits of the loop.
65
      assert (INTV < 10);
66
    end loop;
67
    
68
    -- Should NEVER get to this step.
69
    assert (FALSE)
70
      report "Return has not exited the procedure.";
71
  end proc1;
72
  
73
  function func1 return INTEGER is
74
    -- Local variables
75
    variable  INTV  : INTEGER := 0;
76
    
77
  begin
78
    -- Check initialization.
79
    assert (INTV = 0);
80
    
81
    -- Loop until the indicated condition has been met.
82
    loop
83
      -- Execute some meaningful function.
84
      null;
85
      -- Increment the counter.
86
      INTV := INTV + 1;
87
      
88
      -- If the condition has been met, terminate the loop.
89
      if  (INTV = 10) then
90
        return( INTV );
91
      end if;
92
      
93
      -- Verify that we have not exceeded the limits of the loop.
94
      assert (INTV < 10);
95
    end loop;
96
    
97
    -- Should NEVER get to this step.
98
    assert (FALSE)
99
      report "Return has not exited the procedure.";
100
  end func1;
101
  
102
end c08s09b00x00p07n01i01523pkg;
103

    
104
use work.c08s09b00x00p07n01i01523pkg.all;
105
ENTITY c08s09b00x00p07n01i01523ent IS
106
END c08s09b00x00p07n01i01523ent;
107

    
108
ARCHITECTURE c08s09b00x00p07n01i01523arch OF c08s09b00x00p07n01i01523ent IS
109

    
110
BEGIN
111
  TESTING: PROCESS
112
    variable k : integer := 0;
113
  BEGIN
114
    -- Call procedure to loop/return.
115
    proc1;
116
    
117
    assert NOT(func1=10)
118
      report "***PASSED TEST: c08s09b00x00p07n01i01523" 
119
      severity NOTE;
120
    assert (func1=10)
121
      report "***PASSED TEST: c08s09b00x00p07n01i01523 - Function did not return proper value." 
122
      severity NOTE;
123
    wait;
124
  END PROCESS TESTING;
125

    
126
END c08s09b00x00p07n01i01523arch;
(205-205/2088)