mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	fabulous: Add support for LUT6s
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
		
							parent
							
								
									f9a6c0fcbd
								
							
						
					
					
						commit
						e56dad56c4
					
				
					 2 changed files with 38 additions and 1 deletions
				
			
		|  | @ -16,10 +16,15 @@ module \$lut (A, Y); | ||||||
|     end else |     end else | ||||||
|     if (WIDTH == 3) begin |     if (WIDTH == 3) begin | ||||||
|       LUT3 #(.INIT(LUT)) _TECHMAP_REPLACE_ (.O(Y), .I0(A[0]), .I1(A[1]), .I2(A[2])); |       LUT3 #(.INIT(LUT)) _TECHMAP_REPLACE_ (.O(Y), .I0(A[0]), .I1(A[1]), .I2(A[2])); | ||||||
| 
 |  | ||||||
|     end else |     end else | ||||||
|     if (WIDTH == 4) begin |     if (WIDTH == 4) begin | ||||||
|       LUT4 #(.INIT(LUT)) _TECHMAP_REPLACE_ (.O(Y), .I0(A[0]), .I1(A[1]), .I2(A[2]), .I3(A[3])); |       LUT4 #(.INIT(LUT)) _TECHMAP_REPLACE_ (.O(Y), .I0(A[0]), .I1(A[1]), .I2(A[2]), .I3(A[3])); | ||||||
|  |     end else | ||||||
|  |     if (WIDTH == 5) begin | ||||||
|  |       LUT5 #(.INIT(LUT)) _TECHMAP_REPLACE_ (.O(Y), .I0(A[0]), .I1(A[1]), .I2(A[2]), .I3(A[3]), .I4(A[4])); | ||||||
|  |     end else | ||||||
|  |     if (WIDTH == 6) begin | ||||||
|  |       LUT6 #(.INIT(LUT)) _TECHMAP_REPLACE_ (.O(Y), .I0(A[0]), .I1(A[1]), .I2(A[2]), .I3(A[3]), .I4(A[4]), .I5(A[5])); | ||||||
|     end else begin |     end else begin | ||||||
|       wire _TECHMAP_FAIL_ = 1; |       wire _TECHMAP_FAIL_ = 1; | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -38,6 +38,38 @@ module LUT4_HA(output O, Co, input I0, I1, I2, I3, Ci); | ||||||
|   assign Co = (Ci & I1) | (Ci & I2) | (I1 & I2); |   assign Co = (Ci & I1) | (Ci & I2) | (I1 & I2); | ||||||
| endmodule | endmodule | ||||||
| 
 | 
 | ||||||
|  | module LUT5(output O, input I0, I1, I2, I3, I4); | ||||||
|  |   parameter [31:0] INIT = 0; | ||||||
|  |   wire [15: 0] s4 = I4 ? INIT[31:16] : INIT[15: 0]; | ||||||
|  |   wire [ 7: 0] s3 = I3 ?   s4[15: 8] :   s4[ 7: 0]; | ||||||
|  |   wire [ 3: 0] s2 = I2 ?   s3[ 7: 4] :   s3[ 3: 0]; | ||||||
|  |   wire [ 1: 0] s1 = I1 ?   s2[ 3: 2] :   s2[ 1: 0]; | ||||||
|  |   assign O = I0 ? s1[1] : s1[0]; | ||||||
|  | endmodule | ||||||
|  | 
 | ||||||
|  | module LUT6(output O, input I0, I1, I2, I3, I4, I5); | ||||||
|  |   parameter [63:0] INIT = 0; | ||||||
|  |   wire [31: 0] s5 = I5 ? INIT[63:32] : INIT[31: 0]; | ||||||
|  |   wire [15: 0] s4 = I4 ?   s5[31:16] :   s5[15: 0]; | ||||||
|  |   wire [ 7: 0] s3 = I3 ?   s4[15: 8] :   s4[ 7: 0]; | ||||||
|  |   wire [ 3: 0] s2 = I2 ?   s3[ 7: 4] :   s3[ 3: 0]; | ||||||
|  |   wire [ 1: 0] s1 = I1 ?   s2[ 3: 2] :   s2[ 1: 0]; | ||||||
|  |   assign O = I0 ? s1[1] : s1[0]; | ||||||
|  | endmodule | ||||||
|  | 
 | ||||||
|  | module LUT55_FCY (output O, Co, input I0, I1, I2, I3, I4, Ci); | ||||||
|  |   parameter [63:0] INIT = 0; | ||||||
|  | 
 | ||||||
|  |   wire comb1, comb2; | ||||||
|  | 
 | ||||||
|  |   LUT5 #(.INIT(INIT[31: 0])) l5_1 (.I0(I0), .I1(I1), .I2(I2), .I3(I3), .I4(I4), .O(comb1)); | ||||||
|  |   LUT5 #(.INIT(INIT[63:32])) l5_2 (.I0(I0), .I1(I1), .I2(I2), .I3(I3), .I4(I4), .O(comb2)); | ||||||
|  | 
 | ||||||
|  |   assign O = comb1 ^ Ci; | ||||||
|  |   assign Co = comb1 ? Ci : comb2; | ||||||
|  | endmodule | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| module LUTFF(input CLK, D, output reg O); | module LUTFF(input CLK, D, output reg O); | ||||||
|   initial O = 1'b0; |   initial O = 1'b0; | ||||||
|   always @ (posedge CLK) begin |   always @ (posedge CLK) begin | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue