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

Subversion Repositories jart

[/] [jart/] [trunk/] [BLRT/] [kComparisonCell.vhd] - Blame information for rev 28

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 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
-- This is a discriminant proof cell.   
25
 
26 14 jguarin200
library ieee;
27
use ieee.std_logic_1164.all;
28
use work.powerGrid.all;
29
 
30
 
31
entity kComparisonCell is
32 20 jguarin200
        generic (       W               : integer := 32 );
33 14 jguarin200
        port (
34 20 jguarin200
                                clk,rst         : in std_logic;
35 14 jguarin200
 
36 20 jguarin200
                                nxtSphere       : in std_logic; -- Controls when the sphere goes to the next Row. 
37 28 jguarin200
                                pipeOn          : in std_logic; -- Enables / Disable the upwarding flow.
38 20 jguarin200
                                kinput          : in std_logic_vector (W-1 downto 0);
39
                                koutput         : out std_logic_vector (W-1 downto 0);
40 14 jguarin200
 
41 20 jguarin200
                                vdinput         : in std_logic_vector (W-1 downto 0);    -- V.D input.
42
                                vdoutput        : out std_logic_vector (W-1 downto 0)    -- Selected dot product.
43 14 jguarin200
 
44
 
45
        );
46
        end port;
47
end entity;
48
 
49
 
50
architecture rtl of kComparisonCell is
51
 
52 20 jguarin200
        signal ssge32   : std_logic;    -- Signed "Greater or equal  than" signal.
53 14 jguarin200
 
54
begin
55
 
56 20 jguarin200
        comparison : sge32 port map (
57
                dataa   => vdinput,
58
                datab   => kinput,
59
                AgeB    => ssge32
60
                );
61 14 jguarin200
 
62 17 jguarin200
        -- 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.
63 28 jguarin200
        selector : process (rst,clk,ssg32,pipeOn)
64 20 jguarin200
        begin
65 14 jguarin200
 
66 20 jguarin200
                if rst='0' then
67 14 jguarin200
 
68 20 jguarin200
                        -- At the beginning set the Maximum over Maximum distance.
69
                        vdoutput <= '0' & (others =>'1');
70 14 jguarin200
 
71 28 jguarin200
                elsif rising_edge(clk) and pipeOn ='1' then
72 14 jguarin200
 
73 20 jguarin200
                        if ssge32 = '1' then -- If VD ids grater or equal than K .....
74
                                vdoutput <= vdinput;
75
                        else
76
                                vdoutput <= '0' & (others =>'1');
77
                        end if;
78 14 jguarin200
 
79 20 jguarin200
                end if;
80 14 jguarin200
 
81 20 jguarin200
        end process;
82 14 jguarin200
 
83 20 jguarin200
        -- Behavioral : When nxtSphere is set, the Sphere and its K constant should go the the next row
84 14 jguarin200
 
85 20 jguarin200
        kPipeStage : process (clk,rst,nxtSphere)
86 14 jguarin200
        begin
87
 
88
                if rst='0' then
89
 
90
                        koutput <= (others => '0');
91
 
92 20 jguarin200
                elsif rising_edge(clk) and nxtSphere ='1' then
93
 
94 14 jguarin200
                        koutput <= kinput;
95 17 jguarin200
 
96 14 jguarin200
                end if;
97
 
98
        end process;
99
 
100
 
101
 
102
end rtl;
103
 
104
 
105
 
106
 
107
 

powered by: WebSVN 2.1.0

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