3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-11 21:50:54 +00:00

fabulous: Add support for mapping carry chains

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2023-02-20 12:49:48 +01:00 committed by myrtle
parent 8216b23fb7
commit 2ab3747cc9
5 changed files with 102 additions and 2 deletions

View file

@ -24,6 +24,20 @@ module LUT4(output O, input I0, I1, I2, I3);
assign O = I0 ? s1[1] : s1[0];
endmodule
module LUT4_HA(output O, Co, input I0, I1, I2, I3, Ci);
parameter [15:0] INIT = 0;
parameter I0MUX = 1'b1;
wire [ 7: 0] s3 = I3 ? INIT[15: 8] : INIT[ 7: 0];
wire [ 3: 0] s2 = I2 ? s3[ 7: 4] : s3[ 3: 0];
wire [ 1: 0] s1 = I1 ? s2[ 3: 2] : s2[ 1: 0];
wire I0_sel = I0MUX ? Ci : I0;
assign O = I0_sel ? s1[1] : s1[0];
assign Co = (Ci & I1) | (Ci & I2) | (I1 & I2);
endmodule
module LUTFF(input CLK, D, output reg O);
initial O = 1'b0;
always @ (posedge CLK) begin