Line 25... |
Line 25... |
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
--! Paquete para el manejo de aritmŽtica con signo sobre el tipo std_logic_vector
|
--! Paquete para el manejo de aritmŽtica con signo sobre el tipo std_logic_vector
|
use ieee.std_logic_signed.all;
|
use ieee.std_logic_signed.all;
|
|
|
|
--! Paquete estandar de texto
|
|
use std.textio.all;
|
|
|
--! 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.
|
--! 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.
|
use work.arithpack.all;
|
use work.arithpack.all;
|
|
|
|
|
--! uf es la descripción del circuito que realiza la aritmética del Rt Engine.
|
--! uf es la descripción del circuito que realiza la aritmética del Rt Engine.
|
Line 40... |
Line 43... |
--! La característica fundamental de uf, es que puede realizar 2 operaciones de producto punto al mimso tiempo ó una operación de producto cruz al mismo tiempo. La otra característica importante es que el pipe de producto punto es mas largo que el pipe de producto cruz: el producto punto tomará 3 clocks para realizarse, mientras que el procto punto tomara 4 clocks para realizarse.
|
--! La característica fundamental de uf, es que puede realizar 2 operaciones de producto punto al mimso tiempo ó una operación de producto cruz al mismo tiempo. La otra característica importante es que el pipe de producto punto es mas largo que el pipe de producto cruz: el producto punto tomará 3 clocks para realizarse, mientras que el procto punto tomara 4 clocks para realizarse.
|
|
|
entity uf is
|
entity uf is
|
generic (
|
generic (
|
use_std_logic_signed : string := "NO";
|
use_std_logic_signed : string := "NO";
|
|
testbench_generation : string := "NO";
|
carry_logic : string := "CLA"
|
carry_logic : string := "CLA"
|
);
|
);
|
port (
|
port (
|
opcode : in std_logic; --! Entrada que dentro de la arquitectura funciona como selector de la operación que se lleva a cabo en la primera etapa de sumadores/restadores.
|
opcode : in std_logic; --! Entrada que dentro de la arquitectura funciona como selector de la operación que se lleva a cabo en la primera etapa de sumadores/restadores.
|
m0f0,m0f1,m1f0,m1f1,m2f0,m2f1,m3f0,m3f1,m4f0,m4f1,m5f0,m5f1 : in std_logic_vector(17 downto 0); --! Entradas que van conectadas a los multiplicadores en la primera etapa de la descripción.
|
m0f0,m0f1,m1f0,m1f1,m2f0,m2f1,m3f0,m3f1,m4f0,m4f1,m5f0,m5f1 : in std_logic_vector(17 downto 0); --! Entradas que van conectadas a los multiplicadores en la primera etapa de la descripción.
|
Line 77... |
Line 81... |
|
|
begin
|
begin
|
|
|
-- Multiplicator Instantiation (StAgE 0)
|
-- Multiplicator Instantiation (StAgE 0)
|
--! Multiplicador 0
|
--! Multiplicador 0
|
m0 : r_a18_b18_smul_c32_r
|
m0 : lpm_mult
|
|
generic map (
|
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 2,
|
|
lpm_representation => "SIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 18,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 32
|
|
)
|
port map (
|
port map (
|
aclr => rst,
|
aclr => rst,
|
clock => clk,
|
clock => clk,
|
dataa => stage0mf00,
|
dataa => stage0mf00,
|
datab => stage0mf01,
|
datab => stage0mf01,
|
result => stage0p0
|
result => stage0p0
|
);
|
);
|
|
|
--! Multiplicador 1
|
--! Multiplicador 1
|
m1 : r_a18_b18_smul_c32_r
|
m1 : lpm_mult
|
|
generic map (
|
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 2,
|
|
lpm_representation => "SIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 18,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 32
|
|
)
|
port map (
|
port map (
|
aclr => rst,
|
aclr => rst,
|
clock => clk,
|
clock => clk,
|
dataa => stage0mf10,
|
dataa => stage0mf10,
|
datab => stage0mf11,
|
datab => stage0mf11,
|
result => stage0p1
|
result => stage0p1
|
);
|
);
|
|
|
--! Multiplicador 2
|
--! Multiplicador 2
|
m2 : r_a18_b18_smul_c32_r
|
m2 : lpm_mult
|
|
generic map (
|
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 2,
|
|
lpm_representation => "SIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 18,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 32
|
|
)
|
port map (
|
port map (
|
aclr => rst,
|
aclr => rst,
|
clock => clk,
|
clock => clk,
|
dataa => stage0mf20,
|
dataa => stage0mf20,
|
datab => stage0mf21,
|
datab => stage0mf21,
|
result => stage0p2
|
result => stage0p2
|
);
|
);
|
|
|
--! Multiplicador 3
|
--! Multiplicador 3
|
m3 : r_a18_b18_smul_c32_r
|
m3 : lpm_mult
|
|
generic map (
|
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 2,
|
|
lpm_representation => "SIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 18,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 32
|
|
)
|
port map (
|
port map (
|
aclr => rst,
|
aclr => rst,
|
clock => clk,
|
clock => clk,
|
dataa => stage0mf30,
|
dataa => stage0mf30,
|
datab => stage0mf31,
|
datab => stage0mf31,
|
result => stage0p3
|
result => stage0p3
|
);
|
);
|
|
|
--! Multiplicador 4
|
--! Multiplicador 4
|
m4 : r_a18_b18_smul_c32_r
|
m4 : lpm_mult
|
|
generic map (
|
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 2,
|
|
lpm_representation => "SIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 18,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 32
|
|
)
|
port map (
|
port map (
|
aclr => rst,
|
aclr => rst,
|
clock => clk,
|
clock => clk,
|
dataa => stage0mf40,
|
dataa => stage0mf40,
|
datab => stage0mf41,
|
datab => stage0mf41,
|
result => stage0p4
|
result => stage0p4
|
);
|
);
|
|
|
--! Multiplicador 5
|
--! Multiplicador 5
|
m5 : r_a18_b18_smul_c32_r
|
m5 : lpm_mult
|
|
generic map (
|
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 2,
|
|
lpm_representation => "SIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 18,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 32
|
|
)
|
port map (
|
port map (
|
aclr => rst,
|
aclr => rst,
|
clock => clk,
|
clock => clk,
|
dataa => stage0mf50,
|
dataa => stage0mf50,
|
datab => stage0mf51,
|
datab => stage0mf51,
|
Line 275... |
Line 333... |
stageSRopcode <= stageMopcode;
|
stageSRopcode <= stageMopcode;
|
|
|
end if;
|
end if;
|
end process uf_seq;
|
end process uf_seq;
|
|
|
|
--! Codigo generado para realizar test bench
|
|
tbgen:
|
|
if testbench_generation="YES" generate
|
|
tbproc0:
|
|
process
|
|
variable buff : line;
|
|
file mbuff : text open write_mode is "TRACE_multiplier_content";
|
|
begin
|
|
write(buff,string'("UF multipliers test benching"));
|
|
writeline(mbuff, buff);
|
|
wait for 5 ns;
|
|
wait until rst=not(rstMasterValue);
|
|
wait until clk='1';
|
|
wait for tclk2+tclk4; --! Garantizar la estabilidad de los datos que se van a observar en la salida.
|
|
displayRom:
|
|
loop
|
|
write (buff,now,unit =>ns);
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1p0(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1p1(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1p2(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1p1(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1p4(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1p5(31 downto 0));
|
|
writeline(mbuff,buff);
|
|
wait for tclk;
|
|
end loop displayRom;
|
|
end process tbproc0;
|
|
tbproc1:
|
|
process
|
|
variable buff : line;
|
|
file fbuff : text open write_mode is "TRACE_decoded_factors_content";
|
|
begin
|
|
|
|
write(buff,string'("UF factors decoded test benching"));
|
|
writeline(fbuff, buff);
|
|
wait for 5 ns;
|
|
wait until rst=not(rstMasterValue);
|
|
wait until clk='1';
|
|
wait for tclk2+tclk4; --! Garantizar la estabilidad de los datos que se van a observar en la salida.
|
|
displayRom:
|
|
loop
|
|
write (buff,now,unit =>ns);
|
|
write (buff,string'(" {"));
|
|
hexwrite_0 (buff,m0f0(17 downto 0));
|
|
hexwrite_0 (buff,m0f1(17 downto 0));
|
|
write (buff,string'("} {"));
|
|
hexwrite_0 (buff,m1f0(17 downto 0));
|
|
hexwrite_0 (buff,m1f1(17 downto 0));
|
|
write (buff,string'("} {"));
|
|
hexwrite_0 (buff,m2f0(17 downto 0));
|
|
hexwrite_0 (buff,m2f1(17 downto 0));
|
|
write (buff,string'("} {"));
|
|
hexwrite_0 (buff,m3f0(17 downto 0));
|
|
hexwrite_0 (buff,m3f1(17 downto 0));
|
|
write (buff,string'("} {"));
|
|
hexwrite_0 (buff,m4f0(17 downto 0));
|
|
hexwrite_0 (buff,m4f1(17 downto 0));
|
|
write (buff,string'("} {"));
|
|
hexwrite_0 (buff,m5f0(17 downto 0));
|
|
hexwrite_0 (buff,m5f1(17 downto 0));
|
|
write (buff,string'("}"));
|
|
writeline(fbuff,buff);
|
|
wait for tclk;
|
|
end loop displayRom;
|
|
end process tbproc1;
|
|
|
|
tbproc2:
|
|
process
|
|
variable buff : line;
|
|
file rbuff : text open write_mode is "TRACE_results_content";
|
|
begin
|
|
|
|
write(buff,string'("UF results test benching"));
|
|
writeline(rbuff, buff);
|
|
wait for 5 ns;
|
|
wait until rst=not(rstMasterValue);
|
|
wait until clk='1';
|
|
wait for tclk2+tclk4; --! Garantizar la estabilidad de los datos que se van a observar en la salida.
|
|
displayRom:
|
|
loop
|
|
write (buff,now,unit =>ns);
|
|
write (buff,string'(" {"));
|
|
hexwrite_0 (buff,stage1a0(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1a1(31 downto 0));
|
|
write (buff,string'(" "));
|
|
hexwrite_0 (buff,stage1a2(31 downto 0));
|
|
write (buff,string'("} {dp0: "));
|
|
hexwrite_0 (buff,stage2a3(31 downto 0));
|
|
write (buff,string'(",dp1: "));
|
|
hexwrite_0 (buff,stage2a4(31 downto 0));
|
|
write (buff,string'("}"));
|
|
writeline(rbuff,buff);
|
|
wait for tclk;
|
|
end loop displayRom;
|
|
end process tbproc2;
|
|
|
|
end generate tbgen;
|
|
|
|
|
|
|
|
|
end uf_arch;
|
end uf_arch;
|
|
|
No newline at end of file
|
No newline at end of file
|