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_14_fg_14_02.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $
|
23
|
-- $Revision: 1.2 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
-- not in book
|
28
|
|
29
|
entity graphics_engine is
|
30
|
end entity graphics_engine;
|
31
|
|
32
|
-- end not in book
|
33
|
|
34
|
|
35
|
architecture behavioral of graphics_engine is
|
36
|
|
37
|
type point is array (1 to 3) of real;
|
38
|
type transformation_matrix is array (1 to 3, 1 to 3) of real;
|
39
|
|
40
|
signal p, transformed_p : point;
|
41
|
signal a : transformation_matrix;
|
42
|
signal clock : bit;
|
43
|
-- . . .
|
44
|
|
45
|
begin
|
46
|
|
47
|
transform_stage : for i in 1 to 3 generate
|
48
|
begin
|
49
|
|
50
|
cross_product_transform : process is
|
51
|
variable result1, result2, result3 : real := 0.0;
|
52
|
begin
|
53
|
wait until clock = '1';
|
54
|
transformed_p(i) <= result3;
|
55
|
result3 := result2;
|
56
|
result2 := result1;
|
57
|
result1 := a(i, 1) * p(1) + a(i, 2) * p(2) + a(i, 3) * p(3);
|
58
|
end process cross_product_transform;
|
59
|
|
60
|
end generate transform_stage;
|
61
|
|
62
|
-- . . . -- other stages in the pipeline, etc
|
63
|
|
64
|
-- not in book
|
65
|
|
66
|
clock_gen : clock <= '1' after 10 ns, '0' after 20 ns when clock = '0';
|
67
|
|
68
|
stimulus : process is
|
69
|
begin
|
70
|
a <= ( (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0) );
|
71
|
p <= ( 10.0, 10.0, 10.0 );
|
72
|
wait until clock = '0';
|
73
|
p <= ( 20.0, 20.0, 20.0 );
|
74
|
wait until clock = '0';
|
75
|
p <= ( 30.0, 30.0, 30.0 );
|
76
|
wait until clock = '0';
|
77
|
p <= ( 40.0, 40.0, 40.0 );
|
78
|
wait until clock = '0';
|
79
|
p <= ( 50.0, 50.0, 50.0 );
|
80
|
wait until clock = '0';
|
81
|
p <= ( 60.0, 60.0, 60.0 );
|
82
|
|
83
|
wait;
|
84
|
end process stimulus;
|
85
|
|
86
|
-- end not in book
|
87
|
|
88
|
end architecture behavioral;
|