Line 55... |
Line 55... |
datab : in std_logic_vector ( lpm_widthb-1 downto 0 );
|
datab : in std_logic_vector ( lpm_widthb-1 downto 0 );
|
result : out std_logic_vector( lpm_widthp-1 downto 0 )
|
result : out std_logic_vector( lpm_widthp-1 downto 0 )
|
);
|
);
|
end component;
|
end component;
|
|
|
|
signal s1zero : std_logic;
|
signal s1delta : std_logic_vector(5 downto 0);
|
signal s1delta : std_logic_vector(5 downto 0);
|
signal s0delta,s1exp,s2exp,s3exp,s4exp,s5exp,s5factor,s6exp,s6factor: std_logic_vector(7 downto 0);
|
signal s0delta,s1exp,s2exp,s3exp,s4exp,s5exp,s5factor,s6exp,s6factor: std_logic_vector(7 downto 0);
|
signal s1shifter,s5factorhot9 : std_logic_vector(8 downto 0);
|
signal s1shifter,s5factorhot9 : std_logic_vector(8 downto 0);
|
signal s1pl,s5pl : std_logic_vector(17 downto 0);
|
signal s1pl,s5pl : std_logic_vector(17 downto 0);
|
signal s5postshift,s6postshift : std_logic_vector(22 downto 0);
|
signal s5postshift,s6postshift : std_logic_vector(22 downto 0);
|
Line 81... |
Line 81... |
s0b(31) <= dpc xor b32(31); --! Importante: Integrar el signo en el operando B
|
s0b(31) <= dpc xor b32(31); --! Importante: Integrar el signo en el operando B
|
s0b(30 downto 0) <= b32(30 downto 0);
|
s0b(30 downto 0) <= b32(30 downto 0);
|
|
|
--!Etapa 0,Escoger el mayor exponente que sera el resultado desnormalizado, calcula cuanto debe ser el corrimiento de la mantissa con menor exponente y reorganiza los operandos, si el mayor es b, intercambia las posición si el mayor es a las posiciones la mantiene. Zero check.
|
--!Etapa 0,Escoger el mayor exponente que sera el resultado desnormalizado, calcula cuanto debe ser el corrimiento de la mantissa con menor exponente y reorganiza los operandos, si el mayor es b, intercambia las posición si el mayor es a las posiciones la mantiene. Zero check.
|
--!signo,exponente,mantissa
|
--!signo,exponente,mantissa
|
|
if (s0b(30 downto 23)&s0a(30 downto 23))=x"0000" then
|
|
s1zero <= '0';
|
|
else
|
|
s1zero <= '1';
|
|
end if;
|
s1delta <= s0delta(7) & (s0delta(7) xor s0delta(4))&(s0delta(7) xor s0delta(4)) & s0delta(2 downto 0);
|
s1delta <= s0delta(7) & (s0delta(7) xor s0delta(4))&(s0delta(7) xor s0delta(4)) & s0delta(2 downto 0);
|
case s0delta(7) is
|
case s0delta(7) is
|
when '1' =>
|
when '1' =>
|
s1exp <= s0b(30 downto 23);
|
s1exp <= s0b(30 downto 23);
|
s1umantshift <= s0a(31)&s0a(22 downto 0);
|
s1umantshift <= s0a(31)&s0a(22 downto 0);
|
Line 94... |
Line 99... |
s1umantshift <= s0b(31)&s0b(22 downto 0);
|
s1umantshift <= s0b(31)&s0b(22 downto 0);
|
s1umantfixed <= s0a(31)&s0a(22 downto 0);
|
s1umantfixed <= s0a(31)&s0a(22 downto 0);
|
end case;
|
end case;
|
|
|
--! Etapa 1: Denormalización de la mantissas.
|
--! Etapa 1: Denormalización de la mantissas.
|
case s0delta(4 downto 3) is
|
case s1delta(4 downto 3) is
|
when "00" => s2umantshift <= s1umantshift(23)&s1postshift(23 downto 0);
|
when "00" => s2umantshift <= s1umantshift(23)&s1postshift(23 downto 0);
|
when "01" => s2umantshift <= s1umantshift(23)&x"00"&s1postshift(23 downto 8);
|
when "01" => s2umantshift <= s1umantshift(23)&x"00"&s1postshift(23 downto 8);
|
when "10" => s2umantshift <= s1umantshift(23)&x"0000"&s1postshift(23 downto 16);
|
when "10" => s2umantshift <= s1umantshift(23)&x"0000"&s1postshift(23 downto 16);
|
when others => s2umantshift <= (others => '0');
|
when others => s2umantshift <= (others => '0');
|
end case;
|
end case;
|
Line 125... |
Line 130... |
s6factor <= s5factor;
|
s6factor <= s5factor;
|
s6postshift <= s5postshift;
|
s6postshift <= s5postshift;
|
|
|
--! Etapa 6: Entregar el resultado.
|
--! Etapa 6: Entregar el resultado.
|
c32(31) <= s6result(25);
|
c32(31) <= s6result(25);
|
c32(30 downto 23) <= s6exp+s5factor+x"ff";
|
c32(30 downto 23) <= s6exp+s6factor+x"ff";
|
case s6factor(4 downto 3) is
|
case s6factor(4 downto 3) is
|
when "01" => c32(22 downto 0) <= s6postshift(14 downto 00)&x"00";
|
when "01" => c32(22 downto 0) <= s6postshift(14 downto 00)&x"00";
|
when "10" => c32(22 downto 0) <= s6postshift(06 downto 00)&x"0000";
|
when "10" => c32(22 downto 0) <= s6postshift(06 downto 00)&x"0000";
|
when others => c32(22 downto 0) <= s6postshift;
|
when others => c32(22 downto 0) <= s6postshift;
|
end case;
|
end case;
|
Line 153... |
Line 158... |
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 ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,18,27)
|
port map (s1shifter,'1'&s1umantshift(22 downto 06),s1ph);
|
port map (s1shifter,s1zero&s1umantshift(22 downto 06),s1ph);
|
denormlowshiftermult:lpm_mult
|
denormlowshiftermult:lpm_mult
|
generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,9,18)
|
generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,9,18)
|
port map (s1shifter,s1umantshift(5 downto 0)&"000",s1pl);
|
port map (s1shifter,s1umantshift(5 downto 0)&"000",s1pl);
|
|
|
s1postshift(23 downto 7) <= s1ph(25 downto 9);
|
s1postshift(23 downto 7) <= s1ph(25 downto 9);
|