1
|
|
2
|
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc
|
3
|
|
4
|
-- This file is part of VESTs (Vhdl tESTs).
|
5
|
|
6
|
-- VESTs is free software; you can redistribute it and/or modify it
|
7
|
-- under the terms of the GNU General Public License as published by the
|
8
|
-- Free Software Foundation; either version 2 of the License, or (at
|
9
|
-- your option) any later version.
|
10
|
|
11
|
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
-- for more details.
|
15
|
|
16
|
-- You should have received a copy of the GNU General Public License
|
17
|
-- along with VESTs; if not, write to the Free Software Foundation,
|
18
|
-- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
|
20
|
-- ---------------------------------------------------------------------
|
21
|
--
|
22
|
-- $Id: ch_18_ch_18_02.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $
|
23
|
-- $Revision: 1.2 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
entity ch_18_02_a is
|
28
|
end entity ch_18_02_a;
|
29
|
|
30
|
|
31
|
architecture writer of ch_18_02_a is
|
32
|
begin
|
33
|
|
34
|
process is
|
35
|
type bit_vector_file is file of bit_vector;
|
36
|
file vectors : bit_vector_file open write_mode is "vectors.dat";
|
37
|
begin
|
38
|
write(vectors, bit_vector'(""));
|
39
|
write(vectors, bit_vector'("1"));
|
40
|
write(vectors, bit_vector'("10"));
|
41
|
write(vectors, bit_vector'("011"));
|
42
|
write(vectors, bit_vector'("0100"));
|
43
|
write(vectors, bit_vector'("00101"));
|
44
|
write(vectors, bit_vector'("000110"));
|
45
|
write(vectors, bit_vector'("0000111"));
|
46
|
write(vectors, bit_vector'("00001000"));
|
47
|
write(vectors, bit_vector'("111111111111111111111111111111111111111111111111111111111111111111111111"));
|
48
|
wait;
|
49
|
end process;
|
50
|
|
51
|
end architecture writer;
|
52
|
|
53
|
|
54
|
----------------------------------------------------------------
|
55
|
|
56
|
|
57
|
|
58
|
entity ch_18_02 is
|
59
|
|
60
|
end entity ch_18_02;
|
61
|
|
62
|
|
63
|
----------------------------------------------------------------
|
64
|
|
65
|
|
66
|
architecture test of ch_18_02 is
|
67
|
begin
|
68
|
|
69
|
|
70
|
process is
|
71
|
|
72
|
type element_type is (t1, t2, t3);
|
73
|
type file_type is file of element_type;
|
74
|
|
75
|
-- code from book:
|
76
|
|
77
|
type bit_vector_file is file of bit_vector;
|
78
|
|
79
|
procedure read ( file f : file_type;
|
80
|
value : out element_type; length : out natural );
|
81
|
|
82
|
-- end of code from book
|
83
|
|
84
|
procedure read ( file f : file_type;
|
85
|
value : out element_type; length : out natural ) is
|
86
|
begin
|
87
|
end;
|
88
|
|
89
|
-- end of code from book
|
90
|
|
91
|
begin
|
92
|
wait;
|
93
|
end process;
|
94
|
|
95
|
|
96
|
process is
|
97
|
|
98
|
type bit_vector_file is file of bit_vector;
|
99
|
|
100
|
-- code from book:
|
101
|
|
102
|
file vectors : bit_vector_file open read_mode is "vectors.dat";
|
103
|
variable next_vector : bit_vector(63 downto 0);
|
104
|
variable actual_len : natural;
|
105
|
|
106
|
-- end of code from book
|
107
|
|
108
|
variable lost : boolean;
|
109
|
|
110
|
begin
|
111
|
while not endfile(vectors) loop
|
112
|
|
113
|
-- code from book:
|
114
|
|
115
|
read(vectors, next_vector, actual_len);
|
116
|
|
117
|
-- end of code from book
|
118
|
|
119
|
lost :=
|
120
|
-- code from book:
|
121
|
|
122
|
actual_len > next_vector'length
|
123
|
|
124
|
-- end of code from book
|
125
|
;
|
126
|
|
127
|
end loop;
|
128
|
|
129
|
wait;
|
130
|
end process;
|
131
|
|
132
|
|
133
|
end architecture test;
|