@@ -495,7 +495,7 @@ function signF32UI {
495495 }
496496 body {
497497 return a[31];
498- }
498+ }
499499}
500500
501501function expF32UI {
@@ -507,7 +507,7 @@ function expF32UI {
507507 }
508508 body {
509509 return a[30:23];
510- }
510+ }
511511}
512512
513513function fracF32UI {
@@ -519,16 +519,16 @@ function fracF32UI {
519519 }
520520 body {
521521 return a[22:0];
522- }
522+ }
523523}
524524
525525function returnNonSignalingNaN {
526526 returns U32
527- arguments
527+ arguments
528528 U32 a
529529 description {
530530 Returns a non-signalling NaN version of the floating-point number
531- Does not modify the input
531+ Does not modify the input
532532 }
533533 body {
534534 U32 a_copy = a;
@@ -550,7 +550,7 @@ function returnMag {
550550 # make sign bit zero
551551 a_copy[31] = 1'b0;
552552 return a_copy;
553- }
553+ }
554554}
555555
556556function returnLargerMag {
@@ -573,7 +573,7 @@ function returnLargerMag {
573573 if (mag_b < mag_a) {
574574 return nonsig_a;
575575 }
576- return (nonsig_a < nonsig_b) ? nonsig_a : nonsig_b;
576+ return (nonsig_a < nonsig_b) ? nonsig_a : nonsig_b;
577577 }
578578}
579579
@@ -589,14 +589,14 @@ function softfloat_propagateNaNF32UI {
589589| signaling NaN, the invalid exception is raised.
590590 }
591591 body {
592- # check if a and b are signalling
592+ # check if a and b are signalling
593593 Boolean isSigNaN_a = is_sp_signaling_nan?(a);
594594 Boolean isSigNaN_b = is_sp_signaling_nan?(b);
595595
596596 # get non Signalling versions of a and b
597597 U32 nonsig_a = returnNonSignalingNaN(a);
598598 U32 nonsig_b = returnNonSignalingNaN(b);
599-
599+
600600 if (isSigNaN_a || isSigNaN_b) {
601601 # raise invalid flag if either number is NaN
602602 set_fp_flag(FpFlag::NV);
@@ -609,10 +609,10 @@ function softfloat_propagateNaNF32UI {
609609 return is_sp_nan?(b) ? nonsig_b : nonsig_a;
610610 } else {
611611 return is_sp_nan?(a) ? nonsig_a : nonsig_b;
612- }
612+ }
613613 }
614614
615- }
615+ }
616616}
617617
618618function softfloat_addMagsF32 {
@@ -625,20 +625,20 @@ function softfloat_addMagsF32 {
625625 Returns sum of the magnitudes of 2 floating point numbers
626626 }
627627 body {
628-
628+
629629 # extract exponents and significands of a and b
630630 Bits<8> expA = expF32UI(a);
631631 Bits<23> sigA = fracF32UI(a);
632632 Bits<8> expB = expF32UI(b);
633633 Bits<23> sigB = fracF32UI(b);
634-
634+
635635 # declare a variable to store significand of sum
636636 U32 sigZ;
637637 # declare a variable to store sum of the magnitudes of the 2 numbers
638638 U32 z;
639639 # declare a variable to store sign of sum
640640 Bits<1> signZ;
641-
641+
642642 # declare a variable to store the exponent part of sum
643643 Bits<8> expZ;
644644
@@ -667,19 +667,19 @@ function softfloat_addMagsF32 {
667667
668668 # check if significand is even and exponent is less than 8'FE
669669 if (((sigZ & 0x1) == 0) && (expZ < 8'hFE)) {
670- # if significand is even, remove trailing zero
670+ # if significand is even, remove trailing zero
671671 sigZ = sigZ >> 1;
672672 # pack the sign, exponent and significand
673673 return (32'h0 + (signZ << 31) + (expZ << 23) + sigZ);
674674 }
675-
675+
676676 sigZ = sigZ << 6;
677677 } else {
678-
678+
679679 signZ = signF32UI(a);
680680
681681 U32 sigA_32 = 32'h0 + (sigA << 6);
682- U32 sigB_32 = 32'h0 + (sigA << 6);
682+ U32 sigB_32 = 32'h0 + (sigA << 6);
683683
684684 # check if B has a bigger exponent value than A
685685 if (expDiff < 0) {
@@ -711,15 +711,15 @@ function softfloat_addMagsF32 {
711711 sigB_32 = (expB == 0) ? 2*sigB_32 : (sigB_32 + 0x20000000);
712712 sigB_32 = softfloat_shiftRightJam32(sigB_32, (32'h0 + expDiff));
713713 }
714-
714+
715715 U32 sigZ = 0x20000000 + sigA + sigB;
716716 if ( sigZ < 0x40000000 ) {
717717 expZ = expZ - 1;
718718 sigZ = sigZ << 1;
719- }
719+ }
720720 }
721- return softfloat_roundPackToF32(signZ, expZ, sigZ[22:0], mode);
722- }
721+ return softfloat_roundPackToF32(signZ, expZ, sigZ[22:0], mode);
722+ }
723723}
724724
725725function softfloat_subMagsF32 {
@@ -732,28 +732,28 @@ function softfloat_subMagsF32 {
732732 Returns difference of the magnitudes of 2 floating point numbers
733733 }
734734 body {
735-
735+
736736 # extract exponents and significands of a and b
737737 Bits<8> expA = expF32UI(a);
738738 Bits<23> sigA = fracF32UI(a);
739739 Bits<8> expB = expF32UI(b);
740740 Bits<23> sigB = fracF32UI(b);
741-
741+
742742 # declare a variable to store significand of difference
743743 U32 sigZ;
744744 # declare a variable to store difference of the magnitudes of the 2 numbers
745745 U32 z;
746746 # declare a variable to store sign of difference
747747 Bits<1> signZ;
748-
748+
749749 # declare a variable to store the exponent part of difference
750750 Bits<8> expZ;
751751
752752 # declare a variable to store the difference in significand
753753 U32 sigDiff;
754754
755755 # declare a sigX and sigY
756- U32 sigX;
756+ U32 sigX;
757757 U32 sigY;
758758
759759 # declare a U32 sigA and sigB
@@ -767,7 +767,7 @@ function softfloat_subMagsF32 {
767767 Bits<8> expDiff = expA - expB;
768768
769769 if (expDiff == 8'd0) {
770-
770+
771771 # check if A is infinity or NaN
772772 if (expA == 8'hFF) {
773773 # A is NaN if significand is non-zero and exponent is 8'hFF
@@ -780,14 +780,14 @@ function softfloat_subMagsF32 {
780780
781781 sigDiff = sigA - sigB;
782782
783- # check if no difference in significand
783+ # check if no difference in significand
784784 if (sigDiff == 0) {
785785 # return -0 if rounding mode is round down, else return +0
786- return packToF32UI(((mode == RoundingMode::RDN) ? 1 : 0),0,0);
786+ return packToF32UI(((mode == RoundingMode::RDN) ? 1 : 0),0,0);
787787 }
788788
789789 if (expA != 0) {
790- expA = expA - 1;
790+ expA = expA - 1;
791791 }
792792
793793 signZ = signF32UI(a);
@@ -797,7 +797,7 @@ function softfloat_subMagsF32 {
797797 signZ = ~signZ;
798798 sigDiff = -32'sh1 * sigDiff;
799799 }
800-
800+
801801 shiftDist = count_leading_zeros<32>(sigDiff) - 8;
802802 expZ = expA - shiftDist;
803803
@@ -809,7 +809,7 @@ function softfloat_subMagsF32 {
809809 return packToF32UI(signZ, expZ, sigDiff << shiftDist);
810810
811811 } else {
812- # when difference in exponents are not zero
812+ # when difference in exponents are not zero
813813 signZ = signF32UI(a);
814814 sigA_32 = 32'h0 + (sigA << 7);
815815 sigB_32 = 32'h0 + (sigB << 7);
@@ -843,13 +843,13 @@ function softfloat_subMagsF32 {
843843
844844function f32_add {
845845 returns U32
846- arguments
846+ arguments
847847 U32 a,
848848 U32 b,
849849 RoundingMode mode
850850 description {
851851 Returns sum of 2 floating point numbers
852- }
852+ }
853853 body {
854854 U32 a_xor_b = a ^ b;
855855 if (signF32UI(a_xor_b) == 1) {
0 commit comments