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

Subversion Repositories raytrac

[/] [raytrac/] [branches/] [fp/] [dpc.vhd] - Blame information for rev 124

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

Line No. Rev Author Line
1 123 jguarin200
--! @file dpc.vhd
2 122 jguarin200
--! @brief Decodificador de operacion. 
3 124 jguarin200
--! @author Juli�n Andr�s Guar�n Reyes.
4 122 jguarin200
--------------------------------------------------------------
5
-- RAYTRAC
6
-- Author Julian Andres Guarin
7 123 jguarin200
-- dpc.vhd
8 122 jguarin200
-- 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
 
23
library ieee;
24
use ieee.std_logic_1164.all;
25 123 jguarin200
entity dpc is
26 122 jguarin200
        generic (
27 123 jguarin200
                width : integer := 32
28 122 jguarin200
        );
29
        port (
30 124 jguarin200
                paraminput                      : in    std_logic_vector ((12*width)-1 downto 0);                --! Vectores A,B,C,D
31 123 jguarin200
                prd32blko,add32blko : in        std_logic_vector ((06*width)-1 downto 0);        --! Salidas de los 6 multiplicadores y los 6 sumadores.
32
                sqr32blko,inv32blko     : in    std_logic_vector ((02*width)-1 downto 0);        --! Salidas de las 2 raices cuadradas y los 2 inversores.
33 124 jguarin200
                fifo32x26_q                             : in    std_logic_vector (   03*width-1 downto 0);       --! Salida de la cola intermedia.
34
                fifo32x09_q                             : in    std_logic_vector( 02*width-1 downto 0);  --! Salida de las colas de producto punto. 
35
                instr3                          : in    std_logic_vector (                       2 downto 0);                                    --! Opcode con la instrucci&oacute;n.
36
                hblock                          : in    std_logic;                                                                                                                                      --! Bit con el identificador del bloque. 
37
                fifo32x26_d                             : out   std_logic_vector (03*width-1 downto 0);  --! Entrada a la cola intermedia para la normalizaci&oacute;n.
38
                fifo32x09_d                             : out   std_logic_vector        (02*width-1 downto 0); --! Entrada a las colas intermedias del producto punto.   
39 123 jguarin200
                prd32blki,add32blki : out       std_logic_vector ((12*width)-1 downto 0);        --! Entrada de los 12 sumandos y de los 12 factores en los 2 bloques de suma y el bloque de multiplicaci&oacute;n respectivamente.
40 124 jguarin200
                add32blks                       : out   std_logic_vector (                       1 downto 0);                    --! Signos de operaci&oacute;n que entran en los 2 bloques de suma.
41
                resultoutput            : out   std_logic_vector ((06*width)-1 downto 0)                 --! 6 salidas de resultados, pues lo m&aacute;ximo que podr&aacute; calcularse por cada clock son 2 vectores. 
42 122 jguarin200
        );
43 123 jguarin200
end dpc;
44 122 jguarin200
 
45 123 jguarin200
architecture dpc_arch of dpc is
46 124 jguarin200
 
47 123 jguarin200
        constant az : integer := 00;constant ay : integer := 01;constant ax : integer := 02;constant bz : integer := 03;constant by : integer := 04;constant bx : integer := 05;
48
        constant cz : integer := 06;constant cy : integer := 07;constant cx : integer := 08;constant dz : integer := 09;constant dy : integer := 10;constant dx : integer := 11;
49
        constant f0     : integer := 00;constant f1 : integer := 01;constant f2 : integer := 02;constant f3 : integer := 03;constant f4 : integer := 04;constant f5 : integer := 05;
50
        constant f6     : integer := 06;constant f7 : integer := 07;constant f8 : integer := 08;constant f9 : integer := 09;constant f10: integer := 10;constant f11: integer := 11;
51
        constant s0     : integer := 00;constant s1 : integer := 01;constant s2 : integer := 02;constant s3 : integer := 03;constant s4 : integer := 04;constant s5 : integer := 05;
52
        constant s6     : integer := 06;constant s7 : integer := 07;constant s8 : integer := 08;constant s9 : integer := 09;constant s10: integer := 10;constant s11: integer := 11;
53
        constant a0     : integer := 00;constant a1 : integer := 01;constant a2 : integer := 02;constant aa : integer := 03;constant ab : integer := 04;constant ac : integer := 05;
54
        constant p0     : integer := 00;constant p1 : integer := 01;constant p2 : integer := 02;constant p3 : integer := 03;constant p4 : integer := 04;constant p5 : integer := 05;
55
        constant sqrt320 : integer := 00;
56
        constant sqrt321 : integer := 01;
57
        constant invr320 : integer := 00;
58
        constant invr321 : integer := 01;
59 124 jguarin200
        constant dpfifoab : integer := 00;
60
        constant dpfifocd : integer := 01;
61
 
62 122 jguarin200
 
63 123 jguarin200
        type    vectorblock12 is array (11 downto 0) of std_logic_vector(width-1 downto 0);
64
        type    vectorblock06 is array (05 downto 0) of std_logic_vector(width-1 downto 0);
65 124 jguarin200
        type    vectorblock03 is array (02 downto 0) of std_logic_vector(width-1 downto 0);
66 123 jguarin200
        type    vectorblock02 is array (01 downto 0) of std_logic_vector(width-1 downto 0);
67 122 jguarin200
 
68 123 jguarin200
        signal  sparaminput,sfactor,ssumando    : vectorblock12;
69
        signal  sprd32blk,sadd32blk,sresult     : vectorblock06;
70 124 jguarin200
        signal snormfifo_q,snormfifo_d  : vectorblock03;
71
        signal  ssqr32blk,sinv32blk,sdpfifo_q : vectorblock02;
72
 
73 123 jguarin200
 
74
 
75
begin
76 122 jguarin200
 
77 123 jguarin200
        --! Connect stuff ....
78
        stuff12:
79
        for i in 11 downto 0 generate
80
                sparaminput(i) <= paraminput(i*width+width-1 downto i*width);
81
                prd32blki(i*width+width-1 downto i*width) <= sfactor(i);
82
                add32blki(i*width+width-1 downto i*width) <= ssumando(i);
83
        end generate stuff12;
84
        stuff06:
85
        for i in 05 downto 0 generate
86
                sprd32blk(i)  <= prd32blko(i*width+width-1 downto i*width);
87
                sadd32blk(i)  <= add32blko(i*width+width-1 downto i*width);
88
                resultoutput(i*width+width-1 downto i*width) <= sresult(i);
89
        end generate stuff06;
90 124 jguarin200
        stuff03:
91
        for i in 02 downto 0 generate
92
                snormfifo_q(i) <= fifo32x26_q(i*width+width-1 downto i*width);
93
                fifo32x26_d(i*width+width-1 downto i*width) <= snormfifo_d(i);
94
        end generate stuff03;
95
 
96 123 jguarin200
        stuff02:
97 124 jguarin200
        for i in 01 downto 0 generate
98 123 jguarin200
                ssqr32blk(i)  <= sqr32blko(i*width+width-1 downto i*width);
99
                sinv32blk(i)  <= inv32blko(i*width+width-1 downto i*width);
100
        end generate stuff02;
101 124 jguarin200
        fifo32x09_d <= sprd32blk(p3)&sprd32blk(p2);
102
 
103 122 jguarin200
 
104 124 jguarin200
        interconnection_factors:process(instr3,hblock)
105 123 jguarin200
        begin
106 124 jguarin200
 
107
                --! Por defecto conectar el producto punto
108
                --! Multiplicadores
109
                sfactor(f0) <= sparaminput(ax);sfactor(f1) <= sparaminput(bx);sfactor(f2) <= sparaminput(ay);sfactor(f3) <= sparaminput(by);
110
                sfactor(f4) <= sparaminput(az);sfactor(f5) <= sparaminput(bz);sfactor(f6) <= sparaminput(cx);sfactor(f7) <= sparaminput(dx);
111
                sfactor(f8) <= sparaminput(cy);sfactor(f9) <= sparaminput(dy);sfactor(f10) <= sparaminput(cz);sfactor(f11) <= sparaminput(dz);
112
                --! Sumadores
113
                ssumando(s0) <= sprd32blk(p0);ssumando(s1) <= sprd32blk(p1);ssumando(s6) <= sadd32blk(a0);ssumando(s7) <= sdpfifo_q(dpfifoab);
114
                ssumando(s10) <= sdpfifo_q(dpfifocd);ssumando(s11) <=  sadd32blk(a2);ssumando(s4) <= sprd32blk(p4);ssumando(s5) <= sprd32blk(p5);
115
                ssumando(s2) <= (others => '0');ssumando(s3) <= (others => '0');ssumando(s8) <= (others => '0');ssumando(s9) <= (others => '0');
116
                --!Signos
117
                add32blks <= "00";
118
                --!Resultados
119
                sresult(ax) <= sadd32blk(aa);
120
                sresult(bx) <= sadd32blk(ac);
121
 
122
                --!Factores de los multiplicadores. 
123
                case (instr3&hblock) is
124
                        when "0011"  =>
125
                                --!Multiplicadores: 
126
                                sfactor(f0) <= sparaminput(cy);sfactor(f1) <= sparaminput(dz);sfactor(f2) <= sparaminput(cz);   sfactor(f3) <= sparaminput(dy);
127
                                sfactor(f4) <= sparaminput(cx);sfactor(f5) <= sparaminput(dz);sfactor(f6) <= sparaminput(cz);sfactor(f7) <= sparaminput(dx);
128
                                sfactor(f8) <= sparaminput(cx);sfactor(f9) <= sparaminput(dy);sfactor(f10) <= sparaminput(cy);sfactor(f11) <= sparaminput(dx);
129
                        when "0010" =>
130
                                sfactor(f0) <= sparaminput(ay);sfactor(f1) <= sparaminput(bz);sfactor(f2) <= sparaminput(az);sfactor(f3) <= sparaminput(by);
131
                                sfactor(f4) <= sparaminput(ax);sfactor(f5) <= sparaminput(bz);sfactor(f6) <= sparaminput(az);sfactor(f7) <= sparaminput(bx);
132
                                sfactor(f8) <= sparaminput(ax);sfactor(f9) <= sparaminput(by);sfactor(f10) <= sparaminput(ay);sfactor(f11) <= sparaminput(bx);
133
                        when others =>
134
                end case;
135 123 jguarin200
                case (instr3) is
136 124 jguarin200
                        when ""
137
                                --! Sumadores
138
                                ssumando(s0) <= sprd32blk(p0);ssumando(s1) <= sprd32blk(p1);ssumando(s2) <= sprd32blk(p2);ssumando(s3) <= sprd32blk(p3);
139
                                ssumando(s10) <= sdpfifo_q(dpfifocd);ssumando(s11) <=  sadd32blk(a2);ssumando(s4) <= sprd32blk(p4);ssumando(s5) <= sprd32blk(p5);
140
                                --!Signos
141
                                add32blks <= "10";
142
                                --!Resultados
143
                                sresult(ax) <= sadd32blk(a0);
144
                                sresult(ay) <= sadd32blk(a1);
145
                                sresult(az) <= sadd32blk(a2);
146
 
147
                        when "suma"  =>
148
 
149
 
150
 
151
 
152
 
153
 
154
 
155
 
156
 
157
                end case;
158
 
159 123 jguarin200
        end process;
160
 
161
 
162
end dpc_arch;

powered by: WebSVN 2.1.0

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