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

Subversion Repositories raytrac

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

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

Line No. Rev Author Line
1 20 jguarin200
--! @file opcoder.vhd
2 22 jguarin200
--! @brief Decodificador de operacion. 
3
--! @author Julián Andrés Guarín Reyes.
4 20 jguarin200
--------------------------------------------------------------
5 16 jguarin200
-- RAYTRAC
6
-- Author Julian Andres Guarin
7
-- opcoder.vhd
8
-- This file is part of raytrac.
9
-- 
10
--     raytrac is free software: you can redistribute it and/or modify
11
--     it under the terms of the GNU General Public License as published by
12
--     the Free Software Foundation, either version 3 of the License, or
13
--     (at your option) any later version.
14
-- 
15
--     raytrac is distributed in the hope that it will be useful,
16
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
17
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
--     GNU General Public License for more details.
19
-- 
20
--     You should have received a copy of the GNU General Public License
21
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>.
22 22 jguarin200
 
23
 
24
--! Libreria de definicion de senales y tipos estandares, comportamiento de operadores aritmeticos y logicos.\n Signal and types definition library. This library also defines 
25 3 jguarin200
library ieee;
26 22 jguarin200
--! Paquete de definicion estandard de logica. Standard logic definition pack.
27 3 jguarin200
use ieee.std_logic_1164.all;
28 24 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. 
29
use work.arithpack.all;
30 3 jguarin200
 
31 21 jguarin200
--! La entidad opcoder es la etapa combinatoria que decodifica la operacion que se va a realizar.
32 20 jguarin200
 
33 21 jguarin200
--! \n\n   
34
--! Las entradas a esta descripci&oacute;n son: los vectores A,B,C,D, las entradas opcode y addcode. Las salidas del decodificador, estar&aacute;n conectadas a las entradas de los 6 multiplicadores de una entidad uf. Los operandos de los multiplicadores, tambi&eacute;n conocidos como factores, son las salida m0f0, m0f1 para el multiplicador 1 y as&iacute; hasta el multiplicador 5. B&aacute;sicamente lo que opera aqu&iacute; en esta descripci&oacute;n es un multiplexor, el cual selecciona a trav&eacute;s de opcode y addcode qu&eacute; componentes de los vectores se conectaran a los operandos de los multiplicadores.  
35 3 jguarin200
entity opcoder is
36 25 jguarin200
        generic (
37
                width : integer := 18;
38 59 jguarin200
                structuralDescription : string:= "NO"
39 26 jguarin200
        );
40 7 jguarin200
        port (
41 25 jguarin200
                Ax,Bx,Cx,Dx,Ay,By,Cy,Dy,Az,Bz,Cz,Dz : in std_logic_vector (width-1 downto 0);
42
                m0f0,m0f1,m1f0,m1f1,m2f0,m2f1,m3f0,m3f1,m4f0,m4f1,m5f0,m5f1 : out std_logic_vector (width-1 downto 0);
43 14 jguarin200
 
44 3 jguarin200
                opcode,addcode : in std_logic
45
        );
46
end entity;
47
 
48 22 jguarin200
--! Arquitectura del decodificador de operaci&oacute;n.
49
 
50 21 jguarin200
--! El bloque de arquitectura del decodificador es simplemente una cascada de multiplexores. La selecci&oacute;n se hace en funci&oacute;n de las se&ntilde;ales appcode y addcode\n
51
--! La siguiente tabla describe el comportamiento de los multiplexores:\n
52
--! \n\n
53
--! 
54
--! <table>
55
--! <tr><th></th><th>OPCODE</th><th>ADDCODE</th><th>f0</th><th>f1</th><th>&nbsp;</th><th>OPCODE</th><th>ADDCODE</th><th>f0</th><th>f1</th><th>&nbsp;</th></tr> <tr><td>m0</td><td>0</td><td>0</td><td>Ax</td><td>Bx</td><td>&nbsp;</td><td>0</td><td>0</td><td>Cx</td><td>Dx</td><td>m3</td></tr> <tr><td>m0</td><td>0</td><td>1</td><td>Ax</td><td>Bx</td><td>&nbsp;</td><td>0</td><td>1</td><td>Cx</td><td>Dx</td><td>m3</td></tr> <tr><td>m0</td><td>1</td><td>0</td><td>Ay</td><td>Bz</td><td>&nbsp;</td><td>1</td><td>0</td><td>Ax</td><td>Bz</td><td>m3</td></tr> <tr><td>m0</td><td>1</td><td>1</td><td>Cy</td><td>Dz</td><td>&nbsp;</td><td>1</td><td>1</td><td>Cx</td><td>Dz</td><td>m3</td></tr> <tr><td>m1</td><td>0</td><td>0</td><td>Ay</td><td>By</td><td>&nbsp;</td><td>0</td><td>0</td><td>Cy</td><td>Dy</td><td>m4</td></tr> <tr><td>m1</td><td>0</td><td>1</td><td>Ay</td><td>By</td><td>&nbsp;</td><td>0</td><td>1</td><td>Cy</td><td>Dy</td><td>m4</td></tr> <tr><td>m1</td><td>1</td><td>0</td><td>Az</td><td>By</td><td>&nbsp;</td><td>1</td><td>0</td><td>Ax</td><td>By</td><td>m4</td></tr> <tr><td>m1</td><td>1</td><td>1</td><td>Cz</td><td>Dy</td><td>&nbsp;</td><td>1</td><td>1</td><td>Cx</td><td>Dy</td><td>m4</td></tr> <tr><td>m2</td><td>0</td><td>0</td><td>Az</td><td>Bz</td><td>&nbsp;</td><td>0</td><td>0</td><td>Cz</td><td>Dz</td><td>m5</td></tr> <tr><td>m2</td><td>0</td><td>1</td><td>Az</td><td>Bz</td><td>&nbsp;</td><td>0</td><td>1</td><td>Cz</td><td>Dz</td><td>m5</td></tr> <tr><td>m2</td><td>1</td><td>0</td><td>Az</td><td>Bx</td><td>&nbsp;</td><td>1</td><td>0</td><td>Ay</td><td>Bx</td><td>m5</td></tr> <tr><td>m2</td><td>1</td><td>1</td><td>Cz</td><td>Dx</td><td>&nbsp;</td><td>1</td><td>1</td><td>Cy</td><td>Dx</td><td>m5</td></tr></table>
56 22 jguarin200
--! \n\n
57
--! Por ejemplo para ver la tabla de verdad del m0f0, consultar el registro (línea) m0 y el atributo (columna) f0.\n
58 21 jguarin200
 
59 3 jguarin200
architecture opcoder_arch of opcoder is
60
 
61 27 jguarin200
        signal aycy,bzdz,azcz,bydy,bxdx,axcx: std_logic_vector(width-1 downto 0);
62 24 jguarin200
 
63 3 jguarin200
begin
64 22 jguarin200
        --! Proceso que describe las 2 etapas de multiplexores. 
65
        --! Proceso que describe las 2 etapas de multiplexores. Una corresponde al selector addcode, que selecciona con que operadores realizará la operación producto cruz, es decir, seleccionará si realiza la operación AxB ó CxD. En el caso del producto punto, esta etapa de multiplexación no tendrá repercusión en el resultado de la deocdificación de la operación. La otra etapa utiliza el selector opcode, el cual decide si usa los operandos decodificados en la primera etapa de multiplexores, en el caso de que opcode sea 1, seleccionando la operación producto cruz, o por el contrario seleccionando una decodificación de operadores que lleven a cabo la operación producto punto. 
66
 
67 24 jguarin200
        originalMuxGen:
68 26 jguarin200
        if structuralDescription="NO" generate
69 24 jguarin200
 
70
                procOpcoder:
71 26 jguarin200
                process (Ax,Bx,Cx,Dx,Ay,By,Cy,Dy,Az,Bz,Cz,Dz,aycy,bzdz,azcz,bydy,bxdx,axcx,opcode,addcode)
72 25 jguarin200
                begin
73
                        case (addcode) is
74 26 jguarin200
                                -- Estamos ejecutando CxD
75
                                when '1'=>
76 25 jguarin200
                                        aycy <= Cy;
77
                                        bzdz <= Dz;
78
                                        azcz <= Cz;
79
                                        bydy <= Dy;
80
                                        axcx <= Cx;
81
                                        bxdx <= Dx;
82
                                when others =>
83 26 jguarin200
                                -- Estamos ejecutando AxB
84 25 jguarin200
                                        aycy <= Ay;
85
                                        bzdz <= Bz;
86
                                        azcz <= Az;
87
                                        bydy <= By;
88
                                        axcx <= Ax;
89
                                        bxdx <= Bx;
90
                        end case;
91
                        case (opcode) is
92 26 jguarin200
                                -- Estamos ejecutando Producto Cruz
93
                                when '1' =>
94 25 jguarin200
                                        m0f0 <= aycy;
95
                                        m0f1 <= bzdz;
96
                                        m1f0 <= azcz;
97
                                        m1f1 <= bydy;
98
                                        m2f0 <= axcx;
99
                                        m2f1 <= bzdz;
100
                                        m3f0 <= azcz;
101
                                        m3f1 <= bxdx;
102
                                        m4f0 <= axcx;
103
                                        m4f1 <= bydy;
104
                                        m5f0 <= aycy;
105
                                        m5f1 <= bxdx;
106 24 jguarin200
                                when others =>
107 26 jguarin200
                                -- Estamos ejecutando Producto Punto
108 24 jguarin200
                                        m0f0 <= Ax;
109
                                        m0f1 <= Bx;
110
                                        m1f0 <= Ay;
111
                                        m1f1 <= By;
112
                                        m2f0 <= Az;
113
                                        m2f1 <= Bz;
114
                                        m3f0 <= Cx;
115
                                        m3f1 <= Dx;
116
                                        m4f0 <= Cy;
117
                                        m4f1 <= Dy;
118
                                        m5f0 <= Cz;
119
                                        m5f1 <= Dz;
120
                        end case;
121
                end process procOpcoder;
122
        end generate originalMuxGen;
123
        fastMuxGen:
124 25 jguarin200
        if structuralDescription="YES" generate
125 27 jguarin200
                mux0 : fastmux generic map (width) port map (ay,cy,addcode,aycy);
126
                mux1 : fastmux generic map (width) port map (bz,dz,addcode,bzdz);
127
                mux2 : fastmux generic map (width) port map (az,cz,addcode,azcz);
128
                mux3 : fastmux generic map (width) port map (by,dy,addcode,bydy);
129
                mux4 : fastmux generic map (width) port map (bx,dx,addcode,bxdx);
130
                mux5 : fastmux generic map (width) port map (ax,cx,addcode,axcx);
131 3 jguarin200
 
132 24 jguarin200
                -- Segunda etapa de multiplexores 
133 27 jguarin200
                muxa : fastmux generic map (width) port map (ax,aycy,opcode,m0f0);
134
                muxb : fastmux generic map (width) port map (bx,bzdz,opcode,m0f1);
135
                muxc : fastmux generic map (width) port map (ay,azcz,opcode,m1f0);
136
                muxd : fastmux generic map (width) port map (by,bydy,opcode,m1f1);
137
                muxe : fastmux generic map (width) port map (az,azcz,opcode,m2f0);
138
                muxf : fastmux generic map (width) port map (bz,bxdx,opcode,m2f1);
139
                muxg : fastmux generic map (width) port map (cx,axcx,opcode,m3f0);
140
                muxh : fastmux generic map (width) port map (dx,bzdz,opcode,m3f1);
141
                muxi : fastmux generic map (width) port map (cy,axcx,opcode,m4f0);
142
                muxj : fastmux generic map (width) port map (dy,bydy,opcode,m4f1);
143
                muxk : fastmux generic map (width) port map (cz,aycy,opcode,m5f0);
144
                muxl : fastmux generic map (width) port map (dz,bxdx,opcode,m5f1);
145 3 jguarin200
 
146 26 jguarin200
        end generate fastMuxGen;
147
 
148 3 jguarin200
 
149 4 jguarin200
end opcoder_arch;

powered by: WebSVN 2.1.0

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