--! @file arithblock.vhd
|
--! @file arithblock.vhd
|
--! @brief Bloque Aritmético de 4 sumadores y 6 multiplicadores.
|
--! @brief Bloque Aritmético de 4 sumadores y 6 multiplicadores.
|
--! @author Julián Andrés Guarín Reyes
|
--! @author Julián Andrés Guarín Reyes
|
--------------------------------------------------------------
|
--------------------------------------------------------------
|
-- RAYTRAC
|
-- RAYTRAC
|
-- Author Julian Andres Guarin
|
-- Author Julian Andres Guarin
|
-- memblock.vhd
|
-- memblock.vhd
|
-- This file is part of raytrac.
|
-- This file is part of raytrac.
|
--
|
--
|
-- raytrac is free software: you can redistribute it and/or modify
|
-- raytrac is free software: you can redistribute it and/or modify
|
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
-- the Free Software Foundation, either version 3 of the License, or
|
-- the Free Software Foundation, either version 3 of the License, or
|
-- (at your option) any later version.
|
-- (at your option) any later version.
|
--
|
--
|
-- raytrac is distributed in the hope that it will be useful,
|
-- raytrac is distributed in the hope that it will be useful,
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
-- GNU General Public License for more details.
|
-- GNU General Public License for more details.
|
--
|
--
|
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
-- along with raytrac. If not, see <http://www.gnu.org/licenses/>.
|
-- along with raytrac. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use work.arithpack.all;
|
use work.arithpack.all;
|
|
|
entity arithblock is
|
entity arithblock is
|
port (
|
port (
|
|
|
clk : in std_logic;
|
clk : in std_logic;
|
rst : in std_logic;
|
rst : in std_logic;
|
|
|
dpc : in std_logic;
|
dpc : in std_logic;
|
|
|
f : in std_logic_vector (12*32-1 downto 0);
|
f : in vectorblock12;
|
a : in std_logic_vector (8*32-1 downto 0);
|
a : in vectorblock08;
|
|
|
s : out std_logic_vector (4*32-1 downto 0);
|
s : out vectorblock04;
|
p : out std_logic_vector (6*32-1 downto 0)
|
p : out vectorblock06
|
|
|
);
|
);
|
end entity;
|
end entity;
|
|
|
architecture arithblock_arch of arithblock is
|
architecture arithblock_arch of arithblock is
|
|
|
|
|
|
|
|
|
begin
|
begin
|
--! 4 sumadores.
|
--! 4 sumadores.
|
-- arithblock:
|
-- arithblock:
|
-- for i in 3 downto 0 generate
|
-- for i in 3 downto 0 generate
|
-- adder_i : fadd32
|
-- adder_i : fadd32
|
-- port map (
|
-- port map (
|
-- clk => clk,
|
-- clk => clk,
|
-- dpc => dpc,
|
-- dpc => dpc,
|
-- a32 => a( ((i*2)+1)*32-1 downto (i*2)*32),
|
-- a32 => a( ((i*2)+1)*32-1 downto (i*2)*32),
|
-- b32 => a( ((i*2)+2)*32-1 downto ((i*2)+1)*32),
|
-- b32 => a( ((i*2)+2)*32-1 downto ((i*2)+1)*32),
|
-- c32 => s( (i+1)*32-1 downto 32*i)
|
-- c32 => s( (i+1)*32-1 downto 32*i)
|
-- );
|
-- );
|
-- end generate arithblock;
|
-- end generate arithblock;
|
--! 6 multiplicadores.
|
--! 6 multiplicadores.
|
-- mulblock:
|
-- mulblock:
|
-- for i in 5 downto 0 generate
|
-- for i in 5 downto 0 generate
|
-- mul_i : fmul32
|
-- mul_i : fmul32
|
-- port map (
|
-- port map (
|
-- clk => clk,
|
-- clk => clk,
|
-- a32 => f( ((i*2)+1)*32-1 downto (i*2)*32),
|
-- a32 => f( ((i*2)+1)*32-1 downto (i*2)*32),
|
-- b32 => f( ((i*2)+2)*32-1 downto ((i*2)+1)*32),
|
-- b32 => f( ((i*2)+2)*32-1 downto ((i*2)+1)*32),
|
-- p32 => p( (i+1)*32-1 downto 32*i)
|
-- p32 => p( (i+1)*32-1 downto 32*i)
|
-- );
|
-- );
|
-- end generate mulblock;
|
-- end generate mulblock;
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
adder_i_0 : fadd32
|
adder_i_0 : fadd32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
dpc => dpc,
|
dpc => dpc,
|
a32 => a( 31 downto 0),
|
a32 => a(0),
|
b32 => a( 63 downto 32),
|
b32 => a(1),
|
c32 => s( 31 downto 0)
|
c32 => s(0)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
adder_i_1 : fadd32
|
adder_i_1 : fadd32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
dpc => dpc,
|
dpc => dpc,
|
a32 => a( 95 downto 64),
|
a32 => a(2),
|
b32 => a( 127 downto 96),
|
b32 => a(3),
|
c32 => s( 63 downto 32)
|
c32 => s(1)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
adder_i_2 : fadd32
|
adder_i_2 : fadd32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
dpc => dpc,
|
dpc => dpc,
|
a32 => a( 159 downto 128),
|
a32 => a(4),
|
b32 => a( 191 downto 160),
|
b32 => a(5),
|
c32 => s( 95 downto 64)
|
c32 => s(2)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
adder_i_3 : fadd32
|
adder_i_3 : fadd32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
dpc => dpc,
|
dpc => dpc,
|
a32 => a( 223 downto 192),
|
a32 => a(6),
|
b32 => a( 255 downto 224),
|
b32 => a(7),
|
c32 => s( 127 downto 96)
|
c32 => s(3)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
mul_i_0 : fmul32
|
mul_i_0 : fmul32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a32 => f( 31 downto 0),
|
a32 => f(0),
|
b32 => f( 63 downto 32),
|
b32 => f(1),
|
p32 => p( 31 downto 0)
|
p32 => p(0)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
mul_i_1 : fmul32
|
mul_i_1 : fmul32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a32 => f( 95 downto 64),
|
a32 => f(2),
|
b32 => f( 127 downto 96),
|
b32 => f(3),
|
p32 => p( 63 downto 32)
|
p32 => p(1)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
mul_i_2 : fmul32
|
mul_i_2 : fmul32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a32 => f( 159 downto 128),
|
a32 => f(4),
|
b32 => f( 191 downto 160),
|
b32 => f(5),
|
p32 => p( 95 downto 64)
|
p32 => p(2)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
mul_i_3 : fmul32
|
mul_i_3 : fmul32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a32 => f( 223 downto 192),
|
a32 => f(6),
|
b32 => f( 255 downto 224),
|
b32 => f(7),
|
p32 => p( 127 downto 96)
|
p32 => p(3)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
mul_i_4 : fmul32
|
mul_i_4 : fmul32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a32 => f( 287 downto 256),
|
a32 => f(8),
|
b32 => f( 319 downto 288),
|
b32 => f(9),
|
p32 => p( 159 downto 128)
|
p32 => p(4)
|
);
|
);
|
--!TBXINSTANCESTART
|
--!TBXINSTANCESTART
|
mul_i_5 : fmul32
|
mul_i_5 : fmul32
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a32 => f( 351 downto 320),
|
a32 => f(10),
|
b32 => f( 383 downto 352),
|
b32 => f(11),
|
p32 => p( 191 downto 160)
|
p32 => p(5)
|
);
|
);
|
|
|
|
|
|
|
end architecture;
|
end architecture;
|
|
|
|
|
|
|