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 021111307 USA

23


24

 

25



26

 $Id: tc1309.vhd,v 1.2 20011026 16:29:39 paw Exp $

27

 $Revision: 1.2 $

28



29

 

30


31

package c08s04b00x00p07n01i01309pkg 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 c08s04b00x00p07n01i01309pkg;

48


49

package body c08s04b00x00p07n01i01309pkg 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 c08s04b00x00p07n01i01309pkg;

64


65

use work.c08s04b00x00p07n01i01309pkg.all;

66

ENTITY c08s04b00x00p07n01i01309ent IS

67

END c08s04b00x00p07n01i01309ent;

68


69

ARCHITECTURE c08s04b00x00p07n01i01309arch OF c08s04b00x00p07n01i01309ent IS

70

 Local signals.

71

signal S : BIT;

72

signal T : BIT;

73


74

signal C1, C2 : CHARACTER;

75

BEGIN

76

TESTING: PROCESS

77


78

 local variables

79

variable BITV : BV2 := B"11";

80

variable STRV : CH2 := "ab";

81

variable ShouldBeTime : TIME;

82


83

variable k : integer := 0;

84


85

BEGIN

86

 Assign with a variable as the expression.

87

( S, T ) <= BITV after 10 ns;

88

ShouldBeTime := NOW + 10 ns;

89

wait on S,T;

90

if (ShouldBeTime /= Now or S /= BITV(0) or T /= BITV(1)) then

91

k := 1;

92

end if;

93

assert (ShouldBeTime = NOW);

94

assert ((S = BITV( 0 )) and (T = BITV( 1 )));

95


96

( C1,C2 ) <= STRV after 10 ns;

97

ShouldBeTime := NOW + 10 ns;

98

wait on C1,C2;

99

if (ShouldBeTime /= Now or C1 /= STRV(1) or C2 /= STRV(2)) then

100

k := 1;

101

end if;

102

assert (ShouldBeTime = NOW);

103

assert ((C1 = STRV( 1 )) and (C2 = STRV( 2 )));

104


105

 Assign with a function return value.

106

( S, T ) <= returnBV2 after 10 ns;

107

ShouldBeTime := NOW + 10 ns;

108

wait on S,T;

109

if (ShouldBeTime /= Now or S /= BVC(0) or T /= BVC(1)) then

110

k := 1;

111

end if;

112

assert (ShouldBeTime = NOW);

113

assert ((S = BVC( 0 )) and (T = BVC( 1 )));

114


115

( C1,C2 ) <= returnCH2 after 10 ns;

116

ShouldBeTime := NOW + 10 ns;

117

wait on C1,C2;

118

if (ShouldBeTime /= Now or C1 /= CHC(1) or C2 /= CHC(2)) then

119

k := 1;

120

end if;

121

assert (ShouldBeTime = NOW);

122

assert ((C1 = CHC( 1 )) and (C2 = CHC( 2 )));

123


124

 Assign with a qualified expression.

125

( S, T ) <= BV2'( '0', '1' ) after 10 ns;

126

ShouldBeTime := NOW + 10 ns;

127

wait on S,T;

128

if (ShouldBeTime /= Now or S /= '0' or T /= '1') then

129

k := 1;

130

end if;

131

assert (ShouldBeTime = NOW);

132

assert ((S = '0') and (T = '1'));

133


134

( C1,C2 ) <= CH2'( 'c', 'c' ) after 10 ns;

135

ShouldBeTime := NOW + 10 ns;

136

wait on C1,C2;

137

if (ShouldBeTime /= Now or C1 /= 'c' or C2 /= 'c') then

138

k := 1;

139

end if;

140

assert (ShouldBeTime = NOW);

141

assert ((C1 = 'c') and (C2 = 'c'));

142


143

assert NOT( k = 0 )

144

report "***PASSED TEST: c08s04b00x00p07n01i01309"

145

severity NOTE;

146

assert ( k = 0 )

147

report "***FAILED TEST: c08s04b00x00p07n01i01309  If the target of the signal assignment statement is in the form of an aggregate, then the type of the aggregate must be determinable from the context."

148

severity ERROR;

149

wait;

150

END PROCESS TESTING;

151


152

END c08s04b00x00p07n01i01309arch;
