******************************************************************************************
HERE IS THE CODE I IMPLEMENTED FOR DENORMALIZATION OF A IEEE 754 DOUBLE PRECISION NUMBER
******************************************************************************************
module denorm_orig(D_in, Dnorm);
input [63:0]D_in; // In IEEE 754 double precision format
output reg [63:0] Dnorm;
reg [63:0] fract_U1;
reg [10:0] exponent_U1;
always@(*) begin
fract_U1 = {1'b1,D_in[51:0],11'b0}; // Fraction part - denormalized 64 bits
exponent_U1 = (11'd1022- D_in[62:52]); // Exponent part
fract_U1 = (exponent_U1[5])?{32'b0,fract_U1[63:32]}: {fract_U1 }; // Check if this (32nd or 5th) bit is zero , if not zero , then keep the value as it is
fract_U1 = (exponent_U1[4])?{16'b0,fract_U1[63:16]}: {fract_U1 };
fract_U1 = (exponent_U1[3])?{ 8'b0,fract_U1[63:8 ]}: {fract_U1 };
fract_U1 = (exponent_U1[2])?{ 4'b0,fract_U1[63:4 ]}: {fract_U1 };
fract_U1 = (exponent_U1[1])?{ 2'b0,fract_U1[63:2 ]}: {fract_U1 };
fract_U1 = (exponent_U1[0])?{ 1'b0,fract_U1[63:1 ]}: {fract_U1 };
Dnorm = fract_U1 [63:55];
end
endmodule