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

Subversion Repositories jart

[/] [jart/] [branches/] [ver0branch/] [kComparisonCell.vhd] - Blame information for rev 64

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 37 jguarin200
        generic (
33
                        RK      : string        := "yes";
34
                        W1      : integer       := 32
35
        );
36 14 jguarin200
        port (
37 37 jguarin200
                        clk,rst         : in std_logic;
38
                        scanOut         : in std_logic; -- This signals overrides the 'signed greater or equal than' internal function and allows vdinput to flow upwards.
39
                        nxtSphere       : in std_logic; -- Controls when the sphere goes to the next Row. 
40
                        pipeOn          : in std_logic; -- Enables / Disable the upwarding flow.
41
                        kinput          : in std_logic_vector (W1-1 downto 0);
42
                        koutputhor      : out std_logic_vector (W1-1 downto 0);
43
                        koutputver      : out std_logic_vector (W1-1 downto 0);  -- K input  flowing to the next floor upstairs (but waits one clock). 
44
                        vdinput         : in std_logic_vector (W1-1 downto 0);   -- V.D input.
45
                        vdoutput        : out std_logic_vector (W1-1 downto 0)   -- Selected dot product.
46 14 jguarin200
 
47
 
48
        );
49 37 jguarin200
 
50 14 jguarin200
end entity;
51
 
52
 
53
architecture rtl of kComparisonCell is
54
 
55 20 jguarin200
        signal ssge32   : std_logic;    -- Signed "Greater or equal  than" signal.
56 37 jguarin200
        signal sena             : std_logic;    -- Enable internal signal
57
        signal disc             : std_logic;
58 14 jguarin200
begin
59
 
60 37 jguarin200
        -- Enable resolution
61
        sena <= pipeOn or scanOut;
62
        disc <= ssge32 or scanOut;
63
 
64
        -- Enable
65
        kcomp : sge32
66
        port map (
67 20 jguarin200
                dataa   => vdinput,
68
                datab   => kinput,
69
                AgeB    => ssge32
70 37 jguarin200
        );
71
 
72
 
73
 
74 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.
75 37 jguarin200
        selector : process (rst,clk,sena)
76 20 jguarin200
        begin
77 14 jguarin200
 
78 20 jguarin200
                if rst='0' then
79 14 jguarin200
 
80 20 jguarin200
                        -- At the beginning set the Maximum over Maximum distance.
81 37 jguarin200
                        vdoutput (W1-1)<= '0';
82
                        vdoutput (W1-2 downto 0) <= (others => '1');
83
                        koutputver <= (others => '0');
84 14 jguarin200
 
85 37 jguarin200
                elsif rising_edge(clk) and sena='1' then
86
 
87
                        -- Flowing Upwards of vinput.
88
                        koutputver <= kinput;
89 14 jguarin200
 
90 37 jguarin200
                        if  disc='1' then -- If VD ids grater or equal than K .....
91 20 jguarin200
                                vdoutput <= vdinput;
92
                        else
93 37 jguarin200
                                vdoutput(W1-1) <= '0';
94
                                vdoutput(W1-2 downto 0)<=( others => '1' );
95 20 jguarin200
                        end if;
96 14 jguarin200
 
97 20 jguarin200
                end if;
98 14 jguarin200
 
99 20 jguarin200
        end process;
100 37 jguarin200
 
101
 
102
 
103
 
104 20 jguarin200
        -- Behavioral : When nxtSphere is set, the Sphere and its K constant should go the the next row
105 37 jguarin200
        kHorizontalPipeStage : if RK = "yes" generate
106 14 jguarin200
 
107 37 jguarin200
                process (clk,rst,nxtSphere)
108
                begin
109 14 jguarin200
 
110 37 jguarin200
                        if rst='0' then
111 20 jguarin200
 
112 37 jguarin200
                                koutputhor <= (others => '0');
113 17 jguarin200
 
114 37 jguarin200
                        elsif rising_edge(clk) and nxtSphere ='1' then
115
 
116
                                koutputhor <= kinput;
117
 
118
                        end if;
119
 
120
                end process;
121 14 jguarin200
 
122 37 jguarin200
        end generate kHorizontalPipeStage;
123 14 jguarin200
 
124
 
125
end rtl;
126
 
127
 
128
 
129
 
130
 

powered by: WebSVN 2.1.0

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