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

Subversion Repositories jart

[/] [jart/] [trunk/] [BLRT/] [dComparisonCell.vhd] - Blame information for rev 32

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
-- A single fixed minimun distance comparison cell.
25 14 jguarin200
library ieee;
26
 
27
use ieee.std_logic_1164.all;
28
use ieee.std_logic_arith.all;
29
use ieee.std_logic_unsigned.all;
30
 
31
use work.powerGrid.all;
32
 
33
 
34
entity dComparisonCell is
35 21 jguarin200
        generic (       W               : integer := 32;        -- operands Width ( reference V.D and column V.D) 
36 14 jguarin200
                                idColW  : integer := 2;         -- Column Sphere ID width. 1 = 2 columns max, 2= 4 colums max... and so on.
37 21 jguarin200
                                idCol   : integer := 0           -- Column Id
38 14 jguarin200
        );
39
 
40
 
41
        port    (
42 32 jguarin200
                                clk, rst, ena   : in std_logic;
43 14 jguarin200
 
44 32 jguarin200
                                intd : in std_logic; -- Reference intersection signal.
45
                                intq : out std_logic;
46
 
47 14 jguarin200
                                cIdd    : in    std_logic_vector (idColW - 1 downto 0);  -- This is the reference column identification input.
48
                                cIdq    : out   std_logic_vector (idColW - 1 downto 0);  -- This is the sphere identification output.
49
                                refvd   : in    std_logic_vector (W - 1 downto 0);               -- This is the projection incoming from the previous cell.
50
                                colvd   : in    std_logic_vector (W - 1 downto 0);               -- This is the projection of the sphere position over the ray traced vector, a.k.a. V.D! .
51
                                selvd   : out   std_logic_vector (W - 1 downto 0)                -- This is the smallest value between refvd and colvd.
52 21 jguarin200
        );
53 14 jguarin200
 
54
end entity;
55
 
56
 
57
architecture rtl of dComparisonCell is
58
 
59 21 jguarin200
        signal          ssl32 : std_logic;      -- This signal indicates if refvd is less than colvd
60 32 jguarin200
        signal          qdist : std_logic_vector (idColW downto 0);
61 21 jguarin200
 
62 14 jguarin200
begin
63
 
64 21 jguarin200
        -- A less than B comparison, check if colvd is less than refvd, meaning the act V.D less than actual min V.D
65 17 jguarin200
        cl32                    : sl32  port map (      dataa   => colvd,
66 14 jguarin200
                                                                                datab   => refvd,
67 21 jguarin200
                                                                                AlB             => ssl32
68 14 jguarin200
                                                                                );
69
 
70 32 jguarin200
        -- A flip flop with 2 to 1 mux.Selects between the smallest vd.
71 21 jguarin200
        selectorVD              : scanFF        generic map (   W = W   )
72 32 jguarin200
                                                                port map        (       clk     => clk,
73
                                                                                                rst => rst,
74
                                                                                                ena     => ena,
75
                                                                                                sel => ssl32,
76
                                                                                                d0      => refvd,
77
                                                                                                d1      => colvd,
78
                                                                                                q       => selvd
79
                                                                                        );
80
        -- Another flip flip with 2 to 1 mux. Selects the id and intersection signal of the smallest vd.
81
        selectorID              : scanFF        generic map     (       W = idColW+1 )
82
                                                                port map        (       clk => clk,
83
                                                                                                rst     => rst,
84
                                                                                                ena     => ena
85
                                                                                                sel     => ssl32,
86
                                                                                                d0      => cIdd&intd,
87
                                                                                                d1      => conv_std_logic_vector(idCol,idColW)&ssl32,
88
                                                                                                q       => qdist;
89 21 jguarin200
                                                                                                );
90 32 jguarin200
 
91
        cIdq <= qdist(idColw downto 1);
92
        intq <= qdist(0);
93
 
94 14 jguarin200
 
95
end rtl;

powered by: WebSVN 2.1.0

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