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

Subversion Repositories raytrac

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

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

Line No. Rev Author Line
1 16 jguarin200
------------------------------------------------
2
--! @file
3 18 jguarin200
--! @brief Entidad top del Rt Engine \n Rt Engine's top hierarchy.
4 22 jguarin200
--! @author Julián Andrés Guarín Reyes
5 16 jguarin200
--------------------------------------------------
6
 
7
 
8 11 jguarin200
-- RAYTRAC
9
-- Author Julian Andres Guarin
10
-- raytrac.vhd
11
-- This file is part of raytrac.
12
-- 
13
--     raytrac is free software: you can redistribute it and/or modify
14
--     it under the terms of the GNU General Public License as published by
15
--     the Free Software Foundation, either version 3 of the License, or
16
--     (at your option) any later version.
17
-- 
18
--     raytrac is distributed in the hope that it will be useful,
19
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
20
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
--     GNU General Public License for more details.
22
-- 
23
--     You should have received a copy of the GNU General Public License
24 16 jguarin200
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
25 11 jguarin200
 
26 18 jguarin200
--! Libreria de definicion de senales y tipos estandares, comportamiento de operadores aritmeticos y logicos.\n Signal and types definition library. This library also defines 
27 11 jguarin200
library ieee;
28 16 jguarin200
--! Paquete de definicion estandard de logica. Standard logic definition pack.
29 11 jguarin200
use ieee.std_logic_1164.all;
30 16 jguarin200
 
31 27 jguarin200
 
32
 
33 18 jguarin200
--! Se usaran en esta descripcion los componentes del package arithpack.vhd.\n It will be used in this description the components on the arithpack.vhd package. 
34 11 jguarin200
use work.arithpack.all;
35
 
36 18 jguarin200
--! La entidad raytrac es la top en la jerarquia de descripcion del Rt Engine.\n Raytrac entity is the top one on the Rt Engine description hierarchy.
37 11 jguarin200
 
38 16 jguarin200
--! RayTrac es basicamente una entidad que toma las entradas de cuatro vectores: A,B,C,D y las entradas opcode y addcode.
39 18 jguarin200
--! En el momento de la carga se llevaran a cabo las siguientes operaciones: \n
40
--! - Producto Cruz (opcode = 1):
41
--! - Cross Product (opcode = 1):
42
--! \n\n
43
--! \t Los resultados apareceran 3 clocks despues de la carga de los operadores y el codigo operacion
44
--! \n\n  
45
--! <table>
46
--! <tr>
47
--! <th></th>
48
--! <th></th><th>addcode=0</th><th></th>
49
--! </tr>
50
--! <tr>
51
--! <th>Opcode 1</th>
52
--! <td>CPX <= AxB<B> i</B></td>
53
--! <td>CPY <= AxB<B> j</B></td>
54
--! <td>CPZ <= AxB<B> k</B></td>
55
--! </tr>
56
--! </table>
57
--! \n
58
--! <table>
59
--! <tr>
60
--! <th></th>
61
--! <th></th><th>addcode=1</th><th></th>
62
--! </tr>
63
--! <tr>
64
--! <th>Opcode 1</th>
65
--! <td>CPX <= CxD<B> i</B></td>
66
--! <td>CPY <= CxD<B> j</B></td>
67
--! <td>CPZ <= CxD<B> k</B></td>
68
--! </tr>
69
--! </table>
70
--! \n
71
--! - Producto Punto (opcode = 0):
72
--! - Dot Product (opcode = 0):
73
--! \n\n
74 20 jguarin200
--! \t Los resultados se encontraran en DP0 y DP1 4 clocks despues de la carga.
75
--! \n\n 
76 18 jguarin200
--! <table>
77
--! <tr>
78
--! <th></th><th>addcode, ignorar</th> 
79
--! </tr>
80
--! <tr>
81
--! <th>opcode=0</th><td> DP0 = A.B, DP1 = C.D</td>
82
--! </tr>
83
--! </table>
84
 
85
 
86 11 jguarin200
entity raytrac is
87
        generic (
88 27 jguarin200
 
89 20 jguarin200
                registered : string := "YES" --! Este parametro, por defecto "YES", indica si se registran o cargan en registros los vectores A,B,C,D y los codigos de operacion opcode y addcode en vez de ser conectados directamente al circuito combinatorio. \n This parameter, by default "YES", indicates if vectors A,B,C,D and operation code inputs opcode are to be loaded into a register at the beginning of the pipe rather than just connecting them to the operations decoder (opcoder). 
90 11 jguarin200
        );
91
        port (
92 20 jguarin200
                A,B,C,D                 : in std_logic_vector(18*3-1 downto 0); --! Vectores de entrada A,B,C,D, cada uno de tamano fijo: 3 componentes x 18 bits. \n Input vectors A,B,C,D, each one of fixed size: 3 components x 18 bits. 
93
                opcode,addcode  : in std_logic;                                                 --! Opcode and addcode input bits, opcode selects what operation is going to perform one of the entities included in the design and addcode what operands are going to be involved in such. \n Opcode & addcode, opcode selecciona que operacion se va a llevar a cabo dentro de una de las entidades referenciadas dentro de la descripcion, mientras que addcode decide cuales van a ser los operandos que realizaran tal. 
94 30 jguarin200
                clk,rst,ena                     : in std_logic;                                                 --! Las senales de control usual. The usual control signals.
95 20 jguarin200
                CPX,CPY,CPZ,DP0,DP1 : out std_logic_vector(31 downto 0)  --! Salidas que representan los resultados del RayTrac: pueden ser dos resultados, de dos operaciones de producto punto, o un producto cruz. Por favor revisar el documento de especificacion del dispositivo para tener mas claridad.\n  Outputs representing the result of the RayTrac entity: can be the results of two parallel dot product operations or the result of a single cross product, in order to clarify refere to the entity specification documentation.
96 11 jguarin200
 
97 14 jguarin200
 
98 11 jguarin200
        );
99
end raytrac;
100
 
101 18 jguarin200
--! Arquitectura general del RayTrac. \n RayTrac general architecture.
102
 
103
--! La Arquitectura general de RayTrac se consiste en 3 componentes esenciales:
104
--! - Etapa de registros para la carga de los operadores y el codigo de operacion.
105
--! - Etapa combinatoria para la seleccion de operadores, dependiendo del codigo de operacion.
106 20 jguarin200
--! - Etapa aritmetica del calculo del producto punto o el producto cruz segun el caso.
107
--! \n\n
108 21 jguarin200
--! Las senales referidas en la arquitectura simplemente son conectores asignadas en la instanciaci&oacute;n de los componentes y en la asignacion entre ellas mismas en los procesos explicitos.
109 20 jguarin200
--! \n\n
110
--! RayTrac general architecture is made of 3 essential components: 
111
--! - Register stage to load operation code and operators.
112
--! - Combinatory Stage to operator selection, depending on the operation code.
113
--! - Arithmetic stage to calculate dot product or cross product, depending on the case.
114
--! \n\n 
115
--! Referred signals in the architecture are simple connectors assigned in the components intantiation and in the assignation among them in explicit processes.  
116
 
117 18 jguarin200
 
118 11 jguarin200
architecture raytrac_arch of raytrac is
119 20 jguarin200
        signal SA,SB,SC,SD                      : std_logic_vector(18*3-1 downto 0); --! Signal to register or bypass the vector inputs.  
120 11 jguarin200
        signal sopcode,saddcode         : std_logic;
121
        signal smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51  : std_logic_vector(17 downto 0);
122
 
123
begin
124
 
125
        reg:
126
        if registered="YES" generate
127 20 jguarin200
 
128
                --! By default: the inputs are going to be registered or loaded. This process describes how the register loading is to be make. \n Por defecto: las entradas se van a registrar o cargar. Este proceso describe como la carga de los registros con los valores de las entradas se va a realizar. 
129 14 jguarin200
                procReg:
130 11 jguarin200
                process(clk,rst)
131
                begin
132
                        if rst=rstMasterValue then
133
                                SA <= (others => '0');
134
                                SB <= (others => '0');
135
                                SC <= (others => '0');
136
                                SD <= (others => '0');
137 14 jguarin200
                                sopcode <= '0';
138
                                saddcode <= '0';
139 11 jguarin200
                        elsif clk'event and clk='1' then
140 31 jguarin200
                                if ena = '1' then
141 11 jguarin200
                                        SA <= A;
142
                                        SB <= B;
143
                                        SC <= C;
144
                                        SD <= D;
145
                                        sopcode <= opcode;
146
                                        saddcode <= addcode;
147
                                end if;
148
                        end if;
149 14 jguarin200
                end process procReg;
150 11 jguarin200
        end generate reg;
151 20 jguarin200
 
152
        notreg:
153
        if registered="NO" generate
154
                --! Just bypass or connect the inputs to the opcoder.
155
                procNotReg:
156
                process (A,B,C,D,opcode,addcode)
157
                begin
158
                        SA <= A;
159
                        SB <= B;
160
                        SC <= C;
161
                        SD <= D;
162
                        sopcode <= opcode;
163
                        saddcode <= addcode;
164
                end process procNotReg;
165
        end generate notreg;
166
 
167
        --! Instantiate Opcoder 
168 11 jguarin200
        opcdr : opcoder
169
        port map (
170
                SA(17 downto 0),SB(17 downto 0),SC(17 downto 0),SD(17 downto 0),SA(35 downto 18),SB(35 downto 18),SC(35 downto 18),SD(35 downto 18),SA(53 downto 36),SB(53 downto 36),SC(53 downto 36),SD(53 downto 36),
171
                smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51,
172
                sopcode,saddcode
173
        );
174 20 jguarin200
        --! Instantiate uf, cross product and dot product functional unit.
175 32 jguarin200
        uf0 : uf
176
        generic map ("YES","RCA")
177 11 jguarin200
        port map (
178
                sopcode,
179
                smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51,
180
                CPX,CPY,CPZ,DP0,DP1,
181
                clk,rst
182
        );
183
 
184
end raytrac_arch;
185
 
186
 
187
 

powered by: WebSVN 2.1.0

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