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 |
|
|
nlw : integer := 32; -- Next Level Width (V.D width)
|
34 |
|
|
viw : integer := 18; -- Vector input Width
|
35 |
|
|
col : integer := 4; -- Number of Colums
|
36 |
|
|
);
|
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 |
26 |
jguarin200 |
nxtSphere : in std_logic_vector (col-1 downto 0);
|
43 |
25 |
jguarin200 |
|
44 |
|
|
|
45 |
|
|
-- Input Values
|
46 |
|
|
iRayx: in std_logic_vector (viw - 1 downto 0);
|
47 |
|
|
iRayy: in std_logic_vector (viw - 1 downto 0);
|
48 |
|
|
iRayz: in std_logic_vector (viw - 1 downto 0); -- The ray input vector.
|
49 |
|
|
iSphrCenterx: in std_logic_vector (col*viw - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
50 |
|
|
iSphrCentery: in std_logic_vector (col*viw - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
51 |
|
|
iSphrCenterz: in std_logic_vector (col*viw - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
52 |
|
|
oSphrCenterx: out std_logic_vector (col*viw - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
53 |
|
|
oSphrCentery: out std_logic_vector (col*viw - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
54 |
|
|
oSphrCenterz: out std_logic_vector (col*viw - 1 downto 0); -- The spheres positions (sphere centers) input vectors.
|
55 |
|
|
|
56 |
|
|
-- Output Values
|
57 |
|
|
oRayx: out std_logic_vector (viw - 1 downto 0);-- The ray output vector.
|
58 |
|
|
oRayy: out std_logic_vector (viw - 1 downto 0);-- The ray output vector.
|
59 |
|
|
oRayz: out std_logic_vector (viw - 1 downto 0);-- The ray output vector.
|
60 |
|
|
vdOutput : out std_logic_vector (nlw*col - 1 downto 0) -- The dot product emerging from each dot prod cell.
|
61 |
|
|
);
|
62 |
|
|
end entity;
|
63 |
|
|
|
64 |
|
|
architecture rtl of floor0Row is
|
65 |
|
|
|
66 |
|
|
signal sRayx : std_logic_vector ((col+1)*viw - 1 downto 0); -- The ray difussion nets.
|
67 |
|
|
signal sRayy : std_logic_vector ((col+1)*viw - 1 downto 0); -- The ray difussion nets.
|
68 |
|
|
signal sRayz : std_logic_vector ((col+1)*viw - 1 downto 0); -- The ray difussion nets.
|
69 |
|
|
|
70 |
|
|
begin
|
71 |
|
|
|
72 |
|
|
theCells : for i in 0 to col-1 generate
|
73 |
|
|
|
74 |
|
|
dotCellx : dotCell port map (
|
75 |
|
|
|
76 |
|
|
clk => clk,
|
77 |
|
|
rst => rst,
|
78 |
26 |
jguarin200 |
nxtSphere => nxtSphere(i),
|
79 |
25 |
jguarin200 |
nxtRay => nxtRay,
|
80 |
|
|
vxInput => iSphrCenterx((i+1)*viw-1 downto i*viw),
|
81 |
|
|
vyInput => iSphrCentery((i+1)*viw-1 downto i*viw),
|
82 |
|
|
vzInput => iSphrCenterz((i+1)*viw-1 downto i*viw),
|
83 |
|
|
vxOutput => oSphrCenterx((i+1)*viw-1 downto i*viw),
|
84 |
|
|
vyOutput => oSphrCentery((i+1)*viw-1 downto i*viw),
|
85 |
|
|
vzOutput => oSphrCenterz((i+1)*viw-1 downto i*viw),
|
86 |
|
|
dxInput => sRayx ((i+1)*viw-1 downto i*viw),
|
87 |
|
|
dyInput => sRayx ((i+1)*viw-1 downto i*viw),
|
88 |
|
|
dzInput => sRayx ((i+1)*viw-1 downto i*viw),
|
89 |
|
|
dxOutput => sRayx ((i+2)*viw-1 downto (i+1)*viw),
|
90 |
|
|
dyOutput => sRayx ((i+2)*viw-1 downto (i+1)*viw),
|
91 |
|
|
dzOutput => sRayx ((i+2)*viw-1 downto (i+1)*viw),
|
92 |
|
|
vdOutput => vdOutput((i+1)*view-1 downto i*viw)
|
93 |
|
|
);
|
94 |
|
|
|
95 |
|
|
end generate;
|
96 |
|
|
|
97 |
|
|
-- Connect the first and last rays.
|
98 |
|
|
sRayx (viw-1 downto 0) <= iRayx;
|
99 |
|
|
sRayy (viw-1 downto 0) <= iRayy;
|
100 |
|
|
sRayz (viw-1 downto 0) <= iRayz;
|
101 |
|
|
oRayx <= sRayx ((col+1)*viw - 1 downto col*viw);
|
102 |
|
|
oRayy <= sRayy ((col+1)*viw - 1 downto col*viw);
|
103 |
|
|
oRayz <= sRayz ((col+1)*viw - 1 downto col*viw);
|
104 |
|
|
|
105 |
|
|
end rtl;
|
106 |
|
|
|
107 |
|
|
|