Line 30... |
Line 30... |
|
|
use work.powerGrid.all;
|
use work.powerGrid.all;
|
|
|
|
|
entity dComparisonCell is
|
entity dComparisonCell is
|
generic ( W : integer := 32; -- V.D, minDistance and selectD Width
|
generic ( W : integer := 32; -- operands Width ( reference V.D and column V.D)
|
idColW : integer := 2; -- Column Sphere ID width. 1 = 2 columns max, 2= 4 colums max... and so on.
|
idColW : integer := 2; -- Column Sphere ID width. 1 = 2 columns max, 2= 4 colums max... and so on.
|
idCol : integer := 0 -- Column Id
|
idCol : integer := 0 -- Column Id
|
);
|
);
|
|
|
|
|
Line 45... |
Line 45... |
cIdd : in std_logic_vector (idColW - 1 downto 0); -- This is the reference column identification input.
|
cIdd : in std_logic_vector (idColW - 1 downto 0); -- This is the reference column identification input.
|
cIdq : out std_logic_vector (idColW - 1 downto 0); -- This is the sphere identification output.
|
cIdq : out std_logic_vector (idColW - 1 downto 0); -- This is the sphere identification output.
|
refvd : in std_logic_vector (W - 1 downto 0); -- This is the projection incoming from the previous cell.
|
refvd : in std_logic_vector (W - 1 downto 0); -- This is the projection incoming from the previous cell.
|
colvd : in std_logic_vector (W - 1 downto 0); -- This is the projection of the sphere position over the ray traced vector, a.k.a. V.D! .
|
colvd : in std_logic_vector (W - 1 downto 0); -- This is the projection of the sphere position over the ray traced vector, a.k.a. V.D! .
|
selvd : out std_logic_vector (W - 1 downto 0) -- This is the smallest value between refvd and colvd.
|
selvd : out std_logic_vector (W - 1 downto 0) -- This is the smallest value between refvd and colvd.
|
)
|
);
|
end port;
|
|
|
|
|
|
|
|
end entity;
|
end entity;
|
|
|
|
|
architecture rtl of dComparisonCell is
|
architecture rtl of dComparisonCell is
|
|
|
signal ssl32 : std_logic; -- This signal indicates if refvd is less than colvd
|
signal ssl32 : std_logic; -- This signal indicates if refvd is less than colvd
|
|
|
|
|
begin
|
begin
|
|
|
-- A less than B comparison, check if colvd is less than refvd, meaning the act V.D less than actual max V.D
|
-- A less than B comparison, check if colvd is less than refvd, meaning the act V.D less than actual min V.D
|
cl32 : sl32 port map ( dataa => colvd,
|
cl32 : sl32 port map ( dataa => colvd,
|
datab => refvd,
|
datab => refvd,
|
AlB => sl32
|
AlB => ssl32
|
);
|
);
|
|
|
-- A flip flop with 2 to 1 mux.
|
-- A flip flop with 2 to 1 mux.
|
selector : scanFF generic map ( W = 32 )
|
selectorVD : scanFF generic map ( W = W )
|
port map ( clk => clk,
|
port map ( clk => clk,
|
rst => rst,
|
rst => rst,
|
scLoad => ssl32,
|
scLoad => ssl32,
|
extData => colvd,
|
extData => colvd,
|
dStage => refvd,
|
dStage => refvd,
|
qStage => selvd);
|
qStage => selvd);
|
|
-- Another flip flip with 2 to 1 mux.
|
|
selectorID : scanFF generic map ( W = idColW )
|
colIdSelector : process (clk,rst)
|
port map ( clk => clk,
|
begin
|
rst => rst,
|
|
scLoad => ssl32,
|
if rst = '0' then
|
extData => CONV_STD_LOGIC(idCol,idColW),
|
|
dStage => cIdd,
|
--Set max Distance on reset and column identifier
|
qStage => cIdq
|
cIdq <= CONV_STD_LOGIC_VECTOR(idCol,idColW);
|
);
|
selvd(W-1) <= '0';
|
|
selvd(W-2 downto 0) <= (others => '1');
|
|
|
|
elsif rising_edge(clk) then
|
|
|
|
if ssl32 ='0' then
|
|
|
|
-- If reference V.D. is less than column V.D then shift the reference id.
|
|
cIdq <= cIdd;
|
|
|
|
else
|
|
|
|
--If column V.D. is less than
|
|
cIdq <= CONV_STD_LOGIC(idCol,idColW);
|
|
|
|
end if;
|
|
|
|
|
|
end process;
|
|
|
|
|
|
|
|
|
|
end rtl;
|
end rtl;
|
No newline at end of file
|
No newline at end of file
|