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