module __hfloat16__sub( input wire [15:0] x, input wire [15:0] y, output wire [15:0] out ); function automatic priority_sel_1b_2way (input reg [1:0] sel, input reg case0, input reg case1, input reg default_value); begin casez (sel) 2'b?1: begin priority_sel_1b_2way = case0; end 2'b10: begin priority_sel_1b_2way = case1; end 2'b00: begin priority_sel_1b_2way = default_value; end default: begin // Propagate X priority_sel_1b_2way = 1'dx; end endcase end endfunction wire [4:0] y_bexp__2; wire literal_28171; wire [4:0] x_bexp__2; wire [4:0] y__1_bexpnot__1; wire [5:0] x_bexp_extended__2; wire [5:0] y__1_bexpnot_extended__1; wire [5:0] full_result; wire overflow_detected; wire [9:0] y_fraction__2; wire [9:0] tuple_index_28179; wire [4:0] x_bexp__3; wire [4:0] literal_28181; wire [4:0] y_bexp__3; wire literal_28183; wire [9:0] x_fraction__1; wire [9:0] y_fraction__3; wire nc; wire y_sign__2; wire [10:0] fraction_x; wire [10:0] fraction_y; wire [10:0] sign_ext_28193; wire [4:0] narrowed_result; wire [4:0] x_bexpor_mask__1; wire [3:0] literal_28196; wire tuple_index_28198; wire [10:0] fraction_x__1; wire [10:0] fraction_y__1; wire [2:0] xddend_x__2_squeezed_const_lsb_bits; wire [4:0] result; wire x_sign__1; wire y_sign__3; wire [11:0] wide_x_squeezed; wire [13:0] wide_y_shift_bits; wire [4:0] shift; wire [13:0] shrl_28212; wire [14:0] shll_28214; wire [11:0] xddend_x__2_squeezed; wire [10:0] literal_28224; wire [12:0] add_28225; wire sticky; wire [14:0] concat_28231; wire [14:0] xbs_fraction__1; wire carry_bit; wire nor_28265; wire nor_28267; wire nor_28260; wire nor_28262; wire and_28279; wire and_28290; wire [2:0] concat_28298; wire [2:0] concat_28297; wire [2:0] concat_28295; wire [2:0] concat_28294; wire [3:0] leading_zeroes; wire [15:0] cancel_fraction; wire [13:0] cancel_fraction__1; wire [13:0] carry_fraction__1; wire [13:0] shifted_fraction; wire [2:0] normal_chunk; wire [2:0] fraction_shift__3; wire [1:0] half_way_chunk; wire do_round_up; wire [11:0] add_28322; wire rounding_carry; wire [5:0] add_28334; wire [4:0] sub_28335; wire fraction_is_zero; wire [6:0] wide_exponent_associative_element; wire [6:0] wide_exponent_associative_element__1; wire [6:0] wide_exponent; wire [6:0] wide_exponent__1; wire [4:0] MAX_EXPONENT; wire [9:0] literal_28348; wire [5:0] wide_exponent__2; wire eq_28350; wire eq_28351; wire eq_28352; wire eq_28353; wire [2:0] fraction_shift__2; wire is_operand_inf; wire and_reduce_28371; wire has_pos_inf; wire has_neg_inf; wire [14:0] rounded_fraction; wire [2:0] fraction_shift__1; wire [14:0] shrl_28384; wire is_result_nan; wire result_sign; wire [9:0] result_fraction; wire [9:0] sign_ext_28390; wire result_sign__1; wire [9:0] result_fraction__3; wire [9:0] FRACTION_HIGH_BIT; wire result_sign__2; wire [4:0] result_exponent__2; wire [9:0] result_fraction__4; assign y_bexp__2 = y[14:10]; assign literal_28171 = 1'h0; assign x_bexp__2 = x[14:10]; assign y__1_bexpnot__1 = ~y_bexp__2; assign x_bexp_extended__2 = {literal_28171, x_bexp__2}; assign y__1_bexpnot_extended__1 = {literal_28171, y__1_bexpnot__1}; assign full_result = x_bexp_extended__2 + y__1_bexpnot_extended__1; assign overflow_detected = full_result[5]; assign y_fraction__2 = y[9:0]; assign tuple_index_28179 = x[9:0]; assign x_bexp__3 = overflow_detected ? x_bexp__2 : y_bexp__2; assign literal_28181 = 5'h00; assign y_bexp__3 = overflow_detected ? y_bexp__2 : x_bexp__2; assign literal_28183 = 1'h1; assign x_fraction__1 = overflow_detected ? tuple_index_28179 : y_fraction__2; assign y_fraction__3 = overflow_detected ? y_fraction__2 : tuple_index_28179; assign nc = ~overflow_detected; assign y_sign__2 = y[15:15]; assign fraction_x = {literal_28183, x_fraction__1}; assign fraction_y = {literal_28183, y_fraction__3}; assign sign_ext_28193 = {11{y_bexp__3 != literal_28181}}; assign narrowed_result = full_result[4:0]; assign x_bexpor_mask__1 = {5{nc}}; assign literal_28196 = 4'h0; assign tuple_index_28198 = x[15:15]; assign fraction_x__1 = fraction_x & {11{x_bexp__3 != literal_28181}}; assign fraction_y__1 = fraction_y & sign_ext_28193; assign xddend_x__2_squeezed_const_lsb_bits = 3'h0; assign result = narrowed_result ^ x_bexpor_mask__1; assign x_sign__1 = overflow_detected ? tuple_index_28198 : ~y_sign__2; assign y_sign__3 = overflow_detected ? ~y_sign__2 : tuple_index_28198; assign wide_x_squeezed = {literal_28171, fraction_x__1}; assign wide_y_shift_bits = {fraction_y__1, xddend_x__2_squeezed_const_lsb_bits}; assign shift = result + {literal_28196, overflow_detected}; assign shrl_28212 = shift >= 5'h0e ? 14'h0000 : wide_y_shift_bits >> shift; assign shll_28214 = shift >= 5'h0f ? 15'h0000 : 15'h7fff << shift; assign xddend_x__2_squeezed = x_sign__1 ^ y_sign__3 ? -wide_x_squeezed : wide_x_squeezed; assign literal_28224 = 11'h000; assign add_28225 = {{1{xddend_x__2_squeezed[11]}}, xddend_x__2_squeezed} + {2'h0, shrl_28212[13:3]}; assign sticky = ~({literal_28171, ~y_fraction__3} | ~sign_ext_28193 | shll_28214[13:3]) != literal_28224; assign concat_28231 = {add_28225[11:0], shrl_28212[2:1], shrl_28212[0] | sticky}; assign xbs_fraction__1 = add_28225[12] ? -concat_28231 : concat_28231; assign carry_bit = xbs_fraction__1[14]; assign nor_28265 = ~(xbs_fraction__1[12] | xbs_fraction__1[11]); assign nor_28267 = ~(xbs_fraction__1[8] | xbs_fraction__1[7]); assign nor_28260 = ~(xbs_fraction__1[4] | xbs_fraction__1[3]); assign nor_28262 = ~(xbs_fraction__1[6] | xbs_fraction__1[5]); assign and_28279 = ~(carry_bit | xbs_fraction__1[13]) & nor_28265; assign and_28290 = ~(xbs_fraction__1[10] | xbs_fraction__1[9]) & nor_28267; assign concat_28298 = {literal_28171, ~(carry_bit | xbs_fraction__1[13] | nor_28265) ? {literal_28183, ~(xbs_fraction__1[12] | ~xbs_fraction__1[11])} : {literal_28171, ~(carry_bit | ~xbs_fraction__1[13])}}; assign concat_28297 = {literal_28183, ~(xbs_fraction__1[10] | xbs_fraction__1[9] | nor_28267) ? {literal_28183, ~(xbs_fraction__1[8] | ~xbs_fraction__1[7])} : {literal_28171, ~(xbs_fraction__1[10] | ~xbs_fraction__1[9])}}; assign concat_28295 = {literal_28171, ~(xbs_fraction__1[6] | xbs_fraction__1[5] | nor_28260) ? {literal_28183, ~(xbs_fraction__1[4] | ~xbs_fraction__1[3])} : {nor_28262, ~(xbs_fraction__1[6] | ~xbs_fraction__1[5])}}; assign concat_28294 = {literal_28183, ~(xbs_fraction__1[2] | xbs_fraction__1[1]) ? {literal_28183, ~xbs_fraction__1[0]} : {literal_28171, ~(xbs_fraction__1[2] | ~xbs_fraction__1[1])}}; assign leading_zeroes = and_28279 & and_28290 ? {literal_28183, nor_28262 & nor_28260 ? concat_28294 : concat_28295} : {literal_28171, ~(~and_28279 | and_28290) ? concat_28297 : concat_28298}; assign cancel_fraction = {literal_28171, xbs_fraction__1} << leading_zeroes; assign cancel_fraction__1 = cancel_fraction[14:1]; assign carry_fraction__1 = {xbs_fraction__1[14:2], xbs_fraction__1[1] | xbs_fraction__1[0]}; assign shifted_fraction = carry_bit ? carry_fraction__1 : cancel_fraction__1; assign normal_chunk = shifted_fraction[2:0]; assign fraction_shift__3 = 3'h4; assign half_way_chunk = shifted_fraction[3:2]; assign do_round_up = normal_chunk > fraction_shift__3 | half_way_chunk == 2'h3; assign add_28322 = {literal_28171, shifted_fraction[13:3]} + {literal_28224, do_round_up}; assign rounding_carry = add_28322[11]; assign add_28334 = {literal_28171, x_bexp__3} + 6'h01; assign sub_28335 = {literal_28196, rounding_carry} - {literal_28171, leading_zeroes}; assign fraction_is_zero = add_28225 == 13'h0000 & ~(shrl_28212[1] | shrl_28212[2]) & ~(shrl_28212[0] | sticky); assign wide_exponent_associative_element = {literal_28171, add_28334}; assign wide_exponent_associative_element__1 = {{2{sub_28335[4]}}, sub_28335}; assign wide_exponent = wide_exponent_associative_element + wide_exponent_associative_element__1; assign wide_exponent__1 = wide_exponent & {7{~fraction_is_zero}}; assign MAX_EXPONENT = 5'h1f; assign literal_28348 = 10'h000; assign wide_exponent__2 = wide_exponent__1[5:0] & {6{~wide_exponent__1[6]}}; assign eq_28350 = x_bexp__3 == MAX_EXPONENT; assign eq_28351 = x_fraction__1 == literal_28348; assign eq_28352 = y_bexp__3 == MAX_EXPONENT; assign eq_28353 = y_fraction__3 == literal_28348; assign fraction_shift__2 = 3'h3; assign is_operand_inf = eq_28350 & eq_28351 | eq_28352 & eq_28353; assign and_reduce_28371 = &wide_exponent__2[4:0]; assign has_pos_inf = ~(~eq_28350 | ~eq_28351 | x_sign__1) | ~(~eq_28352 | ~eq_28353 | y_sign__3); assign has_neg_inf = eq_28350 & eq_28351 & x_sign__1 | eq_28352 & eq_28353 & y_sign__3; assign rounded_fraction = {add_28322, normal_chunk}; assign fraction_shift__1 = rounding_carry ? fraction_shift__3 : fraction_shift__2; assign shrl_28384 = rounded_fraction >> fraction_shift__1; assign is_result_nan = ~(~eq_28350 | eq_28351) | ~(~eq_28352 | eq_28353) | has_pos_inf & has_neg_inf; assign result_sign = priority_sel_1b_2way({add_28225[12], fraction_is_zero}, x_sign__1 & y_sign__3, ~y_sign__3, y_sign__3); assign result_fraction = shrl_28384[9:0]; assign sign_ext_28390 = {10{~(is_operand_inf | wide_exponent__2[5] | and_reduce_28371 | ~((|wide_exponent__2[5:1]) | wide_exponent__2[0]))}}; assign result_sign__1 = is_operand_inf ? ~has_pos_inf : result_sign; assign result_fraction__3 = result_fraction & sign_ext_28390; assign FRACTION_HIGH_BIT = 10'h200; assign result_sign__2 = ~is_result_nan & result_sign__1; assign result_exponent__2 = is_result_nan | is_operand_inf | wide_exponent__2[5] | and_reduce_28371 ? MAX_EXPONENT : wide_exponent__2[4:0]; assign result_fraction__4 = is_result_nan ? FRACTION_HIGH_BIT : result_fraction__3; assign out = {result_sign__2, result_exponent__2, result_fraction__4}; endmodule