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

Subversion Repositories jart

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

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
                                clk             : in std_logic;
43
                                rst             : in std_logic;
44
 
45
                                cIdd    : in    std_logic_vector (idColW - 1 downto 0);  -- This is the reference column identification input.
46
                                cIdq    : out   std_logic_vector (idColW - 1 downto 0);  -- This is the sphere identification output.
47
                                refvd   : in    std_logic_vector (W - 1 downto 0);               -- This is the projection incoming from the previous cell.
48
                                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! .
49
                                selvd   : out   std_logic_vector (W - 1 downto 0)                -- This is the smallest value between refvd and colvd.
50 21 jguarin200
        );
51 14 jguarin200
 
52
end entity;
53
 
54
 
55
architecture rtl of dComparisonCell is
56
 
57 21 jguarin200
        signal          ssl32 : std_logic;      -- This signal indicates if refvd is less than colvd
58
 
59
 
60 14 jguarin200
begin
61
 
62 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
63 17 jguarin200
        cl32                    : sl32  port map (      dataa   => colvd,
64 14 jguarin200
                                                                                datab   => refvd,
65 21 jguarin200
                                                                                AlB             => ssl32
66 14 jguarin200
                                                                                );
67
 
68
        -- A flip flop with 2 to 1 mux.
69 21 jguarin200
        selectorVD              : scanFF        generic map (   W = W   )
70 14 jguarin200
                                                                port map        (       clk     => clk,
71
                                                                                                rst     => rst,
72 17 jguarin200
                                                                                                scLoad  => ssl32,
73 14 jguarin200
                                                                                                extData => colvd,
74
                                                                                                dStage  => refvd,
75
                                                                                                qStage  => selvd);
76 21 jguarin200
        -- Another flip flip with 2 to 1 mux.
77
        selectorID              : scanFF        generic map     (       W = idColW )
78
                                                                port map        (       clk     => clk,
79
                                                                                                rst             => rst,
80
                                                                                                scLoad  => ssl32,
81
                                                                                                extData => CONV_STD_LOGIC(idCol,idColW),
82
                                                                                                dStage  => cIdd,
83
                                                                                                qStage  => cIdq
84
                                                                                                );
85 14 jguarin200
 
86
end rtl;

powered by: WebSVN 2.1.0

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