mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Switched to behavioral comparator for best PPA
This commit is contained in:
		
							parent
							
								
									b4a422f771
								
							
						
					
					
						commit
						bcd8728b3e
					
				@ -154,10 +154,10 @@ def main():
 | 
				
			|||||||
        os.system('./make-tests.sh | tee ./logs/make-tests.log')
 | 
					        os.system('./make-tests.sh | tee ./logs/make-tests.log')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if '-all' in sys.argv:
 | 
					    if '-all' in sys.argv:
 | 
				
			||||||
        TIMEOUT_DUR = 20*3600 # seconds
 | 
					        TIMEOUT_DUR = 30*3600 # seconds
 | 
				
			||||||
        configs.append(getBuildrootTC(short=False))
 | 
					        configs.append(getBuildrootTC(short=False))
 | 
				
			||||||
    elif '-buildroot' in sys.argv:
 | 
					    elif '-buildroot' in sys.argv:
 | 
				
			||||||
        TIMEOUT_DUR = 20*3600 # seconds
 | 
					        TIMEOUT_DUR = 30*3600 # seconds
 | 
				
			||||||
        configs=[getBuildrootTC(short=False)]
 | 
					        configs=[getBuildrootTC(short=False)]
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        TIMEOUT_DUR = 5*60 # seconds
 | 
					        TIMEOUT_DUR = 5*60 # seconds
 | 
				
			||||||
 | 
				
			|||||||
@ -56,12 +56,14 @@ module comparator_sub #(parameter WIDTH=64) (
 | 
				
			|||||||
  assign flags = {eq, lt, ltu};
 | 
					  assign flags = {eq, lt, ltu};
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module comparator_dc #(parameter WIDTH=64) (
 | 
					// *** eventually substitute comparator_flip, which gives slightly better synthesis
 | 
				
			||||||
 | 
					module comparator #(parameter WIDTH=64) (
 | 
				
			||||||
  input  logic [WIDTH-1:0] a, b,
 | 
					  input  logic [WIDTH-1:0] a, b,
 | 
				
			||||||
  output logic [2:0]       flags);
 | 
					  output logic [2:0]       flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  logic eq, lt, ltu;
 | 
					  logic eq, lt, ltu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Behavioral description gives best results
 | 
				
			||||||
  assign eq = (a == b);
 | 
					  assign eq = (a == b);
 | 
				
			||||||
  assign ltu = (a < b);
 | 
					  assign ltu = (a < b);
 | 
				
			||||||
  assign lt = ($signed(a) < $signed(b));
 | 
					  assign lt = ($signed(a) < $signed(b));
 | 
				
			||||||
@ -69,7 +71,8 @@ module comparator_dc #(parameter WIDTH=64) (
 | 
				
			|||||||
  assign flags = {eq, lt, ltu};
 | 
					  assign flags = {eq, lt, ltu};
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module comparator_dc_flip #(parameter WIDTH=16) (
 | 
					// This comaprator 
 | 
				
			||||||
 | 
					module comparator_flip #(parameter WIDTH=16) (
 | 
				
			||||||
  input  logic [WIDTH-1:0] a, b,
 | 
					  input  logic [WIDTH-1:0] a, b,
 | 
				
			||||||
  input  logic             sgnd,
 | 
					  input  logic             sgnd,
 | 
				
			||||||
  output logic [1:0]       flags);
 | 
					  output logic [1:0]       flags);
 | 
				
			||||||
@ -81,6 +84,7 @@ module comparator_dc_flip #(parameter WIDTH=16) (
 | 
				
			|||||||
  assign af = {a[WIDTH-1] ^ sgnd, a[WIDTH-2:0]};
 | 
					  assign af = {a[WIDTH-1] ^ sgnd, a[WIDTH-2:0]};
 | 
				
			||||||
  assign bf = {b[WIDTH-1] ^ sgnd, b[WIDTH-2:0]};
 | 
					  assign bf = {b[WIDTH-1] ^ sgnd, b[WIDTH-2:0]};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // behavioral description gives best results
 | 
				
			||||||
  assign eq = (af == bf);
 | 
					  assign eq = (af == bf);
 | 
				
			||||||
  assign lt = (af < bf);
 | 
					  assign lt = (af < bf);
 | 
				
			||||||
  assign flags = {eq, lt};
 | 
					  assign flags = {eq, lt};
 | 
				
			||||||
@ -124,7 +128,7 @@ module comparator2 #(parameter WIDTH=64) (
 | 
				
			|||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module comparator #(parameter WIDTH=64) (
 | 
					module comparator_prefix #(parameter WIDTH=64) (
 | 
				
			||||||
  input  logic [WIDTH-1:0] a, b,
 | 
					  input  logic [WIDTH-1:0] a, b,
 | 
				
			||||||
  output logic [2:0]       flags);
 | 
					  output logic [2:0]       flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user