typedef enum logic [1:0]{ flag_none, flag_nan, flag_inf, flag_zero } product_flags; module fp_product #(parameter N=16, M=5)(input_a, input_b, output_z, clk, reset); localparam K=N-M-1; // Size of mantissa input logic [N-1:0] input_a, input_b; input logic clk, reset; output logic [N-1:0] output_z; reg [K-1:0] a_m0, b_m0, z_m1; // mantissa reg [K-1:0] a_m1, b_m1, z_m2; // mantissa reg [K-1:0] a_m2, b_m2, z_m3; // mantissa reg [K-1:0] z_m4; reg [M:0] a_e0, b_e0, z_e1; // exponent reg [M:0] a_e1, b_e1, z_e2; // exponent reg [M:0] a_e2, b_e2, z_e3; // exponent reg [M:0] z_e4; reg a_s0, b_s0, z_s1; // sign reg a_s1, b_s1, z_s2; // sign reg a_s2, b_s2, z_s3; // sign reg z_s4; // sign product_flags flags1; // 00 for no flag, 01 for NaN, 10 for infinity, 11 for zero reg [2*K-1:0] z_p3; // For storing the product of the two mantissa always_comb begin // Packing the output output_z = {z_s4, z_e4 + (1<