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

Subversion Repositories raytrac

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

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

Line No. Rev Author Line
1 16 jguarin200
-- RAYTRAC
2
-- Author Julian Andres Guarin
3
-- cla_logic_block.vhd
4
-- This file is part of raytrac.
5
-- 
6
--     raytrac is free software: you can redistribute it and/or modify
7
--     it under the terms of the GNU General Public License as published by
8
--     the Free Software Foundation, either version 3 of the License, or
9
--     (at your option) any later version.
10
-- 
11
--     raytrac is distributed in the hope that it will be useful,
12
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
13
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
--     GNU General Public License for more details.
15
-- 
16
--     You should have received a copy of the GNU General Public License
17
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>.library ieee;
18
 
19
-- Check out arithpack.vhd to understand in general terms what this file describes,
20
-- or checkout this file to check in detailed way what this file intends to.
21
 
22 2 jguarin200
use ieee.std_logic_1164.all;
23
entity cla_logic_block is
24
        generic (
25 16 jguarin200
                w : integer := 4                                                        -- Carry Look Ahead Block Default Size 
26 2 jguarin200
        );
27
 
28
        port (
29 16 jguarin200
                p,g : in std_logic_vector(w-1 downto 0); -- Propagation and Generation Inputs
30
                cin : in std_logic;                                                     -- Carry In input
31 2 jguarin200
 
32 16 jguarin200
                c : out std_logic_vector(w downto 1)            -- Generated Carry Out outputs
33 2 jguarin200
        );
34
end cla_logic_block;
35
 
36
 
37
architecture cla_logic_block_arch of cla_logic_block is
38
 
39
 
40
 
41
begin
42
 
43
        claProc:        -- claProc instancia funciones combinatorias en las variables iCarry,
44
                        -- pero notese que los valores de iCarry(i) no dependen jamas de iCarry(i-1) a diferencia de rcaProc
45
        process(p,g,cin)
46
 
47
                variable i,j,k :        integer range 0 to w;                            -- Variables de control de loop
48
                variable iCarry:        std_logic_vector(w downto 1);                   -- Carry Interno
49
                variable iResults:      std_logic_vector(((w+w**2)/2)-1 downto 0);       -- Resultados intermedios                       
50
                variable index:         integer;
51
        begin
52
 
53
                iCarry(w downto 1) := g(w-1 downto 0);
54
                index := 0;
55
                for j in 0 to w-1 loop
56
                        for i in 1 to j+1 loop
57
                                iResults(index) := '1';
58
                                for k in j-i+1 to j loop
59
                                        iResults(index) := iResults(index) and p(k);
60
                                end loop;
61
                                if j>=i then
62
                                        iResults(index) := iResults(index) and g(j-i);
63
                                else
64
                                        iResults(index) := iResults(index) and cin;
65
                                end if;
66
                                iCarry(j+1) := iCarry(j+1) or iResults(index);
67
                                index := index + 1;
68
                        end loop;
69
 
70
                        c(j+1) <= iCarry(j+1);
71
 
72
                end loop;
73
 
74
 
75
 
76
        end process claProc;
77
 
78
 
79
 
80
end cla_logic_block_arch;
81
 

powered by: WebSVN 2.1.0

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