OpenCores
URL https://opencores.org/ocsvn/jart/jart/trunk

Subversion Repositories jart

[/] [jart/] [trunk/] [BLRT/] [dotCell.vhd] - Blame information for rev 17

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 jguarin200
-- Author : Julian Andres Guarin Reyes.
2
-- Project : JART, Just Another Ray Tracer.
3
-- email : jguarin2002 at gmail.com, j.guarin at javeriana.edu.co
4
 
5
-- This code was entirely written by Julian Andres Guarin Reyes.
6
-- The following code is licensed under GNU Public License
7
-- http://www.gnu.org/licenses/gpl-3.0.txt.
8
 
9
 -- This file is part of JART (Just Another Ray Tracer).
10
 
11
    -- JART (Just Another Ray Tracer) is free software: you can redistribute it and/or modify
12
    -- it under the terms of the GNU General Public License as published by
13
    -- the Free Software Foundation, either version 3 of the License, or
14
    -- (at your option) any later version.
15
 
16
    -- JART (Just Another Ray Tracer) is distributed in the hope that it will be useful,
17
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
    -- GNU General Public License for more details.
20
 
21
    -- You should have received a copy of the GNU General Public License
22
    -- along with JART (Just Another Ray Tracer).  If not, see <http://www.gnu.org/licenses/>.
23
 
24
-- A single dot product cell.
25
 
26 14 jguarin200
library ieee;
27
use ieee.std_logic_1164.all;
28
use work.powerGrid.all;
29
 
30
entity dotCell is
31
        generic (       levelW  : integer := 18;        -- Actual Level Width
32
                                nLevelW : integer := 32);       -- Next Level Width
33
        port    (       clk             : in std_logic;
34
                                rst             : in std_logic;
35
 
36
                                -- Object control.
37 17 jguarin200
                                nxtRow  : in std_logic; -- This bit controls when the sphere center goes to the next row.
38 14 jguarin200
                                -- First Side.
39
                                vxInput         : in std_logic_vector(levelW-1 downto 0);
40
                                vyInput         : in std_logic_vector(levelW-1 downto 0);
41
                                vzInput         : in std_logic_vector(levelW-1 downto 0);
42
 
43
                                -- Second Side (Opposite to the first one)
44
                                vxOutput                : out std_logic_vector(levelW-1 downto 0);
45
                                vyOutput                : out std_logic_vector(levelW-1 downto 0);
46
                                vzOutput                : out std_logic_vector(levelW-1 downto 0);
47
 
48
                                -- Third Side (Perpendicular to the first and second ones)
49
                                dxInput         : in std_logic_vector(levelW-1 downto 0);
50
                                dyInput         : in std_logic_vector(levelW-1 downto 0);
51
                                dzInput         : in std_logic_vector(levelW-1 downto 0);
52
 
53
                                --Fourth Side (Opposite to the third one)
54
                                dxOutput                : in std_logic_vector(levelW-1 downto 0);
55
                                dyOutput                : in std_logic_vector(levelW-1 downto 0);
56
                                dzOutput                : in std_logic_vector(levelW-1 downto 0);
57
 
58
                                --Fifth Side (Going to the floor right upstairs!)
59
                                vdOutput                : out std_logic_vector(nLevelW-1 downto 0); -- Dot product.
60
 
61 17 jguarin200
        );
62 14 jguarin200
        end port;
63
end entity;
64
 
65
 
66
architecture rtl of rtCell is
67
 
68
 
69
        signal svd      : std_logic_vector (nLevelW - 1 downto 0);
70
 
71
begin
72
 
73
        -- The Dotprod Machine
74
        vd      : dp18 port map (
75
                clock0  => clk,
76
                dataa_0 => dxInput,
77
                dataa_1 => dyInput,
78
                dataa_2 => dzInput,
79
                datab_0 => vxInput,
80
                datab_1 => vyInput,
81
                datab_2 => vzInput,
82
                result  => svd
83
                );
84
 
85
        -- Ray PipeLine
86
        rayPipeStage : process (clk,rst)
87
        begin
88
                if rst = '0' then
89
                        -- There is no ray load yet.
90
                        dxOutput <= (others => '0');
91
                        dyOutput <= (others => '0');
92
                        dzOutput <= (others => '0');
93
 
94
                elsif rising_edge (clk) then
95
 
96
                        -- Set 
97
                        dxOutput <= dxInput;
98
                        dyOutput <= dyInput;
99
                        dzOutput <= dzInput;
100
 
101
                end if;
102
 
103
        end process;
104
 
105
        -- Sphere Pipe Line
106
        spherePipeStage : process (clk,rts)
107
        begin
108
                if rst = '0' then
109
 
110
                -- There is no object center yet.
111
                        vxOutput <= (others => '0');
112
                        vyOutput <= (others => '0');
113
                        vzOutput <= (others => '0');
114
 
115 17 jguarin200
                elsif rising_edge (clk) and nxtRow ='1' then
116 14 jguarin200
 
117
                        -- Shift sphere to the next row.
118
                        vxOutput <= vxInput;
119
                        vyOutput <= vyInput;
120
                        vzOutput <= vzInput;
121
 
122
                end if;
123
 
124
        end process;
125
 
126
        -- Upper Level
127
        vdPipeStage     : process (clk,rst)
128
        begin
129
 
130
                if rst='0' then
131
 
132
                        vdOutput <= (others => '0');
133
 
134
                elsif rising_edge(clk) then
135
 
136
                        vdOutput  <= svd;
137
 
138
                end if;
139
 
140
        end process;
141
 
142
 
143
end rtl;
144
 
145
 
146
 
147
 
148
 
149
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.