mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	techmap: add a Sklansky option for $lcu mapping
				
					
				
			This commit is contained in:
		
							parent
							
								
									f04b899721
								
							
						
					
					
						commit
						fe64a714a9
					
				
					 3 changed files with 53 additions and 0 deletions
				
			
		|  | @ -37,3 +37,4 @@ $(eval $(call add_share_file,share,techlibs/common/cmp2lcu.v)) | |||
| $(eval $(call add_share_file,share,techlibs/common/cmp2softlogic.v)) | ||||
| $(eval $(call add_share_file,share/choices,techlibs/common/choices/kogge-stone.v)) | ||||
| $(eval $(call add_share_file,share/choices,techlibs/common/choices/han-carlson.v)) | ||||
| $(eval $(call add_share_file,share/choices,techlibs/common/choices/sklansky.v)) | ||||
|  |  | |||
							
								
								
									
										37
									
								
								techlibs/common/choices/sklansky.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								techlibs/common/choices/sklansky.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| (* techmap_celltype = "$lcu" *) | ||||
| module _80_lcu_sklansky (P, G, CI, CO); | ||||
| 	parameter WIDTH = 2; | ||||
| 
 | ||||
| 	(* force_downto *) | ||||
| 	input [WIDTH-1:0] P, G; | ||||
| 	input CI; | ||||
| 
 | ||||
| 	(* force_downto *) | ||||
| 	output [WIDTH-1:0] CO; | ||||
| 
 | ||||
| 	integer i, j; | ||||
| 	(* force_downto *) | ||||
| 	reg [WIDTH-1:0] p, g; | ||||
| 
 | ||||
| 	wire [1023:0] _TECHMAP_DO_ = "proc; opt -fast"; | ||||
| 
 | ||||
| 	always @* begin | ||||
| 		p = P; | ||||
| 		g = G; | ||||
| 
 | ||||
| 		// in almost all cases CI will be constant zero
 | ||||
| 		g[0] = g[0] | (p[0] & CI); | ||||
| 
 | ||||
| 		for (i = 0; i < $clog2(WIDTH); i = i + 1) begin | ||||
| 			// iterate in reverse so we don't confuse a result from this stage and the previous
 | ||||
| 			for (j = WIDTH - 1; j >= 0; j = j - 1) begin | ||||
| 				if (j & 2**i) begin | ||||
| 					g[j] = g[j] | p[j] & g[(j & ~(2**i - 1)) - 1]; | ||||
| 					p[j] = p[j] & p[(j & ~(2**i - 1)) - 1]; | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| 
 | ||||
| 	assign CO = g; | ||||
| endmodule | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue