1
|
|
2
|
-- Copyright (C) 2002 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
|
entity inline_07 is
|
21
|
|
22
|
end entity inline_07;
|
23
|
|
24
|
|
25
|
----------------------------------------------------------------
|
26
|
|
27
|
|
28
|
library ieee; use ieee.numeric_bit.all;
|
29
|
|
30
|
architecture test of inline_07 is
|
31
|
begin
|
32
|
|
33
|
|
34
|
process_5_a : process is
|
35
|
|
36
|
-- code from book:
|
37
|
|
38
|
procedure increment ( a : inout integer; n : in integer := 1 ) is -- . . .
|
39
|
-- not in book
|
40
|
begin
|
41
|
a := a + n;
|
42
|
end procedure increment;
|
43
|
-- end not in book;
|
44
|
|
45
|
procedure increment ( a : inout bit_vector; n : in bit_vector := B"1" ) is -- . . .
|
46
|
-- not in book
|
47
|
begin
|
48
|
a := bit_vector(signed(a) + signed(n));
|
49
|
end procedure increment;
|
50
|
-- end not in book;
|
51
|
|
52
|
procedure increment ( a : inout bit_vector; n : in integer := 1 ) is -- . . .
|
53
|
-- not in book
|
54
|
begin
|
55
|
a := bit_vector(signed(a) + to_signed(n, a'length));
|
56
|
end procedure increment;
|
57
|
-- end not in book;
|
58
|
|
59
|
variable count_int : integer := 2;
|
60
|
variable count_bv : bit_vector (15 downto 0) := X"0002";
|
61
|
|
62
|
-- end of code from book
|
63
|
|
64
|
begin
|
65
|
|
66
|
-- code from book:
|
67
|
|
68
|
increment ( count_int, 2 );
|
69
|
increment ( count_int );
|
70
|
|
71
|
increment ( count_bv, X"0002");
|
72
|
increment ( count_bv, 1 );
|
73
|
|
74
|
-- increment ( count_bv );
|
75
|
|
76
|
-- end of code from book
|
77
|
|
78
|
wait;
|
79
|
end process process_5_a;
|
80
|
|
81
|
|
82
|
end architecture test;
|