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

Subversion Repositories jart

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

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

Rev 17 Rev 20
Line 27... Line 27...
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use work.powerGrid.all;
use work.powerGrid.all;
 
 
 
 
entity kComparisonCell is
entity kComparisonCell is
        generic (       W               : integer := 32;
        generic (       W               : integer := 32 );
                                idW             : integer := 12
 
                        );
 
        port (
        port (
                                clk                     : in std_logic;
                                clk,rst         : in std_logic;
                                rst                     : in std_logic;
 
 
 
                                nxtRow  : in std_logic; -- Controls when the sphere goes to the next Row. 
                                nxtSphere       : in std_logic; -- Controls when the sphere goes to the next Row. 
                                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.
                                vdinput         : in std_logic_vector (W-1 downto 0);    -- V.D input.
 
                                vdoutput        : 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 ssge32   : std_logic;    -- Greater or equal signed signal.
        signal ssge32   : std_logic;    -- Signed "Greater or equal  than" signal.
 
 
begin
begin
 
 
        -- Instantiation of the compare.
        comparison : sge32 port map (
        discriminantCompare : ge32 port map (
 
                dataa    => vdinput,
                dataa    => vdinput,
                datab    => kinput,
                datab    => kinput,
                AgeB     => ssge32
                AgeB     => ssge32
        );
        );
 
 
 
 
        -- 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.
        -- 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.
 
        selector : process (rst,clk,ssg32)
        intersectionSelector : for i in 0 to W-1 generate
 
 
 
                selector : process (rst,clk)
 
                begin
                begin
 
 
                        if rst='0' then
                        if rst='0' then
 
 
                                -- At the beginning set the Maximum over Maximum distance.
                                -- At the beginning set the Maximum over Maximum distance.
                                if i = W-1 then
                        vdoutput <= '0' & (others =>'1');
                                        sDP (i) <= '0';
 
                                else
 
                                        sDP (i) <= '1';
 
                                end if;
 
 
 
                        elsif rising_edge(clk) then
                        elsif rising_edge(clk) then
 
 
                                if i = W-1 then
                        if ssge32 = '1' then -- If VD ids grater or equal than K .....
                                        sDP (i) <= ssge32 and vdinput(i);
                                vdoutput <= vdinput;
                                else
                                else
                                        sDP (i) <= (ssge32 and vdinput(i)) or not(ssge32);
                                vdoutput <= '0' & (others =>'1');
                                end if;
                                end if;
 
 
                        end if;
                        end if;
 
 
                end process;
                end process;
 
 
        end generate;
        -- Behavioral : When nxtSphere is set, the Sphere and its K constant should go the the next row
 
 
        kPipeStage : process (clk,rst)
        kPipeStage : process (clk,rst,nxtSphere)
        begin
        begin
 
 
                if rst='0' then
                if rst='0' then
 
 
                        koutput <= (others => '0');
                        koutput <= (others => '0');
 
 
                elsif rising_edge(clk) and nxtRow='1' then
                elsif rising_edge(clk) and nxtSphere ='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.