| 1 |
123 |
jguarin200 |
--! @file dpc.vhd
|
| 2 |
122 |
jguarin200 |
--! @brief Decodificador de operacion.
|
| 3 |
128 |
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 |
134 |
jguarin200 |
|
| 26 |
123 |
jguarin200 |
entity dpc is
|
| 27 |
122 |
jguarin200 |
generic (
|
| 28 |
132 |
jguarin200 |
width : integer := 32
|
| 29 |
|
|
--!external_readable_widthad : integer := integer(ceil(log(real(external_readable_blocks),2.0))))
|
| 30 |
122 |
jguarin200 |
);
|
| 31 |
|
|
port (
|
| 32 |
140 |
jguarin200 |
clk,ena,rst : in std_logic;
|
| 33 |
127 |
jguarin200 |
paraminput : in std_logic_vector ((12*width)-1 downto 0); --! Vectores A,B,C,D
|
| 34 |
|
|
prd32blko : in std_logic_vector ((06*width)-1 downto 0); --! Salidas de los 6 multiplicadores.
|
| 35 |
|
|
add32blko : in std_logic_vector ((04*width)-1 downto 0); --! Salidas de los 4 sumadores.
|
| 36 |
136 |
jguarin200 |
sqr32blko,inv32blko : in std_logic_vector (width-1 downto 0); --! Salidas de la raiz cuadradas y el inversor.
|
| 37 |
138 |
jguarin200 |
fifo32x23_q : in std_logic_vector (03*width-1 downto 0); --! Salida de la cola intermedia.
|
| 38 |
127 |
jguarin200 |
fifo32x09_q : in std_logic_vector (02*width-1 downto 0); --! Salida de las colas de producto punto.
|
| 39 |
|
|
unary,crossprod,addsub : in std_logic; --! Bit con el identificador del bloque AB vs CD e identificador del sub bloque (A/B) o (C/D).
|
| 40 |
|
|
scalar : in std_logic;
|
| 41 |
136 |
jguarin200 |
sqr32blki,inv32blki : out std_logic_vector (width-1 downto 0); --! Salidas de las 2 raices cuadradas y los 2 inversores.
|
| 42 |
127 |
jguarin200 |
fifo32x26_d : out std_logic_vector (03*width-1 downto 0); --! Entrada a la cola intermedia para la normalización.
|
| 43 |
|
|
fifo32x09_d : out std_logic_vector (02*width-1 downto 0); --! Entrada a las colas intermedias del producto punto.
|
| 44 |
|
|
prd32blki : out std_logic_vector ((12*width)-1 downto 0); --! Entrada de los 12 factores en el bloque de multiplicación respectivamente.
|
| 45 |
|
|
add32blki : out std_logic_vector ((08*width)-1 downto 0); --! Entrada de los 8 sumandos del bloque de 4 sumadores.
|
| 46 |
140 |
jguarin200 |
res567w,res13w,res2w,res0w,res4w,fifo32x09_w,fifo32x23_w,fifo32x09_r,fifo32x23_r: out std_logic;
|
| 47 |
|
|
resultoutput : out std_logic_vector ((08*width)-1 downto 0) --! 8 salidas de resultados, pues lo máximo que podrá calcularse por cada clock son 2 vectores.
|
| 48 |
122 |
jguarin200 |
);
|
| 49 |
123 |
jguarin200 |
end dpc;
|
| 50 |
122 |
jguarin200 |
|
| 51 |
123 |
jguarin200 |
architecture dpc_arch of dpc is
|
| 52 |
125 |
jguarin200 |
|
| 53 |
|
|
constant qz : integer := 00;constant qy : integer := 01;constant qx : integer := 02;
|
| 54 |
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;
|
| 55 |
|
|
constant cz : integer := 06;constant cy : integer := 07;constant cx : integer := 08;constant dz : integer := 09;constant dy : integer := 10;constant dx : integer := 11;
|
| 56 |
|
|
constant f0 : integer := 00;constant f1 : integer := 01;constant f2 : integer := 02;constant f3 : integer := 03;constant f4 : integer := 04;constant f5 : integer := 05;
|
| 57 |
|
|
constant f6 : integer := 06;constant f7 : integer := 07;constant f8 : integer := 08;constant f9 : integer := 09;constant f10: integer := 10;constant f11: integer := 11;
|
| 58 |
|
|
constant s0 : integer := 00;constant s1 : integer := 01;constant s2 : integer := 02;constant s3 : integer := 03;constant s4 : integer := 04;constant s5 : integer := 05;
|
| 59 |
127 |
jguarin200 |
constant s6 : integer := 06;constant s7 : integer := 07;
|
| 60 |
|
|
constant a0 : integer := 00;constant a1 : integer := 01;constant a2 : integer := 02;constant aa : integer := 03;
|
| 61 |
123 |
jguarin200 |
constant p0 : integer := 00;constant p1 : integer := 01;constant p2 : integer := 02;constant p3 : integer := 03;constant p4 : integer := 04;constant p5 : integer := 05;
|
| 62 |
127 |
jguarin200 |
|
| 63 |
124 |
jguarin200 |
constant dpfifoab : integer := 00;
|
| 64 |
|
|
constant dpfifocd : integer := 01;
|
| 65 |
|
|
|
| 66 |
122 |
jguarin200 |
|
| 67 |
123 |
jguarin200 |
type vectorblock12 is array (11 downto 0) of std_logic_vector(width-1 downto 0);
|
| 68 |
127 |
jguarin200 |
type vectorblock08 is array (07 downto 0) of std_logic_vector(width-1 downto 0);
|
| 69 |
123 |
jguarin200 |
type vectorblock06 is array (05 downto 0) of std_logic_vector(width-1 downto 0);
|
| 70 |
127 |
jguarin200 |
type vectorblock04 is array (03 downto 0) of std_logic_vector(width-1 downto 0);
|
| 71 |
124 |
jguarin200 |
type vectorblock03 is array (02 downto 0) of std_logic_vector(width-1 downto 0);
|
| 72 |
123 |
jguarin200 |
type vectorblock02 is array (01 downto 0) of std_logic_vector(width-1 downto 0);
|
| 73 |
122 |
jguarin200 |
|
| 74 |
127 |
jguarin200 |
|
| 75 |
|
|
signal sparaminput,sfactor : vectorblock12;
|
| 76 |
|
|
signal ssumando,sresult : vectorblock08;
|
| 77 |
|
|
signal sprd32blk : vectorblock06;
|
| 78 |
|
|
signal sadd32blk : vectorblock04;
|
| 79 |
125 |
jguarin200 |
signal snormfifo_q,snormfifo_d : vectorblock03;
|
| 80 |
127 |
jguarin200 |
signal sdpfifo_q : vectorblock02;
|
| 81 |
|
|
signal ssqr32blk,sinv32blk : std_logic_vector(width-1 downto 0);
|
| 82 |
123 |
jguarin200 |
|
| 83 |
140 |
jguarin200 |
signal sync_chain : std_logic_vector(27 downto 0);
|
| 84 |
|
|
signal sync_chain_d : std_logic;
|
| 85 |
|
|
constant rstMasterValue : std_logic := '0';
|
| 86 |
|
|
|
| 87 |
123 |
jguarin200 |
begin
|
| 88 |
122 |
jguarin200 |
|
| 89 |
140 |
jguarin200 |
--! Cadena de sincronización: 28 posiciones.
|
| 90 |
|
|
sync_chain_proc:
|
| 91 |
|
|
process(clk,rst)
|
| 92 |
|
|
begin
|
| 93 |
|
|
if rst=rstMasterValue then
|
| 94 |
|
|
sync_chain <= (others => '0');
|
| 95 |
|
|
elsif clk'event and clk='1' then
|
| 96 |
|
|
sync_chain(0) <= sync_chain_d;
|
| 97 |
|
|
for i in 27 downto 1 loop
|
| 98 |
|
|
sync_chain(i) <= sync_chain(i-1);
|
| 99 |
|
|
end loop;
|
| 100 |
|
|
end if;
|
| 101 |
|
|
end process sync_chain_proc;
|
| 102 |
|
|
--! Escritura en las colas de resultados y escritura/lectura en las colas intermedias mediante cadena de resultados.
|
| 103 |
|
|
fifo32x09_w <= sync_chain(4);
|
| 104 |
|
|
fifo32x23_w <= sync_chain(0);
|
| 105 |
|
|
fifo32x09_r <= sync_chain();
|
| 106 |
|
|
fifo32x23_r <= sync_chain();
|
| 107 |
127 |
jguarin200 |
|
| 108 |
140 |
jguarin200 |
res0w <= sync_chain(22);
|
| 109 |
|
|
res4w <= sync_chain(20);
|
| 110 |
|
|
sync_chain_comb:
|
| 111 |
|
|
process (sync_chain,addsub,crossprod)
|
| 112 |
|
|
begin
|
| 113 |
|
|
if unary='1' then
|
| 114 |
|
|
res567w <= sync_chain(27);
|
| 115 |
|
|
else
|
| 116 |
|
|
res567w <= sync_chain(3);
|
| 117 |
|
|
end if;
|
| 118 |
127 |
jguarin200 |
|
| 119 |
140 |
jguarin200 |
if addsub='1' then
|
| 120 |
|
|
res13w <= sync_chain(8);
|
| 121 |
|
|
res2w <= sync_chain(8);
|
| 122 |
|
|
else
|
| 123 |
|
|
res13w <= sync_chain(12);
|
| 124 |
|
|
if crossprod='1' then
|
| 125 |
|
|
res2w <= res13w;
|
| 126 |
|
|
else
|
| 127 |
|
|
res2w <= sync_chain(21);
|
| 128 |
|
|
end if;
|
| 129 |
|
|
end if;
|
| 130 |
|
|
end process sync_chain_comb;
|
| 131 |
|
|
|
| 132 |
|
|
|
| 133 |
|
|
--! El siguiente código sirve para conectar arreglos a señales std_logic_1164, simplemente son abstracciones a nivel de código y no representará cambios en la síntesis.
|
| 134 |
123 |
jguarin200 |
stuff12:
|
| 135 |
|
|
for i in 11 downto 0 generate
|
| 136 |
|
|
sparaminput(i) <= paraminput(i*width+width-1 downto i*width);
|
| 137 |
|
|
prd32blki(i*width+width-1 downto i*width) <= sfactor(i);
|
| 138 |
127 |
jguarin200 |
end generate stuff12;
|
| 139 |
|
|
stuff08:
|
| 140 |
|
|
for i in 07 downto 0 generate
|
| 141 |
123 |
jguarin200 |
add32blki(i*width+width-1 downto i*width) <= ssumando(i);
|
| 142 |
127 |
jguarin200 |
resultoutput(i*width+width-1 downto i*width) <= sresult(i);
|
| 143 |
|
|
end generate stuff08;
|
| 144 |
138 |
jguarin200 |
stuff04:
|
| 145 |
|
|
for i in 03 downto 1 generate
|
| 146 |
|
|
sadd32blk(i) <= add32blko(i*width+width-1 downto i*width);
|
| 147 |
|
|
end generate stuff04;
|
| 148 |
|
|
|
| 149 |
|
|
|
| 150 |
124 |
jguarin200 |
stuff03:
|
| 151 |
|
|
for i in 02 downto 0 generate
|
| 152 |
138 |
jguarin200 |
snormfifo_q(i) <= fifo32x23_q(i*width+width-1 downto i*width);
|
| 153 |
124 |
jguarin200 |
fifo32x26_d(i*width+width-1 downto i*width) <= snormfifo_d(i);
|
| 154 |
|
|
end generate stuff03;
|
| 155 |
|
|
|
| 156 |
123 |
jguarin200 |
stuff02:
|
| 157 |
127 |
jguarin200 |
for i in 01 downto 0 generate
|
| 158 |
|
|
sdpfifo_q(i) <= fifo32x09_q(i*width+width-1 downto i*width);
|
| 159 |
123 |
jguarin200 |
end generate stuff02;
|
| 160 |
140 |
jguarin200 |
|
| 161 |
|
|
--! El siguiente código sirve para conectar arreglos a señales std_logic_1164, son abstracciones de código también, sin embargo se realizan a través de registros.
|
| 162 |
|
|
register_products_outputs:
|
| 163 |
|
|
process (clk)
|
| 164 |
|
|
begin
|
| 165 |
|
|
if clk'event and clk='1' then
|
| 166 |
|
|
for i in 05 downto 0 loop
|
| 167 |
|
|
sprd32blk(i) <= prd32blko(i*width+width-1 downto i*width);
|
| 168 |
|
|
end loop;
|
| 169 |
|
|
end if;
|
| 170 |
|
|
end process;
|
| 171 |
|
|
--! Los productos del multiplicador 2 y 3, ya registrados dentro de dpc van a la cola intermedia del producto punto (fifo32x09_d)
|
| 172 |
124 |
jguarin200 |
fifo32x09_d <= sprd32blk(p3)&sprd32blk(p2);
|
| 173 |
140 |
jguarin200 |
register_adder0_and_inversor_output:
|
| 174 |
|
|
process (clk)
|
| 175 |
|
|
begin
|
| 176 |
|
|
if clk'event and clk='1' then
|
| 177 |
|
|
sadd32blk(a0) <= add32blko(a0*width+width-1 downto a0*width);
|
| 178 |
|
|
sinv32blk <= inv32blko;
|
| 179 |
|
|
end if;
|
| 180 |
|
|
end process;
|
| 181 |
122 |
jguarin200 |
|
| 182 |
127 |
jguarin200 |
|
| 183 |
|
|
|
| 184 |
140 |
jguarin200 |
|
| 185 |
|
|
|
| 186 |
127 |
jguarin200 |
ssqr32blk <= sqr32blko;
|
| 187 |
|
|
|
| 188 |
136 |
jguarin200 |
--! Colas de salida de los distintos resultados;
|
| 189 |
127 |
jguarin200 |
sresult(0) <= ssqr32blk;
|
| 190 |
|
|
sresult(1) <= sadd32blk(a0);
|
| 191 |
|
|
sresult(2) <= sadd32blk(a1);
|
| 192 |
|
|
sresult(3) <= sadd32blk(a2);
|
| 193 |
|
|
sresult(4) <= sadd32blk(aa);
|
| 194 |
|
|
sresult(5) <= sprd32blk(p3);
|
| 195 |
|
|
sresult(6) <= sprd32blk(p4);
|
| 196 |
|
|
sresult(7) <= sprd32blk(p5);
|
| 197 |
|
|
|
| 198 |
|
|
--! Cola de normalizacion
|
| 199 |
|
|
snormfifo_d(qx) <= sparaminput(ax);
|
| 200 |
|
|
snormfifo_d(qy) <= sparaminput(ay);
|
| 201 |
|
|
snormfifo_d(qz) <= sparaminput(az);
|
| 202 |
|
|
|
| 203 |
|
|
|
| 204 |
|
|
|
| 205 |
136 |
jguarin200 |
--! La entrada al inversor SIEMPRE viene con la salida de la raiz cuadrada
|
| 206 |
|
|
inv32blki <= sqr32blko;
|
| 207 |
139 |
jguarin200 |
--! La entrada de la ra�z cuadrada SIEMPRE viene con la salida del sumador 1.
|
| 208 |
136 |
jguarin200 |
sqr32blki <= sadd32blk(a1);
|
| 209 |
127 |
jguarin200 |
|
| 210 |
|
|
|
| 211 |
136 |
jguarin200 |
|
| 212 |
|
|
--! Conectar las entradas del sumador a, a la salida
|
| 213 |
|
|
ssumando(s6) <= sadd32blk(a2);
|
| 214 |
|
|
ssumando(s7) <= sdpfifo_q(dpfifocd);
|
| 215 |
|
|
|
| 216 |
|
|
|
| 217 |
132 |
jguarin200 |
mul:process(unary,addsub,crossprod,scalar,sparaminput,sinv32blk,sprd32blk,sadd32blk,sdpfifo_q,snormfifo_q)
|
| 218 |
123 |
jguarin200 |
begin
|
| 219 |
124 |
jguarin200 |
|
| 220 |
|
|
|
| 221 |
127 |
jguarin200 |
if unary='1' then
|
| 222 |
|
|
--! Magnitud y normalizacion
|
| 223 |
|
|
sfactor(f0) <= sparaminput(ax);
|
| 224 |
|
|
sfactor(f1) <= sparaminput(ax);
|
| 225 |
|
|
sfactor(f2) <= sparaminput(ay);
|
| 226 |
|
|
sfactor(f3) <= sparaminput(ay);
|
| 227 |
|
|
sfactor(f4) <= sparaminput(az);
|
| 228 |
|
|
sfactor(f5) <= sparaminput(az);
|
| 229 |
|
|
sfactor(f6) <= snormfifo_q(ax);
|
| 230 |
|
|
sfactor(f7) <= sinv32blk;
|
| 231 |
|
|
sfactor(f8) <= snormfifo_q(ay);
|
| 232 |
|
|
sfactor(f9) <= sinv32blk;
|
| 233 |
|
|
sfactor(f10) <= snormfifo_q(az);
|
| 234 |
|
|
sfactor(f11) <= sinv32blk;
|
| 235 |
129 |
jguarin200 |
elsif crossprod='1' then
|
| 236 |
127 |
jguarin200 |
--! Solo productos punto
|
| 237 |
|
|
sfactor(f0) <= sparaminput(ay);
|
| 238 |
|
|
sfactor(f1) <= sparaminput(bz);
|
| 239 |
|
|
sfactor(f2) <= sparaminput(az);
|
| 240 |
|
|
sfactor(f3) <= sparaminput(by);
|
| 241 |
|
|
sfactor(f4) <= sparaminput(az);
|
| 242 |
|
|
sfactor(f5) <= sparaminput(bx);
|
| 243 |
|
|
sfactor(f6) <= sparaminput(ax);
|
| 244 |
|
|
sfactor(f7) <= sparaminput(bz);
|
| 245 |
|
|
sfactor(f8) <= sparaminput(ax);
|
| 246 |
|
|
sfactor(f9) <= sparaminput(by);
|
| 247 |
|
|
sfactor(f10) <= sparaminput(ay);
|
| 248 |
|
|
sfactor(f11) <= sparaminput(bx);
|
| 249 |
129 |
jguarin200 |
elsif scalar='0' then --! Producto punto
|
| 250 |
127 |
jguarin200 |
sfactor(f0) <= sparaminput(ax) ;
|
| 251 |
|
|
sfactor(f1) <= sparaminput(bx) ;
|
| 252 |
|
|
sfactor(f2) <= sparaminput(ay) ;
|
| 253 |
|
|
sfactor(f3) <= sparaminput(by) ;
|
| 254 |
|
|
sfactor(f4) <= sparaminput(az) ;
|
| 255 |
|
|
sfactor(f5) <= sparaminput(bz) ;
|
| 256 |
|
|
sfactor(f6) <= sparaminput(cx) ;
|
| 257 |
|
|
sfactor(f7) <= sparaminput(dx) ;
|
| 258 |
|
|
sfactor(f8) <= sparaminput(cy) ;
|
| 259 |
|
|
sfactor(f9) <= sparaminput(dy) ;
|
| 260 |
|
|
sfactor(f10) <= sparaminput(cz) ;
|
| 261 |
|
|
sfactor(f11) <= sparaminput(dz) ;
|
| 262 |
|
|
else
|
| 263 |
|
|
sfactor(f0) <= sparaminput(ax) ;
|
| 264 |
|
|
sfactor(f1) <= sparaminput(bx) ;
|
| 265 |
|
|
sfactor(f2) <= sparaminput(ay) ;
|
| 266 |
|
|
sfactor(f3) <= sparaminput(by) ;
|
| 267 |
|
|
sfactor(f4) <= sparaminput(az) ;
|
| 268 |
|
|
sfactor(f5) <= sparaminput(bz) ;
|
| 269 |
|
|
sfactor(f6) <= sparaminput(cx) ;
|
| 270 |
|
|
sfactor(f7) <= sparaminput(dx) ;
|
| 271 |
|
|
sfactor(f8) <= sparaminput(cy) ;
|
| 272 |
|
|
sfactor(f9) <= sparaminput(dx) ;
|
| 273 |
|
|
sfactor(f10) <= sparaminput(cz) ;
|
| 274 |
|
|
sfactor(f11) <= sparaminput(dx) ;
|
| 275 |
126 |
jguarin200 |
|
| 276 |
125 |
jguarin200 |
end if;
|
| 277 |
127 |
jguarin200 |
|
| 278 |
136 |
jguarin200 |
|
| 279 |
127 |
jguarin200 |
if addsub='1' then
|
| 280 |
|
|
ssumando(s0) <= sparaminput(ax);
|
| 281 |
|
|
ssumando(s1) <= sparaminput(bx);
|
| 282 |
|
|
ssumando(s2) <= sparaminput(ay);
|
| 283 |
|
|
ssumando(s3) <= sparaminput(by);
|
| 284 |
|
|
ssumando(s4) <= sparaminput(az);
|
| 285 |
|
|
ssumando(s5) <= sparaminput(bz);
|
| 286 |
|
|
else
|
| 287 |
|
|
ssumando(s0) <= sprd32blk(p0);
|
| 288 |
|
|
ssumando(s1) <= sprd32blk(p1);
|
| 289 |
132 |
jguarin200 |
if crossprod='0' then
|
| 290 |
|
|
ssumando(s2) <= sadd32blk(a0);
|
| 291 |
|
|
ssumando(s3) <= sdpfifo_q(dpfifoab);
|
| 292 |
|
|
else
|
| 293 |
|
|
ssumando(s2) <= sprd32blk(p2);
|
| 294 |
|
|
ssumando(s3) <= sprd32blk(p3);
|
| 295 |
|
|
end if;
|
| 296 |
127 |
jguarin200 |
ssumando(s4) <= sprd32blk(p4);
|
| 297 |
|
|
ssumando(s5) <= sprd32blk(p5);
|
| 298 |
|
|
end if;
|
| 299 |
123 |
jguarin200 |
end process;
|
| 300 |
|
|
|
| 301 |
|
|
|
| 302 |
127 |
jguarin200 |
|
| 303 |
|
|
|
| 304 |
|
|
-- interconnection:process(instr3,hblockslab,abblockslab,cdblockslab,sparaminput,sprd32blk,sadd32blk,sdpfifo_q)
|
| 305 |
|
|
-- begin
|
| 306 |
|
|
-- --! La cola para la normalizacion de los vectores.
|
| 307 |
|
|
-- snormfifo_d(qx) <= (hblockslab and ((cdblockslab and sparaminput(dx))or(not(cdblockslab) and sparaminput(cx)))) or (not(hblockslab) and ((abblockslab and sparaminput(bx))or(not(abblockslab) and sparaminput(ax))));
|
| 308 |
|
|
-- snormfifo_d(qy) <= (hblockslab and ((cdblockslab and sparaminput(dy))or(not(cdblockslab) and sparaminput(cy)))) or (not(hblockslab) and ((abblockslab and sparaminput(by))or(not(abblockslab) and sparaminput(ay))));
|
| 309 |
|
|
-- snormfifo_d(qz) <= (hblockslab and ((cdblockslab and sparaminput(dz))or(not(cdblockslab) and sparaminput(cz)))) or (not(hblockslab) and ((abblockslab and sparaminput(bz))or(not(abblockslab) and sparaminput(az))));
|
| 310 |
|
|
--
|
| 311 |
|
|
-- --! Combinatorio para decidir que operaciones realizan los sumadores / restadores.
|
| 312 |
|
|
-- add32blks <= (instr3(0) xor (instr3(1) xor instr3(0)))&(instr3(0) xor (instr3(1) xor instr3(0))) ;
|
| 313 |
|
|
--
|
| 314 |
|
|
-- --! Por defecto conectar los sumandos en producto punto/cruz
|
| 315 |
|
|
-- ssumando(s0) <= sprd32blk(p0);ssumando(s1) <= sprd32blk(p1);
|
| 316 |
|
|
-- ssumando(s6) <= sadd32blk(a0);ssumando(s7) <= sdpfifo_q(dpfifoab);
|
| 317 |
|
|
-- ssumando(s10) <= sdpfifo_q(dpfifocd);ssumando(s11) <= sadd32blk(a2);
|
| 318 |
|
|
-- ssumando(s4) <= sprd32blk(p4);ssumando(s5) <= sprd32blk(p5);
|
| 319 |
|
|
-- ssumando(s2) <= sprd32blk(p2);ssumando(s3) <= sprd32blk(p3);
|
| 320 |
|
|
--
|
| 321 |
|
|
-- --! El segundo sumador del segundo bloque siempre sera suma o resta independiente de la operacion
|
| 322 |
|
|
-- ssumando(s8) <= sparaminput(cy);ssumando(s9) <= sparaminput(dy);
|
| 323 |
|
|
--
|
| 324 |
|
|
-- --! Por defecto conectar los factores en producto punto
|
| 325 |
|
|
-- sfactor(f0) <= sparaminput(ax);sfactor(f1) <= sparaminput(bx);
|
| 326 |
|
|
-- sfactor(f2) <= sparaminput(ay);sfactor(f3) <= sparaminput(by);
|
| 327 |
|
|
-- sfactor(f4) <= sparaminput(az);sfactor(f5) <= sparaminput(bz);
|
| 328 |
|
|
-- sfactor(f6) <= sparaminput(bx);sfactor(f7) <= sparaminput(dx);
|
| 329 |
|
|
-- sfactor(f8) <= sparaminput(by);sfactor(f9) <= sparaminput(dy);
|
| 330 |
|
|
-- sfactor(f10) <= sparaminput(bz);sfactor(f11) <= sparaminput(dz);
|
| 331 |
|
|
--
|
| 332 |
|
|
-- --!Los resultados por defecto se acomodan al producto punto y parcialmente a los productos simple y escalar.
|
| 333 |
|
|
-- sresult(ax) <= sadd32blk(aa);
|
| 334 |
|
|
-- sresult(ay) <= sprd32blk(p1);
|
| 335 |
|
|
-- sresult(az) <= sprd32blk(p2);
|
| 336 |
|
|
-- sresult(bx) <= sadd32blk(ac);
|
| 337 |
|
|
-- sresult(by) <= sprd32blk(p4);
|
| 338 |
|
|
-- sresult(bz) <= sprd32blk(p5);
|
| 339 |
|
|
--
|
| 340 |
|
|
-- if (instr3(2 downto 1)="11" or instr3="100") then
|
| 341 |
|
|
-- sresult(ax) <= sprd32blk(p0);
|
| 342 |
|
|
-- sresult(bx) <= sprd32blk(p3);
|
| 343 |
|
|
-- elsif instr3(0)='1' then
|
| 344 |
|
|
-- sresult(ax) <= sprd32blk(a0);
|
| 345 |
|
|
-- sresult(ay) <= sprd32blk(a1);
|
| 346 |
|
|
-- sresult(az) <= sprd32blk(a2);
|
| 347 |
|
|
-- sresult(bx) <= sadd32blk(aa);
|
| 348 |
|
|
-- sresult(by) <= sprd32blk(ab);
|
| 349 |
|
|
-- sresult(bz) <= sadd32blk(ac);
|
| 350 |
|
|
-- elsif instr3(1)='1' then
|
| 351 |
|
|
-- sresult(ax) <= ssqr32blk(sqrt320);
|
| 352 |
|
|
-- sresult(bx) <= ssqr32blk(sqrt321);
|
| 353 |
|
|
-- end if;
|
| 354 |
|
|
--
|
| 355 |
|
|
--
|
| 356 |
|
|
-- if instr3(0)='1' then --! Producto Cruz, suma, resta, multiplicacion simple
|
| 357 |
|
|
--
|
| 358 |
|
|
-- if (instr3(2) or instr3(1))='1' then --! Suma, Resta, Multiplicacion simple
|
| 359 |
|
|
--
|
| 360 |
|
|
-- --! Conectar las entradas de los sumadores en suma o resta de vectores
|
| 361 |
|
|
-- ssumando(s0) <= sparaminput(ax);ssumando(s1) <= sparaminput(bx);
|
| 362 |
|
|
-- ssumando(s2) <= sparaminput(ay);ssumando(s3) <= sparaminput(by);
|
| 363 |
|
|
-- ssumando(s4) <= sparaminput(az);ssumando(s5) <= sparaminput(bz);
|
| 364 |
|
|
-- ssumando(s6) <= sparaminput(cx);ssumando(s7) <= sparaminput(dx);
|
| 365 |
|
|
-- ssumando(s10) <= sparaminput(cz);ssumando(s11) <= sparaminput(dz);
|
| 366 |
|
|
--
|
| 367 |
|
|
-- else --! Producto Cruz!
|
| 368 |
|
|
--
|
| 369 |
|
|
-- if hblock='1' then --! Producto crux CxD
|
| 370 |
|
|
-- --!Multiplicadores:
|
| 371 |
|
|
-- sfactor(f0) <= sparaminput(cy);sfactor(f1) <= sparaminput(dz);sfactor(f2) <= sparaminput(cz);sfactor(f3) <= sparaminput(dy);
|
| 372 |
|
|
-- sfactor(f4) <= sparaminput(cx);sfactor(f5) <= sparaminput(dz);sfactor(f6) <= sparaminput(cz);sfactor(f7) <= sparaminput(dx);
|
| 373 |
|
|
-- sfactor(f8) <= sparaminput(cx);sfactor(f9) <= sparaminput(dy);sfactor(f10) <= sparaminput(cy);sfactor(f11) <= sparaminput(dx);
|
| 374 |
|
|
-- else --! Producto crux AxD
|
| 375 |
|
|
-- --!Multiplicadores:
|
| 376 |
|
|
-- sfactor(f0) <= sparaminput(ay);sfactor(f1) <= sparaminput(bz);sfactor(f2) <= sparaminput(az);sfactor(f3) <= sparaminput(by);
|
| 377 |
|
|
-- sfactor(f4) <= sparaminput(ax);sfactor(f5) <= sparaminput(bz);sfactor(f6) <= sparaminput(az);sfactor(f7) <= sparaminput(bx);
|
| 378 |
|
|
-- sfactor(f8) <= sparaminput(ax);sfactor(f9) <= sparaminput(by);sfactor(f10) <= sparaminput(ay);sfactor(f11) <= sparaminput(bx);
|
| 379 |
|
|
-- end if;
|
| 380 |
|
|
--
|
| 381 |
|
|
-- end if;
|
| 382 |
|
|
--
|
| 383 |
|
|
-- else --! Producto Punto, magnitud, producto escalar y normalizacion
|
| 384 |
|
|
-- if instr3(2)='1' then --!Producto Escalar (INSTR3(1)=0) o Normalizacion (INSTR3(1)=1)
|
| 385 |
|
|
--
|
| 386 |
|
|
-- sfactor(f0) <= (not instr31slab and sparaminput(ax)) or (instr31slab and ((not(hblockslab) and ((not(abblockslab) and sparaminput(ax)) or(abblockslab and sparaminput(bx))))or( hblockslab and snormfifo_q(qx)) ) );
|
| 387 |
|
|
-- sfactor(f1) <= (not instr31slab and sparaminput(bx)) or (instr31slab and ((not(hblockslab) and ((not(abblockslab) and sparaminput(ax)) or(abblockslab and sparaminput(bx))))or( hblockslab and sinv32blk(invr321)) ) );
|
| 388 |
|
|
-- sfactor(f2) <= (not instr31slab and sparaminput(ay)) or (instr31slab and ((not(hblockslab) and ((not(abblockslab) and sparaminput(ay)) or(abblockslab and sparaminput(by))))or( hblockslab and snormfifo_q(qy)) ) );
|
| 389 |
|
|
-- sfactor(f3) <= (not instr31slab and sparaminput(bx)) or (instr31slab and ((not(hblockslab) and ((not(abblockslab) and sparaminput(ay)) or(abblockslab and sparaminput(by))))or( hblockslab and sinv32blk(invr321)) ) );
|
| 390 |
|
|
-- sfactor(f4) <= (not instr31slab and sparaminput(az)) or (instr31slab and ((not(hblockslab) and ((not(abblockslab) and sparaminput(az)) or(abblockslab and sparaminput(bz))))or( hblockslab and snormfifo_q(qz)) ) );
|
| 391 |
|
|
-- sfactor(f5) <= (not instr31slab and sparaminput(bx)) or (instr31slab and ((not(hblockslab) and ((not(abblockslab) and sparaminput(az)) or(abblockslab and sparaminput(bz))))or( hblockslab and sinv32blk(invr321)) ) );
|
| 392 |
|
|
-- sfactor(f6) <= (not instr31slab and sparaminput(cx)) or (instr31slab and ((hblockslab and ((not(cdblockslab) and sparaminput(cx)) or(cdblockslab and sparaminput(dx))))or( not(hblockslab) and snormfifo_q(qx)) ) );
|
| 393 |
|
|
-- sfactor(f7) <= (not instr31slab and sparaminput(dx)) or (instr31slab and ((hblockslab and ((not(cdblockslab) and sparaminput(cx)) or(cdblockslab and sparaminput(dx))))or( not(hblockslab) and sinv32blk(invr320)) ) );
|
| 394 |
|
|
-- sfactor(f8) <= (not instr31slab and sparaminput(cy)) or (instr31slab and ((hblockslab and ((not(cdblockslab) and sparaminput(cy)) or(cdblockslab and sparaminput(dy))))or( not(hblockslab) and snormfifo_q(qy)) ) );
|
| 395 |
|
|
-- sfactor(f9) <= (not instr31slab and sparaminput(dx)) or (instr31slab and ((hblockslab and ((not(cdblockslab) and sparaminput(cy)) or(cdblockslab and sparaminput(dy))))or( not(hblockslab) and sinv32blk(invr320)) ) );
|
| 396 |
|
|
-- sfactor(f10) <= (not instr31slab and sparaminput(cz)) or (instr31slab and ((hblockslab and ((not(cdblockslab) and sparaminput(cz)) or(cdblockslab and sparaminput(dz))))or( not(hblockslab) and snormfifo_q(qz)) ) );
|
| 397 |
|
|
-- sfactor(f11) <= (not instr31slab and sparaminput(dx)) or (instr31slab and ((hblockslab and ((not(cdblockslab) and sparaminput(cz)) or(cdblockslab and sparaminput(dz))))or( not(hblockslab) and sinv32blk(invr320)) ) );
|
| 398 |
|
|
-- elsif instr3(1)='1' then --!Magnitud. El producto punto no se computa porque los factores estan por defecto configurados en producto punto.
|
| 399 |
|
|
-- sfactor(f0) <= (not(abblockslab) and sparaminput(ax))or(abblockslab and sparaminput(bx));
|
| 400 |
|
|
-- sfactor(f1) <= (not(abblockslab) and sparaminput(ax))or(abblockslab and sparaminput(bx));
|
| 401 |
|
|
-- sfactor(f2) <= (not(abblockslab) and sparaminput(ay))or(abblockslab and sparaminput(by));
|
| 402 |
|
|
-- sfactor(f3) <= (not(abblockslab) and sparaminput(ay))or(abblockslab and sparaminput(by));
|
| 403 |
|
|
-- sfactor(f4) <= (not(abblockslab) and sparaminput(az))or(abblockslab and sparaminput(bz));
|
| 404 |
|
|
-- sfactor(f5) <= (not(abblockslab) and sparaminput(az))or(abblockslab and sparaminput(bz));
|
| 405 |
|
|
-- sfactor(f6) <= (not(cdblockslab) and sparaminput(cx))or(cdblockslab and sparaminput(dx));
|
| 406 |
|
|
-- sfactor(f7) <= (not(cdblockslab) and sparaminput(cx))or(cdblockslab and sparaminput(dx));
|
| 407 |
|
|
-- sfactor(f8) <= (not(cdblockslab) and sparaminput(cy))or(cdblockslab and sparaminput(dy));
|
| 408 |
|
|
-- sfactor(f9) <= (not(cdblockslab) and sparaminput(cy))or(cdblockslab and sparaminput(dy));
|
| 409 |
|
|
-- sfactor(f10) <= (not(cdblockslab) and sparaminput(cz))or(cdblockslab and sparaminput(dz));
|
| 410 |
|
|
-- sfactor(f11) <= (not(cdblockslab) and sparaminput(cz))or(cdblockslab and sparaminput(dz));
|
| 411 |
|
|
--
|
| 412 |
|
|
-- end if;
|
| 413 |
|
|
-- end if;
|
| 414 |
|
|
--
|
| 415 |
|
|
-- end process;
|
| 416 |
|
|
--
|
| 417 |
|
|
|
| 418 |
123 |
jguarin200 |
end dpc_arch;
|