Project

General

Profile

Download (2.88 KB) Statistics
| Branch: | Tag: | Revision:
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_05.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
entity fg_18_05_a is
28
end entity fg_18_05_a;
29

    
30

    
31
architecture writer of fg_18_05_a is
32
begin
33

    
34
  process is
35

    
36
            type integer_file is file of integer;
37
          file data_file : integer_file open write_mode is "coeff-data";
38

    
39
  begin
40
    write(data_file, 0);
41
    write(data_file, 1);
42
    write(data_file, 2);
43
    write(data_file, 3);
44
    write(data_file, 4);
45
    write(data_file, 5);
46
    write(data_file, 6);
47
    write(data_file, 7);
48
    write(data_file, 8);
49
    write(data_file, 9);
50
    write(data_file, 10);
51
    write(data_file, 11);
52
    write(data_file, 12);
53
    write(data_file, 13);
54
    write(data_file, 14);
55
    write(data_file, 15);
56
    write(data_file, 16);
57
    write(data_file, 17);
58
    write(data_file, 18);
59

    
60
    wait;
61
  end process;
62

    
63
end architecture writer;
64

    
65

    
66

    
67
entity fg_18_05 is
68
end entity fg_18_05;
69

    
70

    
71
architecture test of fg_18_05 is
72
begin
73

    
74
  process is
75

    
76
            -- code from book (in text)
77

    
78
            type integer_vector is array (integer range <>) of integer;
79

    
80
          -- end code from book
81

    
82
          -- code from book (Figure 18-5)
83

    
84
          impure function read_array ( file_name : string;  array_length : natural )
85
            return integer_vector is
86
            type integer_file is file of integer;
87
            file data_file : integer_file open read_mode is file_name;
88
            variable result : integer_vector(1 to array_length) := (others => 0);
89
            variable index : integer := 1;
90
          begin
91
            while not endfile(data_file) and index <= array_length loop
92
              read(data_file, result(index));
93
              index := index + 1;
94
            end loop;
95
            return result;
96
          end function read_array;
97

    
98
          -- end code from book
99

    
100
          -- code from book (in text)
101

    
102
          constant coeffs : integer_vector := read_array("coeff-data", 16);
103

    
104
          -- end code from book
105

    
106
  begin
107
    wait;
108
  end process;
109

    
110
end architecture test;
111

    
(406-406/510)