mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	some optimizations in unpacker
This commit is contained in:
		
							parent
							
								
									b288f812ab
								
							
						
					
					
						commit
						3c63db9554
					
				| @ -1 +1 @@ | |||||||
| Subproject commit 307c77b26e070ae85ffea665ad9b642b40e33c86 | Subproject commit ad04e119a5d846a1c11159786ad3382cf5ad3649 | ||||||
| @ -17,9 +17,9 @@ module fcvt ( | |||||||
|     input logic             XSNaNE,         // is the input a signaling NaN
 |     input logic             XSNaNE,         // is the input a signaling NaN
 | ||||||
|     input logic [2:0]       FrmE,           // rounding mode 000 = rount to nearest, ties to even   001 = round twords zero  010 = round down  011 = round up  100 = round to nearest, ties to max magnitude
 |     input logic [2:0]       FrmE,           // rounding mode 000 = rount to nearest, ties to even   001 = round twords zero  010 = round down  011 = round up  100 = round to nearest, ties to max magnitude
 | ||||||
|     input logic [`FPSIZES/3:0] FmtE,        // the input's precision (11=quad 01=double 00=single 10=half)
 |     input logic [`FPSIZES/3:0] FmtE,        // the input's precision (11=quad 01=double 00=single 10=half)
 | ||||||
|     output logic [`FLEN-1:0] CvtResE,       // the fp to fp conversion's result
 |     output logic [`FLEN-1:0] CvtResE,       // the fp conversion result
 | ||||||
|     output logic [`XLEN-1:0] CvtIntResE,    // the fp to fp conversion's result
 |     output logic [`XLEN-1:0] CvtIntResE,    // the int conversion result
 | ||||||
|     output logic [4:0]      CvtFlgE         // the fp to fp conversion's flags
 |     output logic [4:0]      CvtFlgE         // the conversion's flags
 | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     // OpCtrls:
 |     // OpCtrls:
 | ||||||
| @ -261,7 +261,7 @@ module fcvt ( | |||||||
|     //                  - shift left to normilize (-1-ZeroCnt)
 |     //                  - shift left to normilize (-1-ZeroCnt)
 | ||||||
|     //                  - newBias to make the biased exponent
 |     //                  - newBias to make the biased exponent
 | ||||||
|     //          
 |     //          
 | ||||||
|     assign CalcExp = {1'b0, OldExp} - (`NE+1)'(`BIAS) + {2'b0, NewBias} - {{`NE{1'b0}}, XOrigDenormE|IntToFp} - {{`NE-$clog2(`LGLEN){1'b0}}, (ZeroCnt&{$clog2(`LGLEN)+1{XOrigDenormE|IntToFp}})}; |     assign CalcExp = {1'b0, OldExp} - (`NE+1)'(`BIAS) + {2'b0, NewBias} - {{`NE{1'b0}}, XOrigDenormE|IntToFp} - {{`NE-$clog2(`LGLEN)+1{1'b0}}, (ZeroCnt&{$clog2(`LGLEN){XOrigDenormE|IntToFp}})}; | ||||||
|     // find if the result is dnormal or underflows
 |     // find if the result is dnormal or underflows
 | ||||||
|     //      - if Calculated expoenent is 0 or negitive (and the input/result is not exactaly 0)
 |     //      - if Calculated expoenent is 0 or negitive (and the input/result is not exactaly 0)
 | ||||||
|     //      - can't underflow an integer to Fp conversion
 |     //      - can't underflow an integer to Fp conversion
 | ||||||
| @ -744,7 +744,7 @@ module fcvt ( | |||||||
|                         NaNRes = {{`Q_LEN-`H_LEN{1'b1}}, 1'b0, {`H_NE+1{1'b1}}, {`H_NF-1{1'b0}}}; |                         NaNRes = {{`Q_LEN-`H_LEN{1'b1}}, 1'b0, {`H_NE+1{1'b1}}, {`H_NF-1{1'b0}}}; | ||||||
|                     end |                     end | ||||||
|                     // determine the infinity result
 |                     // determine the infinity result
 | ||||||
|                     //      - if the input was infinity or rounding mode RZ, RU, RD (and not rounding the value) then output the maximum normalized floating point number with the correct sign
 |                     //      - if the input overflows in rounding mode RZ, RU, RD (and not rounding the value) then output the maximum normalized floating point number with the correct sign
 | ||||||
|                     //      - otherwise: output infinity with the correct sign
 |                     //      - otherwise: output infinity with the correct sign
 | ||||||
|                     //      - kill the infinity singal if the input isn't fp
 |                     //      - kill the infinity singal if the input isn't fp
 | ||||||
|                     InfRes = (~XInfE|IntToFp)&((FrmE[1:0]==2'b01) | (FrmE[1:0]==2'b10&~ResSgn) | (FrmE[1:0]==2'b11&ResSgn)) ? {{`Q_LEN-`H_LEN{1'b1}}, ResSgn, {`H_NE-1{1'b1}}, 1'b0, {`H_NF{1'b1}}} : {{`Q_LEN-`H_LEN{1'b1}}, ResSgn, {`H_NE{1'b1}}, (`H_NF)'(0)}; |                     InfRes = (~XInfE|IntToFp)&((FrmE[1:0]==2'b01) | (FrmE[1:0]==2'b10&~ResSgn) | (FrmE[1:0]==2'b11&ResSgn)) ? {{`Q_LEN-`H_LEN{1'b1}}, ResSgn, {`H_NE-1{1'b1}}, 1'b0, {`H_NF{1'b1}}} : {{`Q_LEN-`H_LEN{1'b1}}, ResSgn, {`H_NE{1'b1}}, (`H_NF)'(0)}; | ||||||
|  | |||||||
| @ -587,7 +587,7 @@ module normalize( | |||||||
|     ///////////////////////////////////////////////////////////////////////////////
 |     ///////////////////////////////////////////////////////////////////////////////
 | ||||||
|     // Normalization
 |     // Normalization
 | ||||||
|     ///////////////////////////////////////////////////////////////////////////////
 |     ///////////////////////////////////////////////////////////////////////////////
 | ||||||
|     //*** insert bias-bias simplification in fcvt.sv/phone pictures/ whiteboard... if still there
 |     //*** insert bias-bias simplification in fcvt.sv/phone pictures
 | ||||||
|     // Determine if the sum is zero
 |     // Determine if the sum is zero
 | ||||||
|     assign SumZero = ~(|SumM); |     assign SumZero = ~(|SumM); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -96,9 +96,9 @@ module unpack ( | |||||||
| 
 | 
 | ||||||
|         // extract the exponent, converting the smaller exponent into the larger precision if nessisary
 |         // extract the exponent, converting the smaller exponent into the larger precision if nessisary
 | ||||||
|         //      - if the original precision had a denormal number convert the exponent value 1
 |         //      - if the original precision had a denormal number convert the exponent value 1
 | ||||||
|         assign XExpE = FmtE ? X[`FLEN-2:`NF] : XOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {XLen1[`LEN1-2], {`NE-`NE1{~XLen1[`LEN1-2]&~XExpZero|XExpMaxE}}, XLen1[`LEN1-3:`NF1]};  |         assign XExpE = FmtE ? X[`FLEN-2:`NF] : XOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {XLen1[`LEN1-2], {`NE-`NE1{~XLen1[`LEN1-2]}}, XLen1[`LEN1-3:`NF1]};  | ||||||
|         assign YExpE = FmtE ? Y[`FLEN-2:`NF] : YOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {YLen1[`LEN1-2], {`NE-`NE1{~YLen1[`LEN1-2]&~YExpZero|YExpMaxE}}, YLen1[`LEN1-3:`NF1]};  |         assign YExpE = FmtE ? Y[`FLEN-2:`NF] : YOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {YLen1[`LEN1-2], {`NE-`NE1{~YLen1[`LEN1-2]}}, YLen1[`LEN1-3:`NF1]};  | ||||||
|         assign ZExpE = FmtE ? Z[`FLEN-2:`NF] : ZOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {ZLen1[`LEN1-2], {`NE-`NE1{~ZLen1[`LEN1-2]&~ZExpZero|ZExpMaxE}}, ZLen1[`LEN1-3:`NF1]};  |         assign ZExpE = FmtE ? Z[`FLEN-2:`NF] : ZOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {ZLen1[`LEN1-2], {`NE-`NE1{~ZLen1[`LEN1-2]}}, ZLen1[`LEN1-3:`NF1]};  | ||||||
| 
 | 
 | ||||||
|         // is the input (in it's original format) denormalized
 |         // is the input (in it's original format) denormalized
 | ||||||
|         assign XOrigDenormE = FmtE ? 0 : ~|XLen1[`LEN1-2:`NF1] & ~XFracZero;  |         assign XOrigDenormE = FmtE ? 0 : ~|XLen1[`LEN1-2:`NF1] & ~XFracZero;  | ||||||
| @ -257,9 +257,9 @@ module unpack ( | |||||||
|                     // also need to take into account possible zero/denorm/inf/NaN values
 |                     // also need to take into account possible zero/denorm/inf/NaN values
 | ||||||
| 
 | 
 | ||||||
|                     // convert the larger precision's exponent to use the largest precision's bias
 |                     // convert the larger precision's exponent to use the largest precision's bias
 | ||||||
|                     XExpE = XOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {XLen1[`LEN1-2], {`NE-`NE1{~XLen1[`LEN1-2]&~XExpZero|XExpMaxE}}, XLen1[`LEN1-3:`NF1]};  |                     XExpE = XOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {XLen1[`LEN1-2], {`NE-`NE1{~XLen1[`LEN1-2]}}, XLen1[`LEN1-3:`NF1]};  | ||||||
|                     YExpE = YOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {YLen1[`LEN1-2], {`NE-`NE1{~YLen1[`LEN1-2]&~YExpZero|YExpMaxE}}, YLen1[`LEN1-3:`NF1]};  |                     YExpE = YOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {YLen1[`LEN1-2], {`NE-`NE1{~YLen1[`LEN1-2]}}, YLen1[`LEN1-3:`NF1]};  | ||||||
|                     ZExpE = ZOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {ZLen1[`LEN1-2], {`NE-`NE1{~ZLen1[`LEN1-2]&~ZExpZero|ZExpMaxE}}, ZLen1[`LEN1-3:`NF1]};  |                     ZExpE = ZOrigDenormE ? {1'b0, {`NE-`NE1{1'b1}}, (`NE1-1)'(1)} : {ZLen1[`LEN1-2], {`NE-`NE1{~ZLen1[`LEN1-2]}}, ZLen1[`LEN1-3:`NF1]};  | ||||||
| 
 | 
 | ||||||
|                     // extract the fraction and add the nessesary trailing zeros
 |                     // extract the fraction and add the nessesary trailing zeros
 | ||||||
|                     XFracE = {XLen1[`NF1-1:0], (`NF-`NF1)'(0)}; |                     XFracE = {XLen1[`NF1-1:0], (`NF-`NF1)'(0)}; | ||||||
| @ -282,9 +282,9 @@ module unpack ( | |||||||
|                     // also need to take into account possible zero/denorm/inf/NaN values
 |                     // also need to take into account possible zero/denorm/inf/NaN values
 | ||||||
|                      |                      | ||||||
|                     // convert the smallest precision's exponent to use the largest precision's bias
 |                     // convert the smallest precision's exponent to use the largest precision's bias
 | ||||||
|                     XExpE = XOrigDenormE ? {1'b0, {`NE-`NE2{1'b1}}, (`NE2-1)'(1)} : {XLen2[`LEN2-2], {`NE-`NE2{~XLen2[`LEN2-2]&~XExpZero|XExpMaxE}}, XLen2[`LEN2-3:`NF2]};  |                     XExpE = XOrigDenormE ? {1'b0, {`NE-`NE2{1'b1}}, (`NE2-1)'(1)} : {XLen2[`LEN2-2], {`NE-`NE2{~XLen2[`LEN2-2]}}, XLen2[`LEN2-3:`NF2]};  | ||||||
|                     YExpE = YOrigDenormE ? {1'b0, {`NE-`NE2{1'b1}}, (`NE2-1)'(1)} : {YLen2[`LEN2-2], {`NE-`NE2{~YLen2[`LEN2-2]&~YExpZero|YExpMaxE}}, YLen2[`LEN2-3:`NF2]};  |                     YExpE = YOrigDenormE ? {1'b0, {`NE-`NE2{1'b1}}, (`NE2-1)'(1)} : {YLen2[`LEN2-2], {`NE-`NE2{~YLen2[`LEN2-2]}}, YLen2[`LEN2-3:`NF2]};  | ||||||
|                     ZExpE = ZOrigDenormE ? {1'b0, {`NE-`NE2{1'b1}}, (`NE2-1)'(1)} : {ZLen2[`LEN2-2], {`NE-`NE2{~ZLen2[`LEN2-2]&~ZExpZero|ZExpMaxE}}, ZLen2[`LEN2-3:`NF2]};  |                     ZExpE = ZOrigDenormE ? {1'b0, {`NE-`NE2{1'b1}}, (`NE2-1)'(1)} : {ZLen2[`LEN2-2], {`NE-`NE2{~ZLen2[`LEN2-2]}}, ZLen2[`LEN2-3:`NF2]};  | ||||||
| 
 | 
 | ||||||
|                     // extract the fraction and add the nessesary trailing zeros
 |                     // extract the fraction and add the nessesary trailing zeros
 | ||||||
|                     XFracE = {XLen2[`NF2-1:0], (`NF-`NF2)'(0)}; |                     XFracE = {XLen2[`NF2-1:0], (`NF-`NF2)'(0)}; | ||||||
| @ -447,9 +447,9 @@ module unpack ( | |||||||
|                      |                      | ||||||
|                     // convert the double precsion exponent into quad precsion
 |                     // convert the double precsion exponent into quad precsion
 | ||||||
| 
 | 
 | ||||||
|                     XExpE = XOrigDenormE ? {1'b0, {`Q_NE-`D_NE{1'b1}}, (`D_NE-1)'(1)} : {XLen1[`D_LEN-2], {`Q_NE-`D_NE{~XLen1[`D_LEN-2]&~XExpZero|XExpMaxE}}, XLen1[`D_LEN-3:`D_NF]};  |                     XExpE = XOrigDenormE ? {1'b0, {`Q_NE-`D_NE{1'b1}}, (`D_NE-1)'(1)} : {XLen1[`D_LEN-2], {`Q_NE-`D_NE{~XLen1[`D_LEN-2]}}, XLen1[`D_LEN-3:`D_NF]};  | ||||||
|                     YExpE = YOrigDenormE ? {1'b0, {`Q_NE-`D_NE{1'b1}}, (`D_NE-1)'(1)} : {YLen1[`D_LEN-2], {`Q_NE-`D_NE{~YLen1[`D_LEN-2]&~YExpZero|YExpMaxE}}, YLen1[`D_LEN-3:`D_NF]};  |                     YExpE = YOrigDenormE ? {1'b0, {`Q_NE-`D_NE{1'b1}}, (`D_NE-1)'(1)} : {YLen1[`D_LEN-2], {`Q_NE-`D_NE{~YLen1[`D_LEN-2]}}, YLen1[`D_LEN-3:`D_NF]};  | ||||||
|                     ZExpE = ZOrigDenormE ? {1'b0, {`Q_NE-`D_NE{1'b1}}, (`D_NE-1)'(1)} : {ZLen1[`D_LEN-2], {`Q_NE-`D_NE{~ZLen1[`D_LEN-2]&~ZExpZero|ZExpMaxE}}, ZLen1[`D_LEN-3:`D_NF]};  |                     ZExpE = ZOrigDenormE ? {1'b0, {`Q_NE-`D_NE{1'b1}}, (`D_NE-1)'(1)} : {ZLen1[`D_LEN-2], {`Q_NE-`D_NE{~ZLen1[`D_LEN-2]}}, ZLen1[`D_LEN-3:`D_NF]};  | ||||||
| 
 | 
 | ||||||
|                     // extract the fraction and add the nessesary trailing zeros
 |                     // extract the fraction and add the nessesary trailing zeros
 | ||||||
|                     XFracE = {XLen1[`D_NF-1:0], (`Q_NF-`D_NF)'(0)}; |                     XFracE = {XLen1[`D_NF-1:0], (`Q_NF-`D_NF)'(0)}; | ||||||
| @ -471,9 +471,9 @@ module unpack ( | |||||||
|                     // also need to take into account possible zero/denorm/inf/NaN values
 |                     // also need to take into account possible zero/denorm/inf/NaN values
 | ||||||
|                      |                      | ||||||
|                     // convert the single precsion exponent into quad precsion
 |                     // convert the single precsion exponent into quad precsion
 | ||||||
|                     XExpE = XOrigDenormE ? {1'b0, {`Q_NE-`S_NE{1'b1}}, (`S_NE-1)'(1)} : {XLen2[`S_LEN-2], {`Q_NE-`S_NE{~XLen2[`S_LEN-2]&~XExpZero|XExpMaxE}}, XLen2[`S_LEN-3:`S_NF]};  |                     XExpE = XOrigDenormE ? {1'b0, {`Q_NE-`S_NE{1'b1}}, (`S_NE-1)'(1)} : {XLen2[`S_LEN-2], {`Q_NE-`S_NE{~XLen2[`S_LEN-2]}}, XLen2[`S_LEN-3:`S_NF]};  | ||||||
|                     YExpE = YOrigDenormE ? {1'b0, {`Q_NE-`S_NE{1'b1}}, (`S_NE-1)'(1)} : {YLen2[`S_LEN-2], {`Q_NE-`S_NE{~YLen2[`S_LEN-2]&~YExpZero|YExpMaxE}}, YLen2[`S_LEN-3:`S_NF]};  |                     YExpE = YOrigDenormE ? {1'b0, {`Q_NE-`S_NE{1'b1}}, (`S_NE-1)'(1)} : {YLen2[`S_LEN-2], {`Q_NE-`S_NE{~YLen2[`S_LEN-2]}}, YLen2[`S_LEN-3:`S_NF]};  | ||||||
|                     ZExpE = ZOrigDenormE ? {1'b0, {`Q_NE-`S_NE{1'b1}}, (`S_NE-1)'(1)} : {ZLen2[`S_LEN-2], {`Q_NE-`S_NE{~ZLen2[`S_LEN-2]&~ZExpZero|ZExpMaxE}}, ZLen2[`S_LEN-3:`S_NF]};  |                     ZExpE = ZOrigDenormE ? {1'b0, {`Q_NE-`S_NE{1'b1}}, (`S_NE-1)'(1)} : {ZLen2[`S_LEN-2], {`Q_NE-`S_NE{~ZLen2[`S_LEN-2]}}, ZLen2[`S_LEN-3:`S_NF]};  | ||||||
| 
 | 
 | ||||||
|                     // extract the fraction and add the nessesary trailing zeros
 |                     // extract the fraction and add the nessesary trailing zeros
 | ||||||
|                     XFracE = {XLen2[`S_NF-1:0], (`Q_NF-`S_NF)'(0)}; |                     XFracE = {XLen2[`S_NF-1:0], (`Q_NF-`S_NF)'(0)}; | ||||||
| @ -495,9 +495,9 @@ module unpack ( | |||||||
|                     // also need to take into account possible zero/denorm/inf/NaN values
 |                     // also need to take into account possible zero/denorm/inf/NaN values
 | ||||||
| 
 | 
 | ||||||
|                     // convert the half precsion exponent into quad precsion
 |                     // convert the half precsion exponent into quad precsion
 | ||||||
|                     XExpE = XOrigDenormE ? {1'b0, {`Q_NE-`H_NE{1'b1}}, (`H_NE-1)'(1)} : {XLen3[`H_LEN-2], {`Q_NE-`H_NE{~XLen3[`H_LEN-2]&~XExpZero|XExpMaxE}}, XLen3[`H_LEN-3:`H_NF]};  |                     XExpE = XOrigDenormE ? {1'b0, {`Q_NE-`H_NE{1'b1}}, (`H_NE-1)'(1)} : {XLen3[`H_LEN-2], {`Q_NE-`H_NE{~XLen3[`H_LEN-2]}}, XLen3[`H_LEN-3:`H_NF]};  | ||||||
|                     YExpE = YOrigDenormE ? {1'b0, {`Q_NE-`H_NE{1'b1}}, (`H_NE-1)'(1)} : {YLen3[`H_LEN-2], {`Q_NE-`H_NE{~YLen3[`H_LEN-2]&~YExpZero|YExpMaxE}}, YLen3[`H_LEN-3:`H_NF]};  |                     YExpE = YOrigDenormE ? {1'b0, {`Q_NE-`H_NE{1'b1}}, (`H_NE-1)'(1)} : {YLen3[`H_LEN-2], {`Q_NE-`H_NE{~YLen3[`H_LEN-2]}}, YLen3[`H_LEN-3:`H_NF]};  | ||||||
|                     ZExpE = ZOrigDenormE ? {1'b0, {`Q_NE-`H_NE{1'b1}}, (`H_NE-1)'(1)} : {ZLen3[`H_LEN-2], {`Q_NE-`H_NE{~ZLen3[`H_LEN-2]&~ZExpZero|ZExpMaxE}}, ZLen3[`H_LEN-3:`H_NF]};  |                     ZExpE = ZOrigDenormE ? {1'b0, {`Q_NE-`H_NE{1'b1}}, (`H_NE-1)'(1)} : {ZLen3[`H_LEN-2], {`Q_NE-`H_NE{~ZLen3[`H_LEN-2]}}, ZLen3[`H_LEN-3:`H_NF]};  | ||||||
| 
 | 
 | ||||||
|                     // extract the fraction and add the nessesary trailing zeros
 |                     // extract the fraction and add the nessesary trailing zeros
 | ||||||
|                     XFracE = {XLen3[`H_NF-1:0], (`Q_NF-`H_NF)'(0)}; |                     XFracE = {XLen3[`H_NF-1:0], (`Q_NF-`H_NF)'(0)}; | ||||||
|  | |||||||
| @ -3,11 +3,13 @@ module lzc #(parameter WIDTH=1) ( | |||||||
|     input logic  [WIDTH-1:0]            num, |     input logic  [WIDTH-1:0]            num, | ||||||
|     output logic [$clog2(WIDTH)-1:0]  ZeroCnt |     output logic [$clog2(WIDTH)-1:0]  ZeroCnt | ||||||
| ); | ); | ||||||
|  | /* verilator lint_off CMPCONST */ | ||||||
|      |      | ||||||
|     logic [$clog2(WIDTH)-1:0] i; |     logic [$clog2(WIDTH)-1:0] i; | ||||||
|     always_comb begin |     always_comb begin | ||||||
|         i = 0; |         i = 0; | ||||||
|         while (~num[WIDTH-1-i] & $unsigned(i) <= $unsigned(WIDTH-1)) i = i+1;  // search for leading one
 |         while (~num[WIDTH-1-(32)'(i)] & $unsigned(i) <= $unsigned(($clog2(WIDTH))'(WIDTH-1))) i = i+1;  // search for leading one
 | ||||||
|         ZeroCnt = i; |         ZeroCnt = i; | ||||||
|     end |     end | ||||||
|  | /* verilator lint_on CMPCONST */ | ||||||
| endmodule | endmodule | ||||||
|  | |||||||
| @ -1174,13 +1174,13 @@ end | |||||||
|   ///////////////////////////////////////////////////////////////////////////////////////////////
 |   ///////////////////////////////////////////////////////////////////////////////////////////////
 | ||||||
| 
 | 
 | ||||||
|     // check if the non-fma test is correct
 |     // check if the non-fma test is correct
 | ||||||
|     if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&(UnitVal !== `CVTINTUNIT)) begin |     if(~((Res === Ans | NaNGood | NaNGood === 1'bx) & (ResFlg === AnsFlg | AnsFlg === 5'bx))&(UnitVal !== `CVTINTUNIT)&(UnitVal !== `CMPUNIT)) begin | ||||||
|       errors += 1; |       errors += 1; | ||||||
|       $display("There is an error in %s", Tests[TestNum]); |       $display("There is an error in %s", Tests[TestNum]); | ||||||
|       $display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Ans: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg); |       $display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Ans: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg); | ||||||
|       $stop; |       $stop; | ||||||
|     end |     end | ||||||
| 
 |      | ||||||
|     // TestFloat sets the result to all 1's when there is an invalid result, however in 
 |     // TestFloat sets the result to all 1's when there is an invalid result, however in 
 | ||||||
|     // http://www.jhauser.us/arithmetic/TestFloat-3/doc/TestFloat-general.html it says
 |     // http://www.jhauser.us/arithmetic/TestFloat-3/doc/TestFloat-general.html it says
 | ||||||
|     // for an unsigned integer result 0 is also okay
 |     // for an unsigned integer result 0 is also okay
 | ||||||
| @ -1470,7 +1470,7 @@ module readvectors ( | |||||||
|             Ans = TestVector[8]; |             Ans = TestVector[8]; | ||||||
|           end |           end | ||||||
|           2'b10:	begin	  // half
 |           2'b10:	begin	  // half
 | ||||||
|             X = {{`FLEN-`H_LEN{1'b1}}, TestVector[12+3*(`H_LEN)-1:12+(`H_LEN)]}; |             X = {{`FLEN-`H_LEN{1'b1}}, TestVector[12+2*(`H_LEN)-1:12+(`H_LEN)]}; | ||||||
|             Y = {{`FLEN-`H_LEN{1'b1}}, TestVector[12+(`H_LEN)-1:12]}; |             Y = {{`FLEN-`H_LEN{1'b1}}, TestVector[12+(`H_LEN)-1:12]}; | ||||||
|             Ans = TestVector[8]; |             Ans = TestVector[8]; | ||||||
|           end |           end | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user