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

Subversion Repositories jart

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

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
                                kinput          : in std_logic_vector (W-1 downto 0);
38
                                koutput         : out std_logic_vector (W-1 downto 0);
39 14 jguarin200
 
40 20 jguarin200
                                vdinput         : in std_logic_vector (W-1 downto 0);    -- V.D input.
41
                                vdoutput        : out std_logic_vector (W-1 downto 0)    -- Selected dot product.
42 14 jguarin200
 
43
 
44
        );
45
        end port;
46
end entity;
47
 
48
 
49
architecture rtl of kComparisonCell is
50
 
51 20 jguarin200
        signal ssge32   : std_logic;    -- Signed "Greater or equal  than" signal.
52 14 jguarin200
 
53
begin
54
 
55 20 jguarin200
        comparison : sge32 port map (
56
                dataa   => vdinput,
57
                datab   => kinput,
58
                AgeB    => ssge32
59
                );
60 14 jguarin200
 
61 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.
62 20 jguarin200
        selector : process (rst,clk,ssg32)
63
        begin
64 14 jguarin200
 
65 20 jguarin200
                if rst='0' then
66 14 jguarin200
 
67 20 jguarin200
                        -- At the beginning set the Maximum over Maximum distance.
68
                        vdoutput <= '0' & (others =>'1');
69 14 jguarin200
 
70 20 jguarin200
                elsif rising_edge(clk) then
71 14 jguarin200
 
72 20 jguarin200
                        if ssge32 = '1' then -- If VD ids grater or equal than K .....
73
                                vdoutput <= vdinput;
74
                        else
75
                                vdoutput <= '0' & (others =>'1');
76
                        end if;
77 14 jguarin200
 
78 20 jguarin200
                end if;
79 14 jguarin200
 
80 20 jguarin200
        end process;
81 14 jguarin200
 
82 20 jguarin200
        -- Behavioral : When nxtSphere is set, the Sphere and its K constant should go the the next row
83 14 jguarin200
 
84 20 jguarin200
        kPipeStage : process (clk,rst,nxtSphere)
85 14 jguarin200
        begin
86
 
87
                if rst='0' then
88
 
89
                        koutput <= (others => '0');
90
 
91 20 jguarin200
                elsif rising_edge(clk) and nxtSphere ='1' then
92
 
93 14 jguarin200
                        koutput <= kinput;
94 17 jguarin200
 
95 14 jguarin200
                end if;
96
 
97
        end process;
98
 
99
 
100
 
101
end rtl;
102
 
103
 
104
 
105
 
106
 

powered by: WebSVN 2.1.0

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