1 |
20 |
jguarin200 |
--! @file opcoder.vhd
|
2 |
|
|
--! @brief Operation decoder. \n Decodificador de operacion.
|
3 |
|
|
--------------------------------------------------------------
|
4 |
16 |
jguarin200 |
-- RAYTRAC
|
5 |
|
|
-- Author Julian Andres Guarin
|
6 |
|
|
-- opcoder.vhd
|
7 |
|
|
-- This file is part of raytrac.
|
8 |
|
|
--
|
9 |
|
|
-- raytrac is free software: you can redistribute it and/or modify
|
10 |
|
|
-- it under the terms of the GNU General Public License as published by
|
11 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
12 |
|
|
-- (at your option) any later version.
|
13 |
|
|
--
|
14 |
|
|
-- raytrac is distributed in the hope that it will be useful,
|
15 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
-- GNU General Public License for more details.
|
18 |
|
|
--
|
19 |
|
|
-- You should have received a copy of the GNU General Public License
|
20 |
|
|
-- along with raytrac. If not, see <http://www.gnu.org/licenses/>.
|
21 |
20 |
jguarin200 |
--! Libreria ieee. 'n Good oldie IEEE.
|
22 |
3 |
jguarin200 |
library ieee;
|
23 |
20 |
jguarin200 |
|
24 |
|
|
--! Paquete de manejo de logica estandard. \n Standard logic managment package.
|
25 |
3 |
jguarin200 |
use ieee.std_logic_1164.all;
|
26 |
|
|
|
27 |
21 |
jguarin200 |
--! La entidad opcoder es la etapa combinatoria que decodifica la operacion que se va a realizar.
|
28 |
20 |
jguarin200 |
|
29 |
21 |
jguarin200 |
--! \n\n
|
30 |
|
|
--! Las entradas a esta descripción son: los vectores A,B,C,D, las entradas opcode y addcode. Las salidas del decodificador, estarán conectadas a las entradas de los 6 multiplicadores de una entidad uf. Los operandos de los multiplicadores, también conocidos como factores, son las salida m0f0, m0f1 para el multiplicador 1 y así hasta el multiplicador 5. Básicamente lo que opera aquí en esta descripción es un multiplexor, el cual selecciona a través de opcode y addcode qué componentes de los vectores se conectaran a los operandos de los multiplicadores.
|
31 |
3 |
jguarin200 |
entity opcoder is
|
32 |
7 |
jguarin200 |
port (
|
33 |
3 |
jguarin200 |
Ax,Bx,Cx,Dx,Ay,By,Cy,Dy,Az,Bz,Cz,Dz : in std_logic_vector (17 downto 0);
|
34 |
12 |
jguarin200 |
m0f0,m0f1,m1f0,m1f1,m2f0,m2f1,m3f0,m3f1,m4f0,m4f1,m5f0,m5f1 : out std_logic_vector (17 downto 0);
|
35 |
14 |
jguarin200 |
|
36 |
3 |
jguarin200 |
opcode,addcode : in std_logic
|
37 |
|
|
);
|
38 |
|
|
end entity;
|
39 |
|
|
|
40 |
21 |
jguarin200 |
--! El bloque de arquitectura del decodificador es simplemente una cascada de multiplexores. La selección se hace en función de las señales appcode y addcode\n
|
41 |
|
|
--! La siguiente tabla describe el comportamiento de los multiplexores:\n
|
42 |
|
|
--! \n\n
|
43 |
|
|
|
44 |
|
|
--!
|
45 |
|
|
--! <table>
|
46 |
|
|
--! <tr><th></th><th>OPCODE</th><th>ADDCODE</th><th>f0</th><th>f1</th><th> </th><th>OPCODE</th><th>ADDCODE</th><th>f0</th><th>f1</th><th> </th></tr> <tr><td>m0</td><td>0</td><td>0</td><td>Ax</td><td>Bx</td><td> </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> </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> </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> </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> </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> </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> </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> </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> </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> </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> </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> </td><td>1</td><td>1</td><td>Cy</td><td>Dx</td><td>m5</td></tr></table>
|
47 |
|
|
|
48 |
|
|
|
49 |
3 |
jguarin200 |
architecture opcoder_arch of opcoder is
|
50 |
|
|
|
51 |
|
|
begin
|
52 |
|
|
|
53 |
14 |
jguarin200 |
procOpcoder:
|
54 |
3 |
jguarin200 |
process (Ax,Bx,Cx,Dx,Ay,By,Cy,Dy,Az,Bz,Cz,Dz,opcode,addcode)
|
55 |
|
|
variable scoder : std_logic_vector (1 downto 0);
|
56 |
|
|
begin
|
57 |
|
|
scoder := opcode & addcode;
|
58 |
|
|
case (scoder) is
|
59 |
|
|
when "10" =>
|
60 |
|
|
m0f0 <= Ay;
|
61 |
|
|
m0f1 <= Bz;
|
62 |
|
|
m1f0 <= Az;
|
63 |
|
|
m1f1 <= By;
|
64 |
|
|
m2f0 <= Az;
|
65 |
|
|
m2f1 <= Bx;
|
66 |
|
|
m3f0 <= Ax;
|
67 |
|
|
m3f1 <= Bz;
|
68 |
|
|
m4f0 <= Ax;
|
69 |
|
|
m4f1 <= By;
|
70 |
|
|
m5f0 <= Ay;
|
71 |
|
|
m5f1 <= Bx;
|
72 |
|
|
when "11" =>
|
73 |
|
|
m0f0 <= Cy;
|
74 |
|
|
m0f1 <= Dz;
|
75 |
|
|
m1f0 <= Cz;
|
76 |
|
|
m1f1 <= Dy;
|
77 |
|
|
m2f0 <= Cz;
|
78 |
|
|
m2f1 <= Dx;
|
79 |
|
|
m3f0 <= Cx;
|
80 |
|
|
m3f1 <= Dz;
|
81 |
|
|
m4f0 <= Cx;
|
82 |
|
|
m4f1 <= Dy;
|
83 |
|
|
m5f0 <= Cy;
|
84 |
|
|
m5f1 <= Dx;
|
85 |
|
|
when others =>
|
86 |
14 |
jguarin200 |
m0f0 <= Ax;
|
87 |
|
|
m0f1 <= Bx;
|
88 |
|
|
m1f0 <= Ay;
|
89 |
|
|
m1f1 <= By;
|
90 |
|
|
m2f0 <= Az;
|
91 |
|
|
m2f1 <= Bz;
|
92 |
|
|
m3f0 <= Cx;
|
93 |
|
|
m3f1 <= Dx;
|
94 |
|
|
m4f0 <= Cy;
|
95 |
|
|
m4f1 <= Dy;
|
96 |
|
|
m5f0 <= Cz;
|
97 |
|
|
m5f1 <= Dz;
|
98 |
|
|
|
99 |
3 |
jguarin200 |
end case;
|
100 |
4 |
jguarin200 |
|
101 |
3 |
jguarin200 |
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
14 |
jguarin200 |
end process procOpcoder;
|
106 |
3 |
jguarin200 |
|
107 |
|
|
|
108 |
4 |
jguarin200 |
end opcoder_arch;
|