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

Subversion Repositories jart

[/] [jart/] [trunk/] [BLRT/] [gridCube.vhd] - Blame information for rev 34

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 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
 
25
-- This is it!!!!! The following code represents the whole blocks gathered all together.
26
-- This block represents a processing cube. The cube's height is always 3 (floor 0 to floor 2). The cube width
27
-- is the number of spheres under intersection test each clock. The cube depth represents the number or rays under
28
-- intersection test each clock. 
29
 
30
-- Details on the cube outputs interpretation, can be found at BlackBook.pdf
31
 
32
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
use work.powerGrid.all;
36
 
37
entity gridCube is
38
        generic (
39
                -- Depth
40
                D       : integer := 4;
41
                -- ID width.
42
                IDW     : integer := 2;
43
                -- Number of Columns.
44
                C       : integer := 4;
45
                -- Input rays width.
46
                W0      : integer := 18;
47
                -- Dot products and spheres constant width
48
                W1      : integer := 32;        IDW     : integer := 2;
49
 
50
                );
51
        port (
52
                        -- The usual control signals.
53
                clk,rst : in std_logic;
54
 
55
                -- Grid, rays and sphere flow through control signals.
56
                pipeOn                  : in std_logic;
57
                -- The same column nxtSphere signal control..... regardless the Cube Depth.
58
                nxtSphere               : in std_logic_vector (C-1 downto 0);
59
 
60
                -- R-F0
61
                -- Input Values. 
62
                -- The ray input vector. 
63
                iRayx: in std_logic_vector (D*W0 - 1 downto 0);
64
                iRayy: in std_logic_vector (D*W0 - 1 downto 0);
65
                iRayz: in std_logic_vector (D*W0 - 1 downto 0);
66
                -- The spheres x position (sphere centers) input vectors.
67
                iSphrCenterx: in std_logic_vector (C*W0 - 1 downto 0);
68
                -- The spheres y position (sphere centers) input vectors.
69
                iSphrCentery: in std_logic_vector (C*W0 - 1 downto 0);
70
                -- The spheres z position (sphere centers) input vectors.
71
                iSphrCenterz: in std_logic_vector (C*W0 - 1 downto 0);
72
                -- The spheres x position (sphere centers) output vectors.
73
                oSphrCenterx: out std_logic_vector (C*W0 - 1 downto 0);
74
                -- The spheres y positions (sphere centes) output vectors.
75
                oSphrCentery: out std_logic_vector (C*W0 - 1 downto 0);
76
                -- The spheres z positions (sphere centers) output vectors.             
77
                oSphrCenterz: out std_logic_vector (C*W0 - 1 downto 0);
78
                -- Output Values
79
                -- The ray output vector.
80
                oRayx: out std_logic_vector (D*W0 - 1 downto 0);
81
                oRayy: out std_logic_vector (D*W0 - 1 downto 0);
82
                oRayz: out std_logic_vector (D*W0 - 1 downto 0);
83
 
84
                -- R-F1
85
                -- K Input / Output.
86
                kInput  : in std_logic_vector (C*W1 - 1 downto 0);
87
                kOutput : out std_logic_vector (C*W1 - 1 downto 0)
88
 
89
                --R-F2
90
                -- Input Values
91
                refvd   : in std_logic_vector (D*W1-1 downto 0);
92
                selvd   : out std_logic_vector (D*W1-1 downto 0);
93
                colid   : out std_logic_vector (D*IDW-1 downto 0);
94
                inter   : out std_logic_vector (D-1 downto 0)
95
                );
96
end entity;
97
 
98
architecture rtl of gridCube is
99
 
100
        -- Difussion nets for sphere constant and center .
101
        signal sK       : std_logic_vector ((D+1)*C*W1 - 1 downto 0);
102
        signal sVx      : std_logic_vector ((D+1)*C*W0 - 1 downto 0);
103
        signal sVy      : std_logic_vector ((D+1)*C*W0 - 1 downto 0);
104
        signal sVz      : std_logic_vector ((D+1)*C*W0 - 1 downto 0);
105
 
106
 
107
 
108
begin
109
 
110
        -- External connections : K constant.
111
        sK (C*W1-1 downto 0) <= kInput;
112
        kOutput <= sK ((D+1)*C*W1-1 downto D*C*W1-1);
113
 
114
        -- External connections : Sphere Center.
115
        sVx (C*W0-1 downto 0) <= iSphereCenterx;
116
        sVy (C*W0-1 downto 0) <= iSphereCentery;
117
        sVz (C*W0-1 downto 0) <= iSphereCenterz;
118
        oRayx <= sVx ((D+1)*C*W0-1 downto D*C*W0-1);
119
        oRayy <= sVy ((D+1)*C*W0-1 downto D*C*W0-1);
120
        oRayz <= sVz ((D+1)*C*W0-1 downto D*C*W0-1);
121
 
122
 
123
        gridArray: for i in 0 to D-1 generate
124
 
125
                gridn: rayxsphereGrid
126
                generic map (
127
                IDW = IDW,
128
                C       = C,
129
                W0      = W0,
130
                W1      = W1 );
131
                port map (
132
                clk                             => clk,
133
                rst                             => rst,
134
                pipeOn                  => pipeOn,
135
                nxtSphere               => nxtSphere,
136
                iRayx                   => iRayx ((i+1)*W0-1 downto i*W0),
137
                iRayy                   => iRayy ((i+1)*W0-1 downto i*W0),
138
                iRayz                   => iRayz ((i+1)*W0-1 downto i*W0),
139
                iSphrCenterx    => sVx((i+1)*C*W0-1 downto i*C*W0),
140
                iSphrCentery    => sVy((i+1)*C*W0-1 downto i*C*W0),
141
                iSphrCenterz    => sVz((i+1)*C*W0-1 downto i*C*W0),
142
                oSphrCenterx    => sVx((i+2)*C*W0-1 downto (i+1)*C*W0),
143
                oSphrCentery    => sVy((i+2)*C*W0-1 downto (i+1)*C*W0),
144
                oSphrCenterz    => sVz((i+2)*C*W0-1 downto (i+1)*C*W0),
145
                oRayx                   => oRayx ((i+1)*W0-1 downto i*W0),
146
                oRayy                   => oRayy ((i+1)*W0-1 downto i*W0),
147
                oRayz                   => oRayz ((i+1)*W0-1 downto i*W0),
148
                kInput                  => sK((i+1)*C*W1-1 downto i*C*W1),
149
                kOutput                 => sK((i+2)*C*W1-1 downto (i+1)*C*W1),
150
                refvd                   => refvd((i+1)*W1-1 downto i*W1),
151
                selvd                   => selvd((i+1)*W1-1 downto i*W1),
152
                colid                   => colid((i+1)*IDW-1 downto i*IDW),
153
                inter                   => inter(i)
154
                );
155
        end generate;
156
 
157
end rtl;
158
 

powered by: WebSVN 2.1.0

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