1 |
32 |
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 file is an instantiation of a minimun distance comparers row. The number of dot cells used is parameterizable.
|
26 |
|
|
library ieee;
|
27 |
|
|
use ieee.std_logic_1164.all;
|
28 |
|
|
use work.powerGrid.all;
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
entity floor2Row is
|
32 |
|
|
generic (
|
33 |
|
|
viw : integer := 32; -- Vector input Width
|
34 |
|
|
idColW : integer := 2; -- ID Column width
|
35 |
|
|
col : integer := 4; -- Number of Colums
|
36 |
|
|
);
|
37 |
|
|
port (
|
38 |
|
|
-- Input Control Signal
|
39 |
|
|
-- Clk, Rst, the usual control signals.
|
40 |
|
|
clk, rst, pipeOn: in std_logic;
|
41 |
|
|
|
42 |
|
|
-- Input Values
|
43 |
|
|
refvd : in std_logic_vector (viw-1 downto 0);
|
44 |
|
|
selvd : out std_logic_vector (viw-1 downto 0);
|
45 |
|
|
colvd : in std_logic_vector (viw*col-1 downto 0);
|
46 |
|
|
colid : out std_logic_vector (idColW-1 downto 0);
|
47 |
33 |
jguarin200 |
inter : out std_logic
|
48 |
32 |
jguarin200 |
);
|
49 |
|
|
end entity;
|
50 |
|
|
|
51 |
|
|
architecture rtl of floor2Row is
|
52 |
|
|
|
53 |
|
|
signal srefvd : std_logic_vector ((col+1)*viw - 1 downto 0); -- The minimun vd difussion nets.
|
54 |
|
|
signal scolid : std_logic_vector ((col+1)*idColW-1 downto 0); -- The column id difussion nets.
|
55 |
|
|
signal sinter : std_logic_vector ((col+1) - 1 downto 0); -- The intersection on set, difussion net.
|
56 |
|
|
begin
|
57 |
|
|
|
58 |
33 |
jguarin200 |
-- External connections.
|
59 |
32 |
jguarin200 |
|
60 |
33 |
jguarin200 |
-- The first comparison has a not yet intersection signal.
|
61 |
|
|
sinter(0)<='0';
|
62 |
|
|
-- The first comparison has a refernce id of 0 (Always).
|
63 |
|
|
scolid(idColW-1 downto 0) <= (others=>'0');
|
64 |
|
|
-- The selected vd output.
|
65 |
32 |
jguarin200 |
selvd <= srefvd ((col+1)*viw - 1 downto col*viw);
|
66 |
33 |
jguarin200 |
-- The selected sphere column.
|
67 |
32 |
jguarin200 |
colid <= scolid ((col+1)*idColW-1 downto col*idColW);
|
68 |
33 |
jguarin200 |
-- The intersection / no intersection signal.
|
69 |
32 |
jguarin200 |
inter <= sinter(col);
|
70 |
|
|
|
71 |
|
|
-- Comparadores.
|
72 |
|
|
compStages : for i in 0 to col-1 generate
|
73 |
|
|
|
74 |
|
|
compCell : dComparisonCell
|
75 |
|
|
generic map ( W = viw, idColW = idColW, idCol=i )
|
76 |
|
|
port map (
|
77 |
|
|
|
78 |
|
|
clk => clk,
|
79 |
|
|
rst => rst,
|
80 |
|
|
ena => pipeOn,
|
81 |
|
|
intd => sinter(i),
|
82 |
|
|
intq => sinter(i+1),
|
83 |
|
|
cIdd => scolid((i+1)*idColW - 1 downto i*idColW),
|
84 |
|
|
cIdq => scolid((i+2)*idColW - 1 downto (i+1)*idColW),
|
85 |
|
|
refvd => srefvd((i+1)*viw - 1 downto i*viw),
|
86 |
|
|
colvd => colvd((i+1)*viw - 1 downto i*viw),
|
87 |
|
|
selvd => srefvd((i+2)*viw - 1 downto (i+1)*viw)
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
end generate;
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
end rtl;
|
94 |
|
|
|
95 |
|
|
|