3/10に上げたfpu-simのファイルからの変更点 ●ITOF itof.vhdの62行目 OUTPUT <= S & EXP & MANT_buf(30 downto 8); を OUTPUT <= S & EXP & (MANT_buf(30 downto 8) + MANT_buf(7)); に、(四捨五入で丸め) 61行目 EXP <= EXP_buf + 127; を EXP <= EXP_buf + 127 when SRC /= 0 else (others => '0'); に。(入力が0の場合の例外処理) ●FLESS fless.vhdの30から33行目、 SRC1_2 <= SRC1(31 downto 23) & "00000000000000000000000" when SRC1(30 downto 23) = 0 else SRC1; SRC2_2 <= SRC2(31 downto 23) & "00000000000000000000000" when SRC2(30 downto 23) = 0 else SRC2; を SRC1_2 <= (others => '0') when SRC1(30 downto 23) = 0 else SRC1; SRC2_2 <= (others => '0') when SRC2(30 downto 23) = 0 else SRC2; に。(+0.0,-0.0を同一視) ●FINVSQRT finvsqrt_repeat_1.vhdの47から49行目 EXP <= (not (S_EXP(7) & S_EXP(7 downto 1))) + SRC(23) + 127 when SRC(22 downto 0) = 0 else --(not (S_EXP(7) & S_EXP(7 downto 1))) + (not S_EXP(0)) + 127 when SRC(22 downto 0) = 0 else (not (S_EXP(7) & S_EXP(7 downto 1))) + 127; を EXP <= (others => '0') when SRC(30 downto 23) = 0 else (not (S_EXP(7) & S_EXP(7 downto 1))) + SRC(23) + 127 when SRC(22 downto 0) = 0 else --(not (S_EXP(7) & S_EXP(7 downto 1))) + (not S_EXP(0)) + 127 when SRC(22 downto 0) = 0 else (not (S_EXP(7) & S_EXP(7 downto 1))) + 127; に。(入力が0.0のときの出力を0.0に) これだけだと指数部のみ0で仮数部が0でない入力0に対して、同様に指数部が0で仮数部が0でない出力0が出る可能性があります。 また、指数部、仮数部ともに0であっても指数部は0で仮数部は0でない出力になります。他の命令では指数部のみ見て0かどうか判断 しているので多分問題ないかと思いますが、何かあったら言ってください。 finvsqrt_repeat_6.vhdの47行目 nextX(23 downto 1); を nextX(23 downto 1)+nextX(0); に。(Gbit切り捨てから切り上げへ、遅延時間が長すぎるかもしれないので戻す可能性もあります) ●FMUL fmul.vhdの114,115行目の MANT_buf4 <= --MANT_buf3(23 downto 1) + 1 when (MANT_buf3(0) = '1') else MANT_buf3(23 downto 1); -- 丸め を MANT_buf4 <= MANT_buf3(23 downto 1) + MANT_buf3(0); -- 丸め に。(Gbit切り捨てから切り上げに) ●FADD fadd_s.vhdの73,74行目 MANT <= MANT_buf2(24 downto 2) when MANT_buf2(25) = '1' else MANT_buf2(23 downto 1); を MANT <= MANT_buf2(24 downto 2)+MANT_buf2(1) when MANT_buf2(25) = '1' else MANT_buf2(23 downto 1)+MANT_buf2(0); に。(Gbit切り捨てから切り上げ) ●FSUB leftshifter31_sub.vhd 23行目 Shifted : out std_logic_vector(22 downto 0)); を Shifted : out std_logic_vector(23 downto 0)); に、 31行目 Shifted <= InD5(30 downto 8); を Shifted <= InD5(30 downto 7); に。(丸め方式変更のため、出力信号数をひとつ増やしました) fsub_s_2.vhd 26行目 Shifted : out std_logic_vector(22 downto 0)); が Shifted : out std_logic_vector(23 downto 0)); に、 48行目 signal MANTb : std_logic_vector(22 downto 0); が signal MANTb : std_logic_vector(23 downto 0); に、 66行目 MANT <= MANTb; が MANT <= MANTb(23 downto 1)+MANTb(0); に。(Gbit切り捨てから切り上げ) fsub_s_2.vhd 76行目 Neq <= '1' when W(30 downto 0) /= L(30 downto 0) else '0'; を Neq <= '1';-- when W(30 downto 0) /= L(30 downto 0) else '0'; に。(なくても良いのではと指摘された信号をとりあえず固定しておきました。 サイズ、遅延時間ともに減りました。信号Neq自体の削除は、こういった場合 そこまで大きな変化がなかったという経験があるので、とりあえず保留しておきます。) ●FTOI ftoi.vhdの INT_abs_buf <= shl("000000000000000000000000000000100000000000000000000000",nShift) when SRC(30 downto 23) = "00000000" else shl("0000000000000000000000000000001" & SRC(22 downto 0),nShift); を INT_abs_buf <= shl("0000000000000000000000000000001" & SRC(22 downto 0),nShift); に、 INT_abs <= (others => '0')--"00000000000000000000000000000000" when Zero = '1' or (EXP >= 158 and S = '1') else -- less than 0.5 or INT_MIN を INT_abs <= (others => '0')--"00000000000000000000000000000000" when EXP >= 158 and S = '1' else -- less than 0.5 or INT_MIN に、 OUTPUT <= (others => '0') when SRC(30 downto 0) = "0000000000000000000000000000000" else を OUTPUT <= (others => '0') when Zero = '1' else にしました。