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

Subversion Repositories jart

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

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

Line No. Rev Author Line
1 14 jguarin200
library ieee;
2
 
3
use ieee.std_logic_1164.all;
4
use ieee.std_logic_arith.all;
5
use ieee.std_logic_unsigned.all;
6
 
7
use work.powerGrid.all;
8
 
9
 
10
entity dComparisonCell is
11
        generic (       W               : integer := 32;        -- V.D, minDistance and selectD Width 
12
                                idColW  : integer := 2;         -- Column Sphere ID width. 1 = 2 columns max, 2= 4 colums max... and so on.
13
                                idCol   : integer := 0           -- Column Id
14
        );
15
 
16
 
17
        port    (
18
                                clk             : in std_logic;
19
                                rst             : in std_logic;
20
 
21
                                cIdd    : in    std_logic_vector (idColW - 1 downto 0);  -- This is the reference column identification input.
22
                                cIdq    : out   std_logic_vector (idColW - 1 downto 0);  -- This is the sphere identification output.
23
                                refvd   : in    std_logic_vector (W - 1 downto 0);               -- This is the projection incoming from the previous cell.
24
                                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! .
25
                                selvd   : out   std_logic_vector (W - 1 downto 0)                -- This is the smallest value between refvd and colvd.
26
        )
27
        end port;
28
 
29
 
30
 
31
end entity;
32
 
33
 
34
architecture rtl of dComparisonCell is
35
 
36
        signal sl32 : std_logic;        -- This signal indicates if refvd is less than colvd
37
 
38
begin
39
 
40
        -- A less than B comparison, check if colvd is less than refvd, meaning the act V.D less than actual max V.D
41
        cl32                    : l32   port map (      dataa   => colvd,
42
                                                                                datab   => refvd,
43
                                                                                AlB             => sl32
44
                                                                                );
45
 
46
        -- A flip flop with 2 to 1 mux.
47
        selector                : scanFF        generic map (   W = 32  )
48
                                                                port map        (       clk     => clk,
49
                                                                                                rst     => rst,
50
                                                                                                scLoad  => sl32,
51
                                                                                                extData => colvd,
52
                                                                                                dStage  => refvd,
53
                                                                                                qStage  => selvd);
54
 
55
 
56
        colIdSelector : process (clk,rst)
57
        begin
58
 
59
                if rst = '0' then
60
 
61
                        --Set max Distance on reset and column identifier       
62
                        cIdq <= CONV_STD_LOGIC_VECTOR(idCol,idColW);
63
                        selvd(W-1) <= '0';
64
                        selvd(W-2 downto 0) <= (others => '1');
65
 
66
                elsif rising_edge(clk) then
67
 
68
                        if sl32 ='0' then
69
 
70
                                -- If reference V.D. is less than column V.D then shift the reference id. 
71
                                cIdq <= cIdd;
72
 
73
                        else
74
 
75
                                --If column V.D. is less than
76
                                cIdq <= CONV_STD_LOGIC(idCol,idColW);
77
 
78
                end if;
79
 
80
 
81
        end process;
82
 
83
 
84
 
85
 
86
end rtl;

powered by: WebSVN 2.1.0

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