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_04_ch_04_10.vhd,v 1.2 2001-10-26 16:29:33 paw Exp $
|
23
|
-- $Revision: 1.2 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
entity ch_04_10 is
|
28
|
|
29
|
end entity ch_04_10;
|
30
|
|
31
|
|
32
|
----------------------------------------------------------------
|
33
|
|
34
|
|
35
|
architecture test of ch_04_10 is
|
36
|
|
37
|
-- code from book:
|
38
|
|
39
|
type time_stamp is record
|
40
|
seconds : integer range 0 to 59;
|
41
|
minutes : integer range 0 to 59;
|
42
|
hours : integer range 0 to 23;
|
43
|
end record time_stamp;
|
44
|
|
45
|
-- end of code from book
|
46
|
|
47
|
begin
|
48
|
|
49
|
|
50
|
process_04_4_a : process is
|
51
|
|
52
|
-- code from book:
|
53
|
|
54
|
variable sample_time, current_time : time_stamp;
|
55
|
|
56
|
--
|
57
|
|
58
|
constant midday : time_stamp := (0, 0, 12);
|
59
|
|
60
|
-- end of code from book
|
61
|
|
62
|
constant clock : integer := 79;
|
63
|
variable sample_hour : integer;
|
64
|
|
65
|
begin
|
66
|
|
67
|
current_time := (30, 15, 2);
|
68
|
|
69
|
-- code from book:
|
70
|
|
71
|
sample_time := current_time;
|
72
|
|
73
|
sample_hour := sample_time.hours;
|
74
|
|
75
|
current_time.seconds := clock mod 60;
|
76
|
|
77
|
-- end of code from book
|
78
|
|
79
|
wait;
|
80
|
end process process_04_4_a;
|
81
|
|
82
|
|
83
|
process_04_4_b : process is
|
84
|
|
85
|
type opcodes is (add, sub, addu, subu, jmp, breq, brne, ld, st, nop);
|
86
|
type reg_number is range 0 to 31;
|
87
|
|
88
|
type instruction is record
|
89
|
opcode : opcodes;
|
90
|
source_reg1, source_reg2, dest_reg : reg_number;
|
91
|
displacement : integer;
|
92
|
end record instruction;
|
93
|
|
94
|
-- code from book:
|
95
|
|
96
|
constant midday : time_stamp := (hours => 12, minutes => 0, seconds => 0);
|
97
|
|
98
|
--
|
99
|
|
100
|
constant nop_instr : instruction :=
|
101
|
( opcode => addu,
|
102
|
source_reg1 | source_reg2 | dest_reg => 0,
|
103
|
displacement => 0 );
|
104
|
|
105
|
variable latest_event : time_stamp := (others => 0); -- initially midnight
|
106
|
|
107
|
-- end of code from book
|
108
|
|
109
|
begin
|
110
|
wait;
|
111
|
end process process_04_4_b;
|
112
|
|
113
|
end architecture test;
|