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

Subversion Repositories raytrac

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

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

Line No. Rev Author Line
1 16 jguarin200
------------------------------------------------
2
--! @file
3
--! @brief Entidad top del RtEngine \nRtEngine's top hierarchy.
4
--------------------------------------------------
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 16 jguarin200
--! Libreria de definicion de senales y tipos estandares, comportamiento de operadores aritmeticos y logicos.\nSignal 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
--! Se usaran en esta descripcion los componentes del package arithpack.vhd.\nIt will be used in this description the components on the arithpack.vhd package. 
31 11 jguarin200
use work.arithpack.all;
32
 
33 16 jguarin200
--! La entidad raytrac es la top en la jerarquia de descripcion del RtEngine.\nRaytrac entity is the top one on the RtEngine 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
--! En el momento de la carga se llevaran a cabo las siguientes operaciones:
37
--! \n\tProducto Punto => Si opcode es 0:\n\n\tA.B y C.D, los valores apareceran en las salidas DP0 y DP1. El tiempo transcurrido desde la carga de las entradas hasta la salida del resultado sera 4 clocks. 
38
--! \n\tProducto Cruz  => Si opcode es 1:\n\n\tAxB 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. 
39
--! \n\nLos 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.   
40
--! \n The RayTrac entity basically takes the inputs of 4 vectors: A,B,C,D and the opcode and addcode inputs.
41
--! When this inputs are loaded, it will take place the following operations:
42
--! \n\tDot Product   => If opcode is 0:\n\n\tA.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.
43
--! \n\tCross Product => If opcode is 1:\n\n\tAxB 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.
44
--! \n\nThe instantiated components in the description   
45 11 jguarin200
entity raytrac is
46
        generic (
47 15 jguarin200
                registered : string := "YES"
48 11 jguarin200
        );
49
        port (
50 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. 
51
                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. 
52
                clk,rst,ena             : in std_logic;                                                 -- Las senales de control usual. The usual control signals.
53
                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.
54 11 jguarin200
 
55 14 jguarin200
 
56 11 jguarin200
        );
57
end raytrac;
58
 
59
architecture raytrac_arch of raytrac is
60
        signal SA,SB,SC,SD                      : std_logic_vector(18*3-1 downto 0);
61
        signal sopcode,saddcode         : std_logic;
62
        signal smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51  : std_logic_vector(17 downto 0);
63
 
64
begin
65
 
66
        -- Registered or unregistered inputs?
67
        notreg:
68
        if registered="NO" generate
69
                SA <= A;
70
                SB <= B;
71
                SC <= C;
72
                SD <= D;
73
                sopcode <= opcode;
74
                saddcode <= addcode;
75
        end generate notreg;
76
        reg:
77
        if registered="YES" generate
78 14 jguarin200
                procReg:
79 11 jguarin200
                process(clk,rst)
80
                begin
81
                        if rst=rstMasterValue then
82
                                SA <= (others => '0');
83
                                SB <= (others => '0');
84
                                SC <= (others => '0');
85
                                SD <= (others => '0');
86 14 jguarin200
                                sopcode <= '0';
87
                                saddcode <= '0';
88 11 jguarin200
                        elsif clk'event and clk='1' then
89
                                if ena <= '1' then
90
                                        SA <= A;
91
                                        SB <= B;
92
                                        SC <= C;
93
                                        SD <= D;
94
                                        sopcode <= opcode;
95
                                        saddcode <= addcode;
96
                                end if;
97
                        end if;
98 14 jguarin200
                end process procReg;
99 11 jguarin200
        end generate reg;
100
        -- Instantiate Opcoder 
101
        opcdr : opcoder
102
        port map (
103
                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),
104
                smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51,
105
                sopcode,saddcode
106
        );
107
        -- Instantiate uf, cross product and dot product functional unit.
108
        uf0 : uf
109
        port map (
110
                sopcode,
111
                smf00,smf01,smf10,smf11,smf20,smf21,smf30,smf31,smf40,smf41,smf50,smf51,
112
                CPX,CPY,CPZ,DP0,DP1,
113
                clk,rst
114
        );
115
 
116
end raytrac_arch;
117
 
118
 
119
 

powered by: WebSVN 2.1.0

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