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

Subversion Repositories raytrac

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

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 16 jguarin200
--------------------------------------------------
5
 
6
 
7 11 jguarin200
-- RAYTRAC
8
-- Author Julian Andres Guarin
9
-- raytrac.vhd
10
-- This file is part of raytrac.
11
-- 
12
--     raytrac is free software: you can redistribute it and/or modify
13
--     it under the terms of the GNU General Public License as published by
14
--     the Free Software Foundation, either version 3 of the License, or
15
--     (at your option) any later version.
16
-- 
17
--     raytrac is distributed in the hope that it will be useful,
18
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
19
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
--     GNU General Public License for more details.
21
-- 
22
--     You should have received a copy of the GNU General Public License
23 16 jguarin200
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
24 11 jguarin200
 
25 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 
26 11 jguarin200
library ieee;
27 16 jguarin200
--! Paquete de definicion estandard de logica. Standard logic definition pack.
28 11 jguarin200
use ieee.std_logic_1164.all;
29 16 jguarin200
 
30 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. 
31 11 jguarin200
use work.arithpack.all;
32
 
33 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.
34 11 jguarin200
 
35 16 jguarin200
--! RayTrac es basicamente una entidad que toma las entradas de cuatro vectores: A,B,C,D y las entradas opcode y addcode.
36 18 jguarin200
--! En el momento de la carga se llevaran a cabo las siguientes operaciones: \n
37
--! - Producto Cruz (opcode = 1):
38
--! - Cross Product (opcode = 1):
39
--! \n\n
40
--! \t Los resultados apareceran 3 clocks despues de la carga de los operadores y el codigo operacion
41
--! \n\n  
42
--! <table>
43
--! <tr>
44
--! <th></th>
45
--! <th></th><th>addcode=0</th><th></th>
46
--! </tr>
47
--! <tr>
48
--! <th>Opcode 1</th>
49
--! <td>CPX <= AxB<B> i</B></td>
50
--! <td>CPY <= AxB<B> j</B></td>
51
--! <td>CPZ <= AxB<B> k</B></td>
52
--! </tr>
53
--! </table>
54
--! \n
55
--! <table>
56
--! <tr>
57
--! <th></th>
58
--! <th></th><th>addcode=1</th><th></th>
59
--! </tr>
60
--! <tr>
61
--! <th>Opcode 1</th>
62
--! <td>CPX <= CxD<B> i</B></td>
63
--! <td>CPY <= CxD<B> j</B></td>
64
--! <td>CPZ <= CxD<B> k</B></td>
65
--! </tr>
66
--! </table>
67
--! \n
68
--! - Producto Punto (opcode = 0):
69
--! - Dot Product (opcode = 0):
70
--! \n\n
71 19 jguarin200
--! \t Los resultados se encontraran en DP0 y DP1 4 clocks despues de la carga.\n 
72 18 jguarin200
--! <table>
73
--! <tr>
74
--! <th></th><th>addcode, ignorar</th> 
75
--! </tr>
76
--! <tr>
77
--! <th>opcode=0</th><td> DP0 = A.B, DP1 = C.D</td>
78
--! </tr>
79
--! </table>
80
 
81
 
82
--!  - Producto Cruz  => Si opcode es 1:
83
--!  - AxB si addcode es 0, CxD si addcode es 1, las componentes del vector resultante apareceran en CPX,CPY,CPZ 3 clocks, despues de la carga. \n 
84
--! \n\n Los componentes instanciados en la descripcion conforman un pipeline de hasta 4 etapas. Por lo tanto es posible cargar vectores (A,B,C,D) y codigos de operacion (opcode y addcode) clock tras clock.   
85 16 jguarin200
--! \n The RayTrac entity basically takes the inputs of 4 vectors: A,B,C,D and the opcode and addcode inputs.
86
--! When this inputs are loaded, it will take place the following operations:
87 18 jguarin200
--! \n\t Dot Product   => If opcode is 0:\n\n\t A.B and C.D, the resulting values will appear in the DP0 and DP1 outputs. The time taken once the inputs are loaded to the output of the results will be of 4 clocks.
88
--! \n\t Cross Product => If opcode is 1:\n\n\t AxB if addcode is 0, CxD if addcode es 1. The components of the resulting vector will appear in CPX,CPY,CPZ 3 clocks, after the input loading.
89
--! \n\n The instantiated components in the description          
90 11 jguarin200
entity raytrac is
91
        generic (
92 15 jguarin200
                registered : string := "YES"
93 11 jguarin200
        );
94
        port (
95 16 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. 
96
                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. 
97
                clk,rst,ena             : in std_logic;                                                 -- Las senales de control usual. The usual control signals.
98 18 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.
99 11 jguarin200
 
100 14 jguarin200
 
101 11 jguarin200
        );
102
end raytrac;
103
 
104 18 jguarin200
--! Arquitectura general del RayTrac. \n RayTrac general architecture.
105
 
106
--! La Arquitectura general de RayTrac se consiste en 3 componentes esenciales:
107
--! - Etapa de registros para la carga de los operadores y el codigo de operacion.
108
--! - Etapa combinatoria para la seleccion de operadores, dependiendo del codigo de operacion.
109
--! - Etapa aritmetica del calculo del producto punto o el producto cruz segun el caso. 
110
 
111 11 jguarin200
architecture raytrac_arch of raytrac is
112
        signal SA,SB,SC,SD                      : std_logic_vector(18*3-1 downto 0);
113
        signal sopcode,saddcode         : std_logic;
114
        signal smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51  : std_logic_vector(17 downto 0);
115
 
116
begin
117
 
118
        -- Registered or unregistered inputs?
119
        notreg:
120
        if registered="NO" generate
121
                SA <= A;
122
                SB <= B;
123
                SC <= C;
124
                SD <= D;
125
                sopcode <= opcode;
126
                saddcode <= addcode;
127
        end generate notreg;
128
        reg:
129
        if registered="YES" generate
130 14 jguarin200
                procReg:
131 11 jguarin200
                process(clk,rst)
132
                begin
133
                        if rst=rstMasterValue then
134
                                SA <= (others => '0');
135
                                SB <= (others => '0');
136
                                SC <= (others => '0');
137
                                SD <= (others => '0');
138 14 jguarin200
                                sopcode <= '0';
139
                                saddcode <= '0';
140 11 jguarin200
                        elsif clk'event and clk='1' then
141
                                if ena <= '1' then
142
                                        SA <= A;
143
                                        SB <= B;
144
                                        SC <= C;
145
                                        SD <= D;
146
                                        sopcode <= opcode;
147
                                        saddcode <= addcode;
148
                                end if;
149
                        end if;
150 14 jguarin200
                end process procReg;
151 11 jguarin200
        end generate reg;
152
        -- Instantiate Opcoder 
153
        opcdr : opcoder
154
        port map (
155
                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),
156
                smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51,
157
                sopcode,saddcode
158
        );
159
        -- Instantiate uf, cross product and dot product functional unit.
160
        uf0 : uf
161
        port map (
162
                sopcode,
163
                smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51,
164
                CPX,CPY,CPZ,DP0,DP1,
165
                clk,rst
166
        );
167
 
168
end raytrac_arch;
169
 
170
 
171
 

powered by: WebSVN 2.1.0

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