OpenCores
URL https://opencores.org/ocsvn/jart/jart/trunk

Subversion Repositories jart

[/] [jart/] [trunk/] [BLRT/] [kComparisonCell.vhd] - Diff between revs 14 and 17

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 17
Line 1... Line 1...
 
-- Author : Julian Andres Guarin Reyes.
 
-- Project : JART, Just Another Ray Tracer.
 
-- email : jguarin2002 at gmail.com, j.guarin at javeriana.edu.co
 
 
 
-- This code was entirely written by Julian Andres Guarin Reyes.
 
-- The following code is licensed under GNU Public License
 
-- http://www.gnu.org/licenses/gpl-3.0.txt.
 
 
 
 -- 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
 
    -- it under the terms of the GNU General Public License as published by
 
    -- the Free Software Foundation, either version 3 of the License, or
 
    -- (at your option) any later version.
 
 
 
    -- 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
 
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
    -- GNU General Public License for more details.
 
 
 
    -- 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/>.
 
 
 
-- This is a discriminant proof cell.   
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use work.powerGrid.all;
use work.powerGrid.all;
 
 
 
 
Line 9... Line 34...
                        );
                        );
        port (
        port (
                                clk             : in std_logic;
                                clk             : in std_logic;
                                rst             : in std_logic;
                                rst             : in std_logic;
 
 
 
                                nxtRow  : in std_logic; -- Controls when the sphere goes to the next Row. 
                                vdinput : in std_logic_vector (W-1 downto 0);
                                vdinput : in std_logic_vector (W-1 downto 0);
                                kinput  : in std_logic_vector (W-1 downto 0);
                                kinput  : in std_logic_vector (W-1 downto 0);
                                koutput : out std_logic_vector (W-1 downto 0);
                                koutput : out std_logic_vector (W-1 downto 0);
 
 
                                sDP             : out std_logic_vector (W-1 downto 0); -- Selected dot product.
                                sDP                     : out std_logic_vector (W-1 downto 0) -- Selected dot product.
 
 
 
 
        );
        );
        end port;
        end port;
end entity;
end entity;
 
 
 
 
architecture rtl of kComparisonCell is
architecture rtl of kComparisonCell is
 
 
        signal sge32    : std_logic;    -- Greater or equal signal
        signal ssge32   : std_logic;    -- Greater or equal signed signal.
 
 
begin
begin
 
 
        -- Instantiation of the compare.
        -- Instantiation of the compare.
        discriminantCompare : ge32 port map (
        discriminantCompare : ge32 port map (
                dataa    => vdinput,
                dataa    => vdinput,
                datab    => kinput,
                datab    => kinput,
                AgeB     => sge32
                AgeB     => ssge32
        );
        );
 
 
 
 
        -- When sge32 (greater or equal signal) is set then V.D > kte, thus intersection is confirmed and shifting V.D to the distance comparison grid.
        -- When ssge32 (greater or equal signal) is set then V.D > kte, therefore intersection is confirmed and  V.D is to be shifted to the distance comparison grid.
 
 
        intersectionSelector : for i in 0 to W-1 generate
        intersectionSelector : for i in 0 to W-1 generate
 
 
                selector : process (rst,clk)
                selector : process (rst,clk)
                begin
                begin
Line 55... Line 80...
                                end if;
                                end if;
 
 
                        elsif rising_edge(clk) then
                        elsif rising_edge(clk) then
 
 
                                if i = W-1 then
                                if i = W-1 then
                                        sDP (i) <= sge32 and vdinput(i);
                                        sDP (i) <= ssge32 and vdinput(i);
                                else
                                else
                                        sDP (i) <= (sge32 and vdinput(i)) or not(sge32);
                                        sDP (i) <= (ssge32 and vdinput(i)) or not(ssge32);
                                end if;
                                end if;
 
 
                        end if;
                        end if;
 
 
                end process;
                end process;
Line 73... Line 98...
 
 
                if rst='0' then
                if rst='0' then
 
 
                        koutput <= (others => '0');
                        koutput <= (others => '0');
 
 
                elsif rising_edge(clk) then
                elsif rising_edge(clk) and nxtRow='1' then
 
 
                        koutput <= kinput;
                        koutput <= kinput;
 
 
 
                else -- Avoid Latch Inference
 
 
 
                        koutput <= koutput;
 
 
                end if;
                end if;
 
 
        end process;
        end process;
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.