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

Subversion Repositories raytrac

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

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

Line No. Rev Author Line
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 20 jguarin200
--! The opcoder entity is the operation decoder combinatorial stage. \n La entidad opcoder es la etapa combinatoria que decodifica la operacion que se va a realizar.
28
 
29
--! The inputs to this hardware are: A,B,C,D vectors, opcode and add code inputs. The outputs are the operands of the 6 multipliers an uf entity has. The multipliers operands, also known as factors are m0f0 and m0f1 for the multiplier 0, m1f0 and m1f1 for the multiplier 1.. and so on until the multiplier 5. Basically what operates here in this description is a mux, which selects through opcode and addcode what vector components are going to be the multipliers operands.\n So if the opcode value is 0, it means that a dot product is to be done, so the m0f0 and m0f1 are going to be Ax and Bx respectively, and so on. If opcode is 1, it means that a cross product is to be performed, but the UF has only capacity to make a single cross product at --! the same time, meaning it will perform AxB OR CxD exclusively.\n\n In order to understand check the following table:   
30
 
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
architecture opcoder_arch of opcoder is
41
 
42
 
43
begin
44
 
45 14 jguarin200
        procOpcoder:
46 3 jguarin200
        process (Ax,Bx,Cx,Dx,Ay,By,Cy,Dy,Az,Bz,Cz,Dz,opcode,addcode)
47
                variable scoder : std_logic_vector (1 downto 0);
48
        begin
49
                scoder := opcode & addcode;
50
                case (scoder) is
51
                        when "10" =>
52
                                m0f0 <= Ay;
53
                                m0f1 <= Bz;
54
                                m1f0 <= Az;
55
                                m1f1 <= By;
56
                                m2f0 <= Az;
57
                                m2f1 <= Bx;
58
                                m3f0 <= Ax;
59
                                m3f1 <= Bz;
60
                                m4f0 <= Ax;
61
                                m4f1 <= By;
62
                                m5f0 <= Ay;
63
                                m5f1 <= Bx;
64
                        when "11" =>
65
                                m0f0 <= Cy;
66
                                m0f1 <= Dz;
67
                                m1f0 <= Cz;
68
                                m1f1 <= Dy;
69
                                m2f0 <= Cz;
70
                                m2f1 <= Dx;
71
                                m3f0 <= Cx;
72
                                m3f1 <= Dz;
73
                                m4f0 <= Cx;
74
                                m4f1 <= Dy;
75
                                m5f0 <= Cy;
76
                                m5f1 <= Dx;
77
                        when others =>
78 14 jguarin200
                                m0f0 <= Ax;
79
                                m0f1 <= Bx;
80
                                m1f0 <= Ay;
81
                                m1f1 <= By;
82
                                m2f0 <= Az;
83
                                m2f1 <= Bz;
84
                                m3f0 <= Cx;
85
                                m3f1 <= Dx;
86
                                m4f0 <= Cy;
87
                                m4f1 <= Dy;
88
                                m5f0 <= Cz;
89
                                m5f1 <= Dz;
90
 
91 3 jguarin200
                end case;
92 4 jguarin200
 
93 3 jguarin200
 
94
 
95
 
96
 
97 14 jguarin200
        end process procOpcoder;
98 3 jguarin200
 
99
 
100 4 jguarin200
end opcoder_arch;

powered by: WebSVN 2.1.0

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