Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI wrote an example myself as below. I think it is the correct way to do a summation for floating point values. Am I right?
Library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; Library altera_mf; use altera_mf.altera_mf_components.all; entity floatadd is port( inA,inB : in std_logic_vector(31 downto 0); inclk : in std_logic; out1 : out std_logic_vector(31 downto 0) ); end floatadd; architecture add of floatadd is component altfp_add_sub generic ( direction : string := "ADD"; pipeline : natural := 11; rounding : string := "TO_NEAREST"; width_exp : natural := 8; width_man : natural := 23 ); port( clock : in std_logic; dataa : in std_logic_vector(width_exp+width_man+1-1 downto 0); datab : in std_logic_vector(width_exp+width_man+1-1 downto 0); result : out std_logic_vector(width_exp+width_man+1-1 downto 0) ); end component; begin G1: altfp_add_sub port map (inclk,inA,inB,out1); end add;