1 |
27 |
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 |
25 |
jguarin200 |
|
5 |
27 |
jguarin200 |
-- 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 |
25 |
jguarin200 |
|
9 |
27 |
jguarin200 |
-- This file is part of JART (Just Another Ray Tracer).
|
10 |
25 |
jguarin200 |
|
11 |
27 |
jguarin200 |
-- 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 |
25 |
jguarin200 |
|
16 |
27 |
jguarin200 |
-- 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 |
25 |
jguarin200 |
|
21 |
27 |
jguarin200 |
-- 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 file is an instantiation of a dot cells row. The number of dot cells used is parameterizable.
|
26 |
25 |
jguarin200 |
library ieee;
|
27 |
|
|
use ieee.std_logic_1164.all;
|
28 |
|
|
use work.powerGrid.all;
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
entity floor0Row is
|
32 |
|
|
generic (
|
33 |
63 |
jguarin200 |
W1 : integer := 32; -- Next Level Width (V.D width)
|
34 |
|
|
W0 : integer := 18; -- Vector input Width
|
35 |
|
|
C : integer := 4 -- Number of Colums
|
36 |
25 |
jguarin200 |
);
|
37 |
|
|
port ( -- Input Control Signal
|
38 |
26 |
jguarin200 |
clk, rst, nxtRay : in std_logic;
|
39 |
25 |
jguarin200 |
-- Clk, Rst, the usual control signals.
|
40 |
|
|
-- enabled, the machine is running when this input is set.
|
41 |
|
|
-- enabled, all the counters begin again.
|
42 |
63 |
jguarin200 |
nxtSphere : in std_logic_vector (C-1 downto 0);
|
43 |
25 |
jguarin200 |
|
44 |
|
|
|
45 |
|
|
-- Input Values
|
46 |
63 |
jguarin200 |
iRayx: in std_logic_vector (W0 - 1 downto 0);
|
47 |
|
|
iRayy: in std_logic_vector (W0 - 1 downto 0);
|
48 |
|
|
iRayz: in std_logic_vector (W0 - 1 downto 0); -- The ray input vector.
|
49 |
|
|
iSphrCenterx: in std_logic_vector (C*W0 - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
50 |
|
|
iSphrCentery: in std_logic_vector (C*W0 - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
51 |
|
|
iSphrCenterz: in std_logic_vector (C*W0 - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
52 |
|
|
oSphrCenterx: out std_logic_vector (C*W0 - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
53 |
|
|
oSphrCentery: out std_logic_vector (C*W0 - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
54 |
|
|
oSphrCenterz: out std_logic_vector (C*W0 - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
55 |
25 |
jguarin200 |
|
56 |
|
|
-- Output Values
|
57 |
63 |
jguarin200 |
oRayx: out std_logic_vector (W0 - 1 downto 0);-- The ray output vector.
|
58 |
|
|
oRayy: out std_logic_vector (W0 - 1 downto 0);-- The ray output vector.
|
59 |
|
|
oRayz: out std_logic_vector (W0 - 1 downto 0);-- The ray output vector.
|
60 |
|
|
vdOutput : out std_logic_vector (W1*C - 1 downto 0) -- The dot product emerging from each dot prod cell.
|
61 |
25 |
jguarin200 |
);
|
62 |
|
|
end entity;
|
63 |
|
|
|
64 |
|
|
architecture rtl of floor0Row is
|
65 |
|
|
|
66 |
63 |
jguarin200 |
signal sRayx : std_logic_vector ((C+1)*W0 - 1 downto 0); -- The ray difussion nets.
|
67 |
|
|
signal sRayy : std_logic_vector ((C+1)*W0 - 1 downto 0); -- The ray difussion nets.
|
68 |
|
|
signal sRayz : std_logic_vector ((C+1)*W0 - 1 downto 0); -- The ray difussion nets.
|
69 |
25 |
jguarin200 |
|
70 |
|
|
begin
|
71 |
|
|
|
72 |
63 |
jguarin200 |
theCells : for i in 0 to C-1 generate
|
73 |
25 |
jguarin200 |
|
74 |
63 |
jguarin200 |
dotCellx : dotCell
|
75 |
|
|
generic map (
|
76 |
|
|
RV => "no"
|
77 |
|
|
)
|
78 |
|
|
port map (
|
79 |
25 |
jguarin200 |
|
80 |
|
|
clk => clk,
|
81 |
|
|
rst => rst,
|
82 |
26 |
jguarin200 |
nxtSphere => nxtSphere(i),
|
83 |
25 |
jguarin200 |
nxtRay => nxtRay,
|
84 |
63 |
jguarin200 |
vxInput => iSphrCenterx((i+1)*W0-1 downto i*W0),
|
85 |
|
|
vyInput => iSphrCentery((i+1)*W0-1 downto i*W0),
|
86 |
|
|
vzInput => iSphrCenterz((i+1)*W0-1 downto i*W0),
|
87 |
|
|
vxOutput => oSphrCenterx((i+1)*W0-1 downto i*W0),
|
88 |
|
|
vyOutput => oSphrCentery((i+1)*W0-1 downto i*W0),
|
89 |
|
|
vzOutput => oSphrCenterz((i+1)*W0-1 downto i*W0),
|
90 |
|
|
dxInput => sRayx ((i+1)*W0-1 downto i*W0),
|
91 |
|
|
dyInput => sRayy ((i+1)*W0-1 downto i*W0),
|
92 |
|
|
dzInput => sRayz ((i+1)*W0-1 downto i*W0),
|
93 |
|
|
dxOutput => sRayx ((i+2)*W0-1 downto (i+1)*W0),
|
94 |
|
|
dyOutput => sRayy ((i+2)*W0-1 downto (i+1)*W0),
|
95 |
|
|
dzOutput => sRayz ((i+2)*W0-1 downto (i+1)*W0),
|
96 |
|
|
vdOutput => vdOutput((i+1)*W1-1 downto i*W1)
|
97 |
25 |
jguarin200 |
);
|
98 |
|
|
|
99 |
|
|
end generate;
|
100 |
|
|
|
101 |
|
|
-- Connect the first and last rays.
|
102 |
63 |
jguarin200 |
sRayx (W0-1 downto 0) <= iRayx;
|
103 |
|
|
sRayy (W0-1 downto 0) <= iRayy;
|
104 |
|
|
sRayz (W0-1 downto 0) <= iRayz;
|
105 |
|
|
oRayx <= sRayx ((C+1)*W0 - 1 downto C*W0);
|
106 |
|
|
oRayy <= sRayy ((C+1)*W0 - 1 downto C*W0);
|
107 |
|
|
oRayz <= sRayz ((C+1)*W0 - 1 downto C*W0);
|
108 |
25 |
jguarin200 |
|
109 |
|
|
end rtl;
|
110 |
|
|
|
111 |
|
|
|