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_03_ch_03_03.vhd,v 1.3 2001-10-26 16:29:33 paw Exp $
|
23
|
-- $Revision: 1.3 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
entity ch_03_03 is
|
28
|
end entity ch_03_03;
|
29
|
|
30
|
architecture test of ch_03_03 is
|
31
|
begin
|
32
|
|
33
|
process_3_1_c : process is
|
34
|
|
35
|
type mode_type is (immediate, other_mode);
|
36
|
type opcode_type is (load, add, subtract, other_opcode);
|
37
|
|
38
|
variable mode : mode_type;
|
39
|
variable opcode : opcode_type;
|
40
|
constant immed_operand : integer := 1;
|
41
|
constant memory_operand : integer := 2;
|
42
|
constant address_operand : integer := 3;
|
43
|
variable operand : integer;
|
44
|
|
45
|
procedure procedure_3_1_c is
|
46
|
begin
|
47
|
|
48
|
-- code from book:
|
49
|
|
50
|
if mode = immediate then
|
51
|
operand := immed_operand;
|
52
|
elsif opcode = load or opcode = add or opcode = subtract then
|
53
|
operand := memory_operand;
|
54
|
else
|
55
|
operand := address_operand;
|
56
|
end if;
|
57
|
|
58
|
-- end of code from book
|
59
|
|
60
|
end procedure_3_1_c;
|
61
|
|
62
|
begin
|
63
|
mode := immediate;
|
64
|
procedure_3_1_c;
|
65
|
|
66
|
mode := other_mode;
|
67
|
opcode := load;
|
68
|
procedure_3_1_c;
|
69
|
|
70
|
opcode := add;
|
71
|
procedure_3_1_c;
|
72
|
|
73
|
opcode := subtract;
|
74
|
procedure_3_1_c;
|
75
|
|
76
|
opcode := other_opcode;
|
77
|
procedure_3_1_c;
|
78
|
|
79
|
wait;
|
80
|
end process process_3_1_c;
|
81
|
|
82
|
end architecture test;
|