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

Subversion Repositories raytrac

[/] [raytrac/] [trunk/] [cla_logic_block.vhd] - Blame information for rev 13

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

Line No. Rev Author Line
1 2 jguarin200
library ieee;
2
use ieee.std_logic_1164.all;
3
 
4
entity cla_logic_block is
5
        generic (
6
                w : integer := 4
7
        );
8
 
9
        port (
10
                p,g : in std_logic_vector(w-1 downto 0);
11
                cin : in std_logic;
12
 
13
                c : out std_logic_vector(w downto 1)
14
        );
15
end cla_logic_block;
16
 
17
 
18
architecture cla_logic_block_arch of cla_logic_block is
19
 
20
 
21
 
22
begin
23
 
24
        claProc:        -- claProc instancia funciones combinatorias en las variables iCarry,
25
                        -- pero notese que los valores de iCarry(i) no dependen jamas de iCarry(i-1) a diferencia de rcaProc
26
        process(p,g,cin)
27
 
28
                variable i,j,k :        integer range 0 to w;                            -- Variables de control de loop
29
                variable iCarry:        std_logic_vector(w downto 1);                   -- Carry Interno
30
                variable iResults:      std_logic_vector(((w+w**2)/2)-1 downto 0);       -- Resultados intermedios                       
31
                variable index:         integer;
32
        begin
33
 
34
                iCarry(w downto 1) := g(w-1 downto 0);
35
                index := 0;
36
                for j in 0 to w-1 loop
37
                        for i in 1 to j+1 loop
38
                                iResults(index) := '1';
39
                                for k in j-i+1 to j loop
40
                                        iResults(index) := iResults(index) and p(k);
41
                                end loop;
42
                                if j>=i then
43
                                        iResults(index) := iResults(index) and g(j-i);
44
                                else
45
                                        iResults(index) := iResults(index) and cin;
46
                                end if;
47
                                iCarry(j+1) := iCarry(j+1) or iResults(index);
48
                                index := index + 1;
49
                        end loop;
50
 
51
                        c(j+1) <= iCarry(j+1);
52
 
53
                end loop;
54
 
55
 
56
 
57
        end process claProc;
58
 
59
 
60
 
61
end cla_logic_block_arch;
62
 

powered by: WebSVN 2.1.0

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