Line 61... |
Line 61... |
clk_i : in std_ulogic; -- global clock, rising edge
|
clk_i : in std_ulogic; -- global clock, rising edge
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|
ctrl_i : in std_ulogic_vector(ctrl_width_c-1 downto 0); -- main control bus
|
ctrl_i : in std_ulogic_vector(ctrl_width_c-1 downto 0); -- main control bus
|
start_i : in std_ulogic; -- trigger operation
|
start_i : in std_ulogic; -- trigger operation
|
-- data input --
|
-- data input --
|
frm_i : in std_ulogic_vector(2 downto 0); -- rounding mode
|
|
cmp_i : in std_ulogic_vector(1 downto 0); -- comparator status
|
cmp_i : in std_ulogic_vector(1 downto 0); -- comparator status
|
rs1_i : in std_ulogic_vector(data_width_c-1 downto 0); -- rf source 1
|
rs1_i : in std_ulogic_vector(data_width_c-1 downto 0); -- rf source 1
|
rs2_i : in std_ulogic_vector(data_width_c-1 downto 0); -- rf source 2
|
rs2_i : in std_ulogic_vector(data_width_c-1 downto 0); -- rf source 2
|
-- result and status --
|
-- result and status --
|
res_o : out std_ulogic_vector(data_width_c-1 downto 0); -- operation result
|
res_o : out std_ulogic_vector(data_width_c-1 downto 0); -- operation result
|
Line 365... |
Line 364... |
funct_ff <= cmd.funct; -- actual operation to execute
|
funct_ff <= cmd.funct; -- actual operation to execute
|
cmp_ff <= cmp_i; -- main ALU comparator
|
cmp_ff <= cmp_i; -- main ALU comparator
|
-- rounding mode --
|
-- rounding mode --
|
-- TODO / FIXME "round to nearest, ties to max magnitude" (0b100) is not supported yet
|
-- TODO / FIXME "round to nearest, ties to max magnitude" (0b100) is not supported yet
|
if (ctrl_i(ctrl_ir_funct3_2_c downto ctrl_ir_funct3_0_c) = "111") then
|
if (ctrl_i(ctrl_ir_funct3_2_c downto ctrl_ir_funct3_0_c) = "111") then
|
fpu_operands.frm <= '0' & frm_i(1 downto 0);
|
fpu_operands.frm <= '0' & ctrl_i(ctrl_alu_frm1_c downto ctrl_alu_frm0_c);
|
else
|
else
|
fpu_operands.frm <= '0' & ctrl_i(ctrl_ir_funct3_1_c downto ctrl_ir_funct3_0_c);
|
fpu_operands.frm <= '0' & ctrl_i(ctrl_ir_funct3_1_c downto ctrl_ir_funct3_0_c);
|
end if;
|
end if;
|
--
|
--
|
if (start_i = '1') then
|
if (start_i = '1') then
|
Line 503... |
Line 502... |
fu_compare.flags <= (others => '0'); -- does not generate exceptions here, but normalizer can generate exceptions
|
fu_compare.flags <= (others => '0'); -- does not generate exceptions here, but normalizer can generate exceptions
|
|
|
|
|
-- Min/Max Select (FMIN/FMAX) -------------------------------------------------------------
|
-- Min/Max Select (FMIN/FMAX) -------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
min_max_select: process(fpu_operands, comp_less_ff, fpu_operands, fu_compare, ctrl_i)
|
min_max_select: process(fpu_operands, comp_less_ff, fu_compare, ctrl_i)
|
variable cond_v : std_ulogic_vector(2 downto 0);
|
variable cond_v : std_ulogic_vector(2 downto 0);
|
begin
|
begin
|
-- comparison restul - check for special cases: -0 is less than +0
|
-- comparison restul - check for special cases: -0 is less than +0
|
if ((fpu_operands.rs1_class(fp_class_neg_zero_c) = '1') and (fpu_operands.rs2_class(fp_class_pos_zero_c) = '1')) then
|
if ((fpu_operands.rs1_class(fp_class_neg_zero_c) = '1') and (fpu_operands.rs2_class(fp_class_pos_zero_c) = '1')) then
|
cond_v(0) := ctrl_i(ctrl_ir_funct3_0_c);
|
cond_v(0) := ctrl_i(ctrl_ir_funct3_0_c);
|