-
Notifications
You must be signed in to change notification settings - Fork 1
/
gouraudEdge.vhd
71 lines (42 loc) · 1.62 KB
/
gouraudEdge.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
library ieee;
use ieee.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_signed.all;
entity gouraudEdge is
port(
--reset
reset: in std_logic;
clock: in std_logic;
e1_x: in std_logic_vector( 15 downto 0 );
e1_y: in std_logic_vector( 15 downto 0 );
e2_x: in std_logic_vector( 15 downto 0 );
e2_y: in std_logic_vector( 15 downto 0 );
p_x: in std_logic_vector( 15 downto 0 );
p_y: in std_logic_vector( 15 downto 0 );
edge: out std_logic_vector( 31 downto 0 )
);
end gouraudEdge;
architecture behavior of gouraudEdge is
signal a_x: std_logic_vector( 15 downto 0 );
signal a_y: std_logic_vector( 15 downto 0 );
signal b_x: std_logic_vector( 15 downto 0 );
signal b_y: std_logic_vector( 15 downto 0 );
signal leftMult: std_logic_vector( 31 downto 0 );
signal rightMult: std_logic_vector( 31 downto 0 );
begin
main: process( all )
begin
if rising_edge( clock ) then
if reset = '1' then
else
a_x <= p_x - e1_x;
a_y <= p_y - e1_y;
b_x <= e2_x - e1_x;
b_y <= e2_y - e1_y;
leftMult <= a_x * b_y;
rightMult <= a_y * b_x;
edge <= leftMult - rightMult;
end if; --reset = '1'
end if; --rising_edge( clock )
end process;
end behavior;