mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Added unpacker into testbench for srt
This commit is contained in:
		
							parent
							
								
									b537df2651
								
							
						
					
					
						commit
						a996a5e16c
					
				@ -17,7 +17,7 @@ if [file exists work] {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
vlib work
 | 
					vlib work
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vlog +incdir+../config/rv64gc +incdir+../config/shared srt.sv ../src/generic/flop/flop*.sv ../src/generic/mux.sv 
 | 
					vlog +incdir+../config/rv64gc +incdir+../config/shared srt.sv ../src/generic/flop/flop*.sv ../src/generic/mux.sv ../src/fpu/unpacking.sv
 | 
				
			||||||
vopt +acc work.testbench -o workopt 
 | 
					vopt +acc work.testbench -o workopt 
 | 
				
			||||||
vsim workopt
 | 
					vsim workopt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,8 @@
 | 
				
			|||||||
// produces one quotient digit per cycle.  The divider
 | 
					// produces one quotient digit per cycle.  The divider
 | 
				
			||||||
// keeps the partial remainder in carry-save form.
 | 
					// keeps the partial remainder in carry-save form.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`include "wally-config.vh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/////////
 | 
					/////////
 | 
				
			||||||
// srt //
 | 
					// srt //
 | 
				
			||||||
/////////
 | 
					/////////
 | 
				
			||||||
@ -272,6 +274,24 @@ module testbench;
 | 
				
			|||||||
  logic  [51:0] r;
 | 
					  logic  [51:0] r;
 | 
				
			||||||
  logic [54:0] rp, rm;   // positive quotient digits
 | 
					  logic [54:0] rp, rm;   // positive quotient digits
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //input logic  [63:0] X, Y, Z,  - numbers
 | 
				
			||||||
 | 
					  //input logic         FmtE,  ---- format, 1 is for double precision, 0 is single
 | 
				
			||||||
 | 
					  //input logic  [2:0]  FOpCtrlE, ---- controling operations for FPU, 1 is sqrt, 0 is divide
 | 
				
			||||||
 | 
					 // all variables are commented in fpu.sv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // output logic from Unpackers
 | 
				
			||||||
 | 
					  logic        XSgnE, YSgnE, ZSgnE;
 | 
				
			||||||
 | 
					  logic [10:0] XExpE, YExpE, ZExpE; // exponent
 | 
				
			||||||
 | 
					  logic [52:0] XManE, YManE, ZManE;
 | 
				
			||||||
 | 
					  logic XNormE;
 | 
				
			||||||
 | 
					  logic XNaNE, YNaNE, ZNaNE;
 | 
				
			||||||
 | 
					  logic XSNaNE, YSNaNE, ZSNaNE;
 | 
				
			||||||
 | 
					  logic XDenormE, YDenormE, ZDenormE; // denormals
 | 
				
			||||||
 | 
					  logic XZeroE, YZeroE, ZZeroE;
 | 
				
			||||||
 | 
					  logic [10:0] BiasE; // currrently hardcoded, will probs be removed
 | 
				
			||||||
 | 
					  logic XInfE, YInfE, ZInfE;
 | 
				
			||||||
 | 
					  logic XExpMaxE; // says exponent is all ones, can ignore
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
  // Test parameters
 | 
					  // Test parameters
 | 
				
			||||||
  parameter MEM_SIZE = 40000;
 | 
					  parameter MEM_SIZE = 40000;
 | 
				
			||||||
  parameter MEM_WIDTH = 52+52+52;
 | 
					  parameter MEM_WIDTH = 52+52+52;
 | 
				
			||||||
@ -287,8 +307,11 @@ module testbench;
 | 
				
			|||||||
  logic    [51:0] correctr, nextr;
 | 
					  logic    [51:0] correctr, nextr;
 | 
				
			||||||
  integer testnum, errors;
 | 
					  integer testnum, errors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Unpackers
 | 
				
			||||||
 | 
					  unpack unpacking(.X({(1+`NE)'(0),a}), .Y({(1+`NE)'(0)}), .Z(0), .FmtE(1'b1), FOpCtrlE.(0), .*)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Divider
 | 
					  // Divider
 | 
				
			||||||
  srt  srt(clk, req, a, b, rp, rm);
 | 
					  srt  srt(clk, req, .a(XManE[51:0]), .b(YManE[51:0]), rp, rm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Final adder converts quotient digits to 2's complement & normalizes
 | 
					  // Final adder converts quotient digits to 2's complement & normalizes
 | 
				
			||||||
  finaladd finaladd(rp, rm, r);
 | 
					  finaladd finaladd(rp, rm, r);
 | 
				
			||||||
@ -326,7 +349,7 @@ module testbench;
 | 
				
			|||||||
	begin
 | 
						begin
 | 
				
			||||||
	  req <= #5 1;
 | 
						  req <= #5 1;
 | 
				
			||||||
	  $display("result was %h, should be %h\n", r, correctr);
 | 
						  $display("result was %h, should be %h\n", r, correctr);
 | 
				
			||||||
	  if ((correctr - r) > 1) // check if accurate to 1 ulp
 | 
						  if (abs(correctr - r) > 1) // check if accurate to 1 ulp
 | 
				
			||||||
	    begin
 | 
						    begin
 | 
				
			||||||
	      errors = errors+1;
 | 
						      errors = errors+1;
 | 
				
			||||||
	      $display("failed\n");
 | 
						      $display("failed\n");
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user