-- Author : Julian Andres Guarin Reyes.
|
-- Author : Julian Andres Guarin Reyes.
|
-- Project : JART, Just Another Ray Tracer.
|
-- Project : JART, Just Another Ray Tracer.
|
-- email : jguarin2002 at gmail.com, j.guarin at javeriana.edu.co
|
-- email : jguarin2002 at gmail.com, j.guarin at javeriana.edu.co
|
|
|
-- This code was entirely written by Julian Andres Guarin Reyes.
|
-- This code was entirely written by Julian Andres Guarin Reyes.
|
-- The following code is licensed under GNU Public License
|
-- The following code is licensed under GNU Public License
|
-- http://www.gnu.org/licenses/gpl-3.0.txt.
|
-- http://www.gnu.org/licenses/gpl-3.0.txt.
|
|
|
-- This file is part of JART (Just Another Ray Tracer).
|
-- This file is part of JART (Just Another Ray Tracer).
|
|
|
-- JART (Just Another Ray Tracer) is free software: you can redistribute it and/or modify
|
-- JART (Just Another Ray Tracer) is free software: you can redistribute it and/or modify
|
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
-- the Free Software Foundation, either version 3 of the License, or
|
-- the Free Software Foundation, either version 3 of the License, or
|
-- (at your option) any later version.
|
-- (at your option) any later version.
|
|
|
-- JART (Just Another Ray Tracer) is distributed in the hope that it will be useful,
|
-- JART (Just Another Ray Tracer) is distributed in the hope that it will be useful,
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
-- GNU General Public License for more details.
|
-- GNU General Public License for more details.
|
|
|
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
-- along with JART (Just Another Ray Tracer). If not, see <http://www.gnu.org/licenses/>.
|
-- along with JART (Just Another Ray Tracer). If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use work.powerGrid.all;
|
use work.powerGrid.all;
|
|
|
|
|
entity rayxsphereGrid is
|
entity rayxsphereGrid is
|
generic (
|
generic (
|
-- Width of Column identificator.
|
-- Width of Column identificator.
|
IDW : integer := 2;
|
IDW : integer := 2;
|
-- Number of Columns.
|
-- Number of Columns.
|
C : integer := 4;
|
C : integer := 4;
|
-- Input rays width.
|
-- Input rays width.
|
W0 : integer := 18;
|
W0 : integer := 18;
|
-- Dot products and spheres constant width
|
-- Dot products and spheres constant width
|
W1 : integer := 32;
|
W1 : integer := 32;
|
|
|
);
|
);
|
port (
|
port (
|
-- The usual control signals.
|
-- The usual control signals.
|
clk,rst : in std_logic;
|
clk,rst : in std_logic;
|
|
|
-- Grid, rays and sphere flow through control signals.
|
-- Grid, rays and sphere flow through control signals.
|
pipeOn : in std_logic;
|
pipeOn : in std_logic;
|
nxtSphere : in std_logic_vector (C-1 downto 0);
|
nxtSphere : in std_logic_vector (C-1 downto 0);
|
|
|
-- R-F0
|
-- R-F0
|
-- Input Values.
|
-- Input Values.
|
-- The ray input vector.
|
-- The ray input vector.
|
iRayx: in std_logic_vector (W0 - 1 downto 0);
|
iRayx: in std_logic_vector (W0 - 1 downto 0);
|
iRayy: in std_logic_vector (W0 - 1 downto 0);
|
iRayy: in std_logic_vector (W0 - 1 downto 0);
|
iRayz: in std_logic_vector (W0 - 1 downto 0);
|
iRayz: in std_logic_vector (W0 - 1 downto 0);
|
-- The spheres x position (sphere centers) input vectors.
|
-- The spheres x position (sphere centers) input vectors.
|
iSphrCenterx: in std_logic_vector (C*W0 - 1 downto 0);
|
iSphrCenterx: in std_logic_vector (C*W0 - 1 downto 0);
|
-- The spheres y position (sphere centers) input vectors.
|
-- The spheres y position (sphere centers) input vectors.
|
iSphrCentery: in std_logic_vector (C*W0 - 1 downto 0);
|
iSphrCentery: in std_logic_vector (C*W0 - 1 downto 0);
|
-- The spheres z position (sphere centers) input vectors.
|
-- The spheres z position (sphere centers) input vectors.
|
iSphrCenterz: in std_logic_vector (C*W0 - 1 downto 0);
|
iSphrCenterz: in std_logic_vector (C*W0 - 1 downto 0);
|
-- The spheres x position (sphere centers) output vectors.
|
-- The spheres x position (sphere centers) output vectors.
|
oSphrCenterx: out std_logic_vector (C*W0 - 1 downto 0);
|
oSphrCenterx: out std_logic_vector (C*W0 - 1 downto 0);
|
-- The spheres y positions (sphere centes) output vectors.
|
-- The spheres y positions (sphere centes) output vectors.
|
oSphrCentery: out std_logic_vector (C*W0 - 1 downto 0);
|
oSphrCentery: out std_logic_vector (C*W0 - 1 downto 0);
|
-- The spheres z positions (sphere centers) output vectors.
|
-- The spheres z positions (sphere centers) output vectors.
|
oSphrCenterz: out std_logic_vector (C*W0 - 1 downto 0);
|
oSphrCenterz: out std_logic_vector (C*W0 - 1 downto 0);
|
-- Output Values
|
-- Output Values
|
-- The ray output vector.
|
-- The ray output vector.
|
oRayx: out std_logic_vector (W0 - 1 downto 0);
|
oRayx: out std_logic_vector (W0 - 1 downto 0);
|
oRayy: out std_logic_vector (W0 - 1 downto 0);
|
oRayy: out std_logic_vector (W0 - 1 downto 0);
|
oRayz: out std_logic_vector (W0 - 1 downto 0);
|
oRayz: out std_logic_vector (W0 - 1 downto 0);
|
|
|
-- R-F1
|
-- R-F1
|
-- K Input / Output.
|
-- K Input / Output.
|
kInput : in std_logic_vector (C*W1 - 1 downto 0);
|
kInput : in std_logic_vector (C*W1 - 1 downto 0);
|
kOutput : out std_logic_vector (C*W1 - 1 downto 0)
|
kOutput : out std_logic_vector (C*W1 - 1 downto 0)
|
|
|
--R-F2
|
--R-F2
|
-- Input Values
|
-- Input Values
|
refvd : in std_logic_vector (W1-1 downto 0);
|
refvd : in std_logic_vector (W1-1 downto 0);
|
selvd : out std_logic_vector (W1-1 downto 0);
|
selvd : out std_logic_vector (W1-1 downto 0);
|
colid : out std_logic_vector (IDW-1 downto 0);
|
colid : out std_logic_vector (IDW-1 downto 0);
|
inter : out std_logic
|
inter : out std_logic
|
);
|
);
|
end entity;
|
end entity;
|
|
|
architecture rtl of rayxsphereGrid is
|
architecture rtl of rayxsphereGrid is
|
|
|
-- Signal to connect outgoing floor0 vd and ingoing floor1 vd.
|
-- Signal to connect outgoing floor0 vd and ingoing floor1 vd.
|
signal svdf0f1 : std_logic_vector (C*W1-1 downto 0);
|
signal svdf0f1 : std_logic_vector (C*W1-1 downto 0);
|
signal svdf1f2 : std_logic_vector (C*W1-1 downto 0);
|
signal svdf1f2 : std_logic_vector (C*W1-1 downto 0);
|
begin
|
begin
|
RF0 : floor0Row
|
RF0 : floor0Row
|
generic map(
|
generic map(
|
nlw=W1,
|
nlw=W1,
|
viw=W0,
|
viw=W0,
|
col=C );
|
col=C );
|
port map(
|
port map(
|
clk => clk,
|
clk => clk,
|
rst => rst,
|
rst => rst,
|
nxtRay => pipeOn,
|
nxtRay => pipeOn,
|
nxtSphere => nxtSphere,
|
nxtSphere => nxtSphere,
|
iRayx => iRayx,
|
iRayx => iRayx,
|
iRayy => iRayy,
|
iRayy => iRayy,
|
iRayz => iRayz,
|
iRayz => iRayz,
|
iSphrCenterx => iSphrCenterx,
|
iSphrCenterx => iSphrCenterx,
|
iSphrCentery => iSphrCentery,
|
iSphrCentery => iSphrCentery,
|
iSphrCenterz => iSphrCenterz,
|
iSphrCenterz => iSphrCenterz,
|
oSphrCenterx => oSphrCenterx,
|
oSphrCenterx => oSphrCenterx,
|
oSphrCentery => oSphrCentery,
|
oSphrCentery => oSphrCentery,
|
oSphrCenterz => oSphrCenterz,
|
oSphrCenterz => oSphrCenterz,
|
oRayx => oRayx,
|
oRayx => oRayx,
|
oRayy => oRayy,
|
oRayy => oRayy,
|
oRayz => oRayz,
|
oRayz => oRayz,
|
vdOutput => svdf0f1
|
vdOutput => svdf0f1
|
);
|
);
|
RF1 : floor1Row
|
RF1 : floor1Row
|
generic map (
|
generic map (
|
viw = W1,
|
viw = W1,
|
col = C );
|
col = C );
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
rst => rst,
|
rst => rst,
|
pipeOn => pipeOn,
|
pipeOn => pipeOn,
|
nxtSphere => nxtSphere,
|
nxtSphere => nxtSphere,
|
vdInput => svdf0f1,
|
vdInput => svdf0f1,
|
vdOutput => svdf1f2,
|
vdOutput => svdf1f2,
|
kInput => kInput,
|
kInput => kInput,
|
kOutput => kOutput
|
kOutput => kOutput
|
);
|
);
|
RF2 : floor2Row
|
RF2 : floor2Row
|
generic map (
|
generic map (
|
viw = W1,
|
viw = W1,
|
idColW = IDW,
|
idColW = IDW,
|
col = C );
|
col = C );
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
rst => rst,
|
rst => rst,
|
pipeOn => pipeOn,
|
pipeOn => pipeOn,
|
refvd => refvd,
|
refvd => refvd,
|
selvd => selvd,
|
selvd => selvd,
|
colvd => svdf1f2,
|
colvd => svdf1f2,
|
colid => colid,
|
colid => colid,
|
inter => inter
|
inter => inter
|
);
|
);
|
|
|
|
|