mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Merge branch 'main' of github.com:davidharrishmc/riscv-wally into main
This commit is contained in:
		
						commit
						51426ab71a
					
				@ -23,5 +23,6 @@ add wave -group {Divide} -noupdate /testbenchfp/srtradix4/qsel4/*
 | 
			
		||||
add wave -group {Divide} -noupdate /testbenchfp/srtradix4/otfc4/*
 | 
			
		||||
add wave -group {Divide} -noupdate /testbenchfp/srtradix4/preproc/*
 | 
			
		||||
add wave -group {Divide} -noupdate /testbenchfp/srtradix4/divcounter/*
 | 
			
		||||
add wave -group {Divide} -noupdate /testbenchfp/srtradix4/expcalc/*
 | 
			
		||||
add wave -group {Testbench} -noupdate /testbenchfp/*
 | 
			
		||||
add wave -group {Testbench} -noupdate /testbenchfp/readvectors/*
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								pipelined/src/fpu/divshiftcalc.sv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								pipelined/src/fpu/divshiftcalc.sv
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
`include "wally-config.vh"
 | 
			
		||||
 | 
			
		||||
module divshiftcalc(
 | 
			
		||||
    input logic  [`DIVLEN+2:0] Quot,
 | 
			
		||||
    input logic  [`NE:0] DivCalcExpM,
 | 
			
		||||
    output logic [$clog2(`NORMSHIFTSZ)-1:0] DivShiftAmt,
 | 
			
		||||
    output logic [`NE:0] CorrDivExp
 | 
			
		||||
);
 | 
			
		||||
    
 | 
			
		||||
    assign DivShiftAmt = {{$clog2(`NORMSHIFTSZ)-1{1'b0}}, ~Quot[`DIVLEN+2]};
 | 
			
		||||
    // the quotent is in the range [.5,2)
 | 
			
		||||
    // if the quotent < 1 and not denormal then subtract 1 to account for the normalization shift
 | 
			
		||||
    assign CorrDivExp = DivCalcExpM - {(`NE)'(0), ~Quot[`DIVLEN+2]};
 | 
			
		||||
 | 
			
		||||
endmodule
 | 
			
		||||
@ -94,6 +94,7 @@ module postprocess(
 | 
			
		||||
    logic                   IntToFp;       // is the opperation an int->fp conversion?
 | 
			
		||||
    logic                   ToInt;      // is the opperation an fp->int conversion?
 | 
			
		||||
    logic [`NE+1:0] RoundExp;
 | 
			
		||||
    logic [`NE:0] CorrDivExp;
 | 
			
		||||
    logic [1:0] NegResMSBS;
 | 
			
		||||
    logic CvtOp;
 | 
			
		||||
    logic FmaOp;
 | 
			
		||||
@ -138,7 +139,7 @@ module postprocess(
 | 
			
		||||
                              .XZeroM, .IntToFp, .OutFmt, .CvtResUf, .CvtShiftIn);
 | 
			
		||||
    fmashiftcalc fmashiftcalc(.SumM, .ZExpM, .ProdExpM, .FmaNormCntM, .FmtM, .KillProdM, .ConvNormSumExp,
 | 
			
		||||
                          .ZDenormM, .SumZero, .PreResultDenorm, .FmaShiftAmt, .FmaShiftIn);
 | 
			
		||||
    divshiftcalc divshiftcalc(.Quot, .DivShiftAmt);
 | 
			
		||||
    divshiftcalc divshiftcalc(.Quot, .DivCalcExpM, .CorrDivExp, .DivShiftAmt);
 | 
			
		||||
 | 
			
		||||
    always_comb
 | 
			
		||||
        case(PostProcSelM)
 | 
			
		||||
@ -175,7 +176,7 @@ module postprocess(
 | 
			
		||||
    // round to infinity
 | 
			
		||||
    // round to nearest max magnitude
 | 
			
		||||
 | 
			
		||||
    round round(.OutFmt, .FrmM, .Sticky, .AddendStickyM, .ZZeroM, .Plus1, .PostProcSelM, .CvtCalcExpM, .DivCalcExpM,
 | 
			
		||||
    round round(.OutFmt, .FrmM, .Sticky, .AddendStickyM, .ZZeroM, .Plus1, .PostProcSelM, .CvtCalcExpM, .CorrDivExp,
 | 
			
		||||
                .InvZM, .RoundSgn, .SumExp, .FmaOp, .CvtOp, .CvtResDenormUfM, .CorrShifted, .ToInt,  .CvtResUf,
 | 
			
		||||
                .DivOp, .UfPlus1, .FullResExp, .ResFrac, .ResExp, .Round, .RoundAdd, .UfLSBRes, .RoundExp);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ module round(
 | 
			
		||||
    input logic  [`NE+1:0]      SumExp,         // exponent of the normalized sum
 | 
			
		||||
    input logic                 RoundSgn,      // the result's sign
 | 
			
		||||
    input logic [`NE:0]           CvtCalcExpM,    // the calculated expoent
 | 
			
		||||
    input logic [`NE:0]           DivCalcExpM,    // the calculated expoent
 | 
			
		||||
    input logic [`NE:0]           CorrDivExp,    // the calculated expoent
 | 
			
		||||
    output logic                UfPlus1,  // do you add or subtract on from the result
 | 
			
		||||
    output logic [`NE+1:0]      FullResExp,      // ResExp with bits to determine sign and overflow
 | 
			
		||||
    output logic [`NF-1:0]      ResFrac,         // Result fraction
 | 
			
		||||
@ -305,7 +305,7 @@ module round(
 | 
			
		||||
        case(PostProcSelM)
 | 
			
		||||
            2'b10: RoundExp = SumExp; // fma
 | 
			
		||||
            2'b00: RoundExp = {CvtCalcExpM[`NE], CvtCalcExpM}&{`NE+2{~CvtResDenormUfM|CvtResUf}}; // cvt
 | 
			
		||||
            2'b01: RoundExp = {DivCalcExpM[`NE], DivCalcExpM[`NE:0]}; // divide
 | 
			
		||||
            2'b01: RoundExp = {CorrDivExp[`NE], CorrDivExp[`NE:0]}; // divide
 | 
			
		||||
            default: RoundExp = 0; 
 | 
			
		||||
        endcase
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@ export MAXCORES ?= 4
 | 
			
		||||
# MAXOPT turns on flattening, boundary optimization, and retiming
 | 
			
		||||
# The output netlist is hard to interpret, but significantly better PPA
 | 
			
		||||
export MAXOPT ?= 0
 | 
			
		||||
export DRIVE ?= FLOP
 | 
			
		||||
 | 
			
		||||
time := $(shell date +%F-%H-%M)
 | 
			
		||||
hash := $(shell git rev-parse --short HEAD)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user