Line 23... |
Line 23... |
-- 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 ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
library lpm;
|
|
use lpm.all;
|
use work.arithpack.all;
|
|
|
--! Esta entidad recibe dos números en formato punto flotante IEEE 754, de precision simple y devuelve las mantissas signadas y corridas, y el exponente correspondiente al resultado antes de normalizarlo al formato float.
|
--! Esta entidad recibe dos números en formato punto flotante IEEE 754, de precision simple y devuelve las mantissas signadas y corridas, y el exponente correspondiente al resultado antes de normalizarlo al formato float.
|
--!\nLas 2 mantissas y el exponente entran despues a la entidad add2 que suma las mantissas y entrega el resultado en formato IEEE 754.
|
--!\nLas 2 mantissas y el exponente entran despues a la entidad add2 que suma las mantissas y entrega el resultado en formato IEEE 754.
|
entity fadd32 is
|
entity fadd32 is
|
|
|
port (
|
port (
|
Line 37... |
Line 38... |
c32 : out std_logic_vector(31 downto 0)
|
c32 : out std_logic_vector(31 downto 0)
|
);
|
);
|
end entity;
|
end entity;
|
architecture fadd32_arch of fadd32 is
|
architecture fadd32_arch of fadd32 is
|
|
|
component lpm_mult
|
|
generic (
|
|
lpm_hint : string;
|
|
lpm_representation : string;
|
|
lpm_type : string;
|
|
lpm_widtha : natural;
|
|
lpm_widthb : natural;
|
|
lpm_widthp : natural
|
|
);
|
|
port (
|
|
dataa : in std_logic_vector ( lpm_widtha-1 downto 0 );
|
|
datab : in std_logic_vector ( lpm_widthb-1 downto 0 );
|
|
result : out std_logic_vector( lpm_widthp-1 downto 0 )
|
|
);
|
|
end component;
|
|
|
|
signal s1zero,s7sign : std_logic;
|
signal s1zero,s7sign : std_logic;
|
--!TBXSTART:STAGE5
|
--!TBXSTART:STAGE5
|
signal s5token : std_logic_vector(2 downto 0);
|
signal s5token : std_logic_vector(2 downto 0);
|
signal s5tokena,s5tokenb,s5tokenc : std_logic;
|
signal s5tokena,s5tokenb,s5tokenc : std_logic;
|
Line 171... |
Line 158... |
when "001" => s1shifter(8 downto 0) <= '0'¬(s1delta(5))&"00000"&s1delta(5)&'0';
|
when "001" => s1shifter(8 downto 0) <= '0'¬(s1delta(5))&"00000"&s1delta(5)&'0';
|
when others => s1shifter(8 downto 0) <= not(s1delta(5))&"0000000"&s1delta(5);
|
when others => s1shifter(8 downto 0) <= not(s1delta(5))&"0000000"&s1delta(5);
|
end case;
|
end case;
|
end process;
|
end process;
|
denormhighshiftermult:lpm_mult
|
denormhighshiftermult:lpm_mult
|
generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,18,27)
|
generic map (
|
port map (s1shifter,s1zero&s1umantshift(22 downto 06),s1ph);
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 0,
|
|
lpm_representation => "UNSIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 9,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 27
|
|
)
|
|
port map (
|
|
dataa => s1shifter,
|
|
datab => s1zero&s1umantshift(22 downto 06),
|
|
result => s1ph
|
|
);
|
denormlowshiftermult:lpm_mult
|
denormlowshiftermult:lpm_mult
|
generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,9,18)
|
generic map (
|
port map (s1shifter,s1umantshift(5 downto 0)&"000",s1pl);
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 0,
|
|
lpm_representation => "UNSIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 9,
|
|
lpm_widthb => 9,
|
|
lpm_widthp => 18
|
|
)
|
|
port map (
|
|
dataa => s1shifter,
|
|
datab => s1umantshift(5 downto 0)&"000",
|
|
result => s1pl
|
|
);
|
|
|
s1postshift(23 downto 7) <= s1ph(25 downto 9);
|
s1postshift(23 downto 7) <= s1ph(25 downto 9);
|
s1postshift(06 downto 0) <= s1ph(08 downto 2) or s1pl(17 downto 11);
|
s1postshift(06 downto 0) <= s1ph(08 downto 2) or s1pl(17 downto 11);
|
s1xorslab(23 downto 0) <= (others => s1umantfixed(23));
|
s1xorslab(23 downto 0) <= (others => s1umantfixed(23));
|
|
|
Line 241... |
Line 252... |
|
|
end process;
|
end process;
|
|
|
--! Etapa 6: Ejecutar el corrimiento para normalizar la mantissa.
|
--! Etapa 6: Ejecutar el corrimiento para normalizar la mantissa.
|
normhighshiftermult:lpm_mult
|
normhighshiftermult:lpm_mult
|
generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,18,27)
|
generic map (
|
port map (s6factorhot9,s6result(24 downto 7),s6ph);
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 0,
|
|
lpm_representation => "UNSIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 9,
|
|
lpm_widthb => 18,
|
|
lpm_widthp => 27
|
|
)
|
|
port map (
|
|
dataa => s6factorhot9,
|
|
datab => s6result(24 downto 7),
|
|
result => s6ph
|
|
);
|
normlowshiftermult:lpm_mult
|
normlowshiftermult:lpm_mult
|
generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,9,18)
|
generic map (
|
port map (s6factorhot9,s6result(06 downto 0)&"00",s6pl);
|
lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
|
lpm_pipeline => 0,
|
|
lpm_representation => "UNSIGNED",
|
|
lpm_type => "LPM_MULT",
|
|
lpm_widtha => 9,
|
|
lpm_widthb => 9,
|
|
lpm_widthp => 18
|
|
)
|
|
port map (
|
|
dataa => s6factorhot9,
|
|
datab => s6result(06 downto 0)&"00",
|
|
result => s6pl
|
|
);
|
s6postshift(22 downto 15) <= s6ph(16 downto 09);
|
s6postshift(22 downto 15) <= s6ph(16 downto 09);
|
s6postshift(14 downto 06) <= s6ph(08 downto 00) + s6pl(17 downto 09);
|
s6postshift(14 downto 06) <= s6ph(08 downto 00) + s6pl(17 downto 09);
|
s6postshift(05 downto 00) <= s6pl(08 downto 03);
|
s6postshift(05 downto 00) <= s6pl(08 downto 03);
|
|
|
|
|