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_fg_18_07.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $
|
23
|
-- $Revision: 1.2 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
entity fg_18_07_a is
|
28
|
end entity fg_18_07_a;
|
29
|
|
30
|
|
31
|
architecture writer of fg_18_07_a is
|
32
|
begin
|
33
|
|
34
|
process is
|
35
|
type transform_file is file of real;
|
36
|
file initial_transforms : transform_file open write_mode is "transforms.ini";
|
37
|
begin
|
38
|
for i in 1 to 50 loop
|
39
|
write(initial_transforms, real(i));
|
40
|
end loop;
|
41
|
wait;
|
42
|
end process;
|
43
|
|
44
|
end architecture writer;
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
entity fg_18_07 is
|
50
|
end entity fg_18_07;
|
51
|
|
52
|
|
53
|
architecture test of fg_18_07 is
|
54
|
begin
|
55
|
|
56
|
process is
|
57
|
|
58
|
-- code from book (in text)
|
59
|
|
60
|
type transform_array is array (1 to 3, 1 to 3) of real;
|
61
|
variable transform1, transform2 : transform_array;
|
62
|
|
63
|
type transform_file is file of real;
|
64
|
file initial_transforms : transform_file
|
65
|
open read_mode is "transforms.ini";
|
66
|
|
67
|
-- end code from book
|
68
|
|
69
|
-- code from book (Figure 18-7)
|
70
|
|
71
|
procedure read_transform ( file f : transform_file;
|
72
|
variable transform : out transform_array ) is
|
73
|
begin
|
74
|
for i in transform'range(1) loop
|
75
|
for j in transform'range(2) loop
|
76
|
if endfile(f) then
|
77
|
report "unexpected end of file in read_transform - "
|
78
|
& "some array elements not read"
|
79
|
severity error;
|
80
|
return;
|
81
|
end if;
|
82
|
read ( f, transform(i, j) );
|
83
|
end loop;
|
84
|
end loop;
|
85
|
end procedure read_transform;
|
86
|
|
87
|
-- end code from book
|
88
|
|
89
|
begin
|
90
|
|
91
|
-- code from book (in text)
|
92
|
|
93
|
read_transform ( initial_transforms, transform1 );
|
94
|
read_transform ( initial_transforms, transform2 );
|
95
|
|
96
|
-- end code from book
|
97
|
|
98
|
wait;
|
99
|
end process;
|
100
|
|
101
|
end architecture test;
|