Project

General

Profile

Download (3.6 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: tc1375.vhd,v 1.2 2001-10-26 16:29:40 paw Exp $
27
-- $Revision: 1.2 $
28
--
29
-- ---------------------------------------------------------------------
30

    
31
package c08s05b00x00p03n01i01375pkg is
32

    
33
  -- Type declarations.
34
  subtype     BV2  is BIT_VECTOR( 0 to 1 );
35
  subtype     CH2  is STRING( 1 to 2 );
36

    
37
  -- Constant declarations.
38
  constant BVC  : BV2 := B"00";
39
  constant CHC  : CH2 := "bb";
40

    
41
  -- Function returns BV2.
42
  function  returnBV2 return BV2;
43

    
44
  -- Function returns CH2.
45
  function  returnCH2 return CH2;
46
  
47
end c08s05b00x00p03n01i01375pkg;
48

    
49
package body c08s05b00x00p03n01i01375pkg is
50
  
51
  -- Function returns BV2.
52
  function  returnBV2 return BV2 is
53
  begin
54
    return ( BVC );
55
  end returnBV2;
56
  
57
  -- Function returns CH2.
58
  function  returnCH2 return CH2 is
59
  begin
60
    return( CHC );
61
  end returnCH2;
62
  
63
end c08s05b00x00p03n01i01375pkg;
64

    
65
use work.c08s05b00x00p03n01i01375pkg.all;
66
ENTITY c08s05b00x00p03n01i01375ent IS
67
END c08s05b00x00p03n01i01375ent;
68

    
69
ARCHITECTURE c08s05b00x00p03n01i01375arch OF c08s05b00x00p03n01i01375ent IS
70

    
71
BEGIN
72
  TESTING: PROCESS
73
    
74
    -- local variables
75
    variable BITV     : BV2 := B"11";
76
    variable STRV     : CH2 := "ab";
77
    
78
    variable S, T        : BIT;
79
    variable S1, T1        : BIT;
80
    variable S11, T11        : BIT;
81
    variable C1, C2      : CHARACTER;
82
    variable C11, C22      : CHARACTER;
83
    variable C111, C222      : CHARACTER;
84
    
85
  BEGIN
86
    -- Assign with a variable as the expression.
87
    ( S, T )  := BITV;
88
    
89
    ( C1,C2 ) := STRV;
90
    
91
    -- Assign with a function return value.
92
    ( S1, T1 )  := returnBV2;
93
    
94
    ( C11,C22 ) := returnCH2;
95
    
96
    -- Assign with a qualified expression.
97
    ( S11, T11 )  := BV2'( '0', '1' );
98
    
99
    ( C111,C222 ) := CH2'( 'c', 'c' );
100

    
101
    assert NOT(((S = BITV( 0 )) and (T = BITV( 1 )))
102
               and ((C1 = STRV( 1 )) and (C2 = STRV( 2 )))
103
               and ((S1 = BVC( 0 )) and (T1 = BVC( 1 )))
104
               and ((C11 = CHC( 1 )) and (C22 = CHC( 2 )))
105
               and ((S11 = '0') and (T11 = '1'))
106
               and ((C111 = 'c') and (C222 = 'c')))
107
      report "***PASSED TEST: c08s05b00x00p03n01i01375" 
108
      severity NOTE;
109
    assert (((S = BITV( 0 )) and (T = BITV( 1 )))
110
            and ((C1 = STRV( 1 )) and (C2 = STRV( 2 )))
111
            and ((S1 = BVC( 0 )) and (T1 = BVC( 1 )))
112
            and ((C11 = CHC( 1 )) and (C22 = CHC( 2 )))
113
            and ((S11 = '0') and (T11 = '1'))
114
            and ((C111 = 'c') and (C222 = 'c')))
115
      report "***FAILED TEST: c08s05b00x00p03n01i01375 - Legal aggregate variable assignment fail." 
116
      severity ERROR;
117
    wait;
118
  END PROCESS TESTING;
119

    
120
END c08s05b00x00p03n01i01375arch;
(160-160/2088)