diff options
Diffstat (limited to 'techlibs/ecp5')
| -rw-r--r-- | techlibs/ecp5/Makefile.inc | 4 | ||||
| -rw-r--r-- | techlibs/ecp5/abc_5g.box | 18 | ||||
| -rw-r--r-- | techlibs/ecp5/abc_map.v | 24 | ||||
| -rw-r--r-- | techlibs/ecp5/abc_model.v | 5 | ||||
| -rw-r--r-- | techlibs/ecp5/abc_unmap.v | 5 | ||||
| -rw-r--r-- | techlibs/ecp5/cells_sim.v | 5 | ||||
| -rw-r--r-- | techlibs/ecp5/dsp_map.v | 17 | ||||
| -rw-r--r-- | techlibs/ecp5/synth_ecp5.cc | 41 | 
8 files changed, 103 insertions, 16 deletions
| diff --git a/techlibs/ecp5/Makefile.inc b/techlibs/ecp5/Makefile.inc index 2143acae6..80eee5004 100644 --- a/techlibs/ecp5/Makefile.inc +++ b/techlibs/ecp5/Makefile.inc @@ -13,7 +13,11 @@ $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/brams_map.v))  $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/bram.txt))  $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/arith_map.v))  $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/latches_map.v)) +$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/dsp_map.v)) +$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/abc_map.v)) +$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/abc_unmap.v)) +$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/abc_model.v))  $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/abc_5g.box))  $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/abc_5g.lut))  $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/abc_5g_nowide.lut)) diff --git a/techlibs/ecp5/abc_5g.box b/techlibs/ecp5/abc_5g.box index c757d137d..a336b4a85 100644 --- a/techlibs/ecp5/abc_5g.box +++ b/techlibs/ecp5/abc_5g.box @@ -15,16 +15,16 @@ CCU2C   1      1   9      3  630  379  630  379  526   275  392  141  273  516  516  516  516  412   412  278  278  43 -# Box 2 : TRELLIS_DPR16X4 (16x4 dist ram) +# Box 2 : TRELLIS_DPR16X4_COMB (16x4 dist ram)  # Outputs: DO0, DO1, DO2, DO3 -# name            ID  w/b   ins   outs -TRELLIS_DPR16X4   2     0   14    4 - -#DI0   DI1   DI2   DI3   RAD0   RAD1   RAD2   RAD3   WAD0    WAD1   WAD2   WAD3  WCK   WRE --      -     -     -     141    379    275    379    -       -      -      -     -     - --      -     -     -     141    379    275    379    -       -      -      -     -     - --      -     -     -     141    379    275    379    -       -      -      -     -     - --      -     -     -     141    379    275    379    -       -      -      -     -     - +# name               ID  w/b   ins   outs +$__ABC_DPR16X4_COMB  2     0   8    4 + +#A0   A1   A2   A3   RAD0   RAD1   RAD2   RAD3 +0     0    0    0    141    379    275    379 +0     0    0    0    141    379    275    379 +0     0    0    0    141    379    275    379 +0     0    0    0    141    379    275    379  # Box 3 : PFUMX (MUX2)  # Outputs: Z diff --git a/techlibs/ecp5/abc_map.v b/techlibs/ecp5/abc_map.v new file mode 100644 index 000000000..ffd25f06d --- /dev/null +++ b/techlibs/ecp5/abc_map.v @@ -0,0 +1,24 @@ +// --------------------------------------- + +module TRELLIS_DPR16X4 ( +	input  [3:0] DI, +	input  [3:0] WAD, +	input        WRE, +	input        WCK, +	input  [3:0] RAD, +	output [3:0] DO +); +	parameter WCKMUX = "WCK"; +	parameter WREMUX = "WRE"; +	parameter [63:0] INITVAL = 64'h0000000000000000; +    wire [3:0] \$DO ; + +    TRELLIS_DPR16X4 #( +      .WCKMUX(WCKMUX), .WREMUX(WREMUX), .INITVAL(INITVAL) +    ) _TECHMAP_REPLACE_ ( +      .DI(DI), .WAD(WAD), .WRE(WRE), .WCK(WCK), +      .RAD(RAD), .DO(\$DO ) +    ); + +    \$__ABC_DPR16X4_COMB do (.A(\$DO ), .S(RAD), .Y(DO)); +endmodule diff --git a/techlibs/ecp5/abc_model.v b/techlibs/ecp5/abc_model.v new file mode 100644 index 000000000..56a733b75 --- /dev/null +++ b/techlibs/ecp5/abc_model.v @@ -0,0 +1,5 @@ +// --------------------------------------- + +(* abc_box_id=2 *) +module \$__ABC_DPR16X4_COMB (input [3:0] A, S, output [3:0] Y); +endmodule diff --git a/techlibs/ecp5/abc_unmap.v b/techlibs/ecp5/abc_unmap.v new file mode 100644 index 000000000..d43cdd93f --- /dev/null +++ b/techlibs/ecp5/abc_unmap.v @@ -0,0 +1,5 @@ +// --------------------------------------- + +module \$__ABC_DPR16X4_COMB (input [3:0] A, S, output [3:0] Y); +    assign Y = A; +endmodule diff --git a/techlibs/ecp5/cells_sim.v b/techlibs/ecp5/cells_sim.v index 5bdb8395e..db77dc127 100644 --- a/techlibs/ecp5/cells_sim.v +++ b/techlibs/ecp5/cells_sim.v @@ -109,16 +109,13 @@ module PFUMX (input ALUT, BLUT, C0, output Z);  endmodule  // --------------------------------------- -//(* abc_box_id=2 *)  module TRELLIS_DPR16X4 ( -	(* abc_scc_break *)  	input  [3:0] DI, -	(* abc_scc_break *)  	input  [3:0] WAD, -	(* abc_scc_break *)  	input        WRE,  	input        WCK,  	input  [3:0] RAD, +	/* (* abc_arrival=<TODO> *) */  	output [3:0] DO  );  	parameter WCKMUX = "WCK"; diff --git a/techlibs/ecp5/dsp_map.v b/techlibs/ecp5/dsp_map.v new file mode 100644 index 000000000..cb95ddb1c --- /dev/null +++ b/techlibs/ecp5/dsp_map.v @@ -0,0 +1,17 @@ +module \$__MUL18X18 (input [17:0] A, input [17:0] B, output [35:0] Y); + +	parameter A_WIDTH = 18; +	parameter B_WIDTH = 18; +	parameter Y_WIDTH = 36; +	parameter A_SIGNED = 0; +	parameter B_SIGNED = 0; + +	MULT18X18D _TECHMAP_REPLACE_ ( +		.A0(A[0]), .A1(A[1]), .A2(A[2]), .A3(A[3]), .A4(A[4]), .A5(A[5]), .A6(A[6]), .A7(A[7]), .A8(A[8]), .A9(A[9]), .A10(A[10]), .A11(A[11]), .A12(A[12]), .A13(A[13]), .A14(A[14]), .A15(A[15]), .A16(A[16]), .A17(A[17]), +		.B0(B[0]), .B1(B[1]), .B2(B[2]), .B3(B[3]), .B4(B[4]), .B5(B[5]), .B6(B[6]), .B7(B[7]), .B8(B[8]), .B9(B[9]), .B10(B[10]), .B11(B[11]), .B12(B[12]), .B13(B[13]), .B14(B[14]), .B15(B[15]), .B16(B[16]), .B17(B[17]), +		.C17(1'b0), .C16(1'b0), .C15(1'b0), .C14(1'b0), .C13(1'b0), .C12(1'b0), .C11(1'b0), .C10(1'b0), .C9(1'b0), .C8(1'b0), .C7(1'b0), .C6(1'b0), .C5(1'b0), .C4(1'b0), .C3(1'b0), .C2(1'b0), .C1(1'b0), .C0(1'b0), +		.SIGNEDA(A_SIGNED), .SIGNEDB(B_SIGNED), .SOURCEA(1'b0), .SOURCEB(1'b0), + +		.P0(Y[0]), .P1(Y[1]), .P2(Y[2]), .P3(Y[3]), .P4(Y[4]), .P5(Y[5]), .P6(Y[6]), .P7(Y[7]), .P8(Y[8]), .P9(Y[9]), .P10(Y[10]), .P11(Y[11]), .P12(Y[12]), .P13(Y[13]), .P14(Y[14]), .P15(Y[15]), .P16(Y[16]), .P17(Y[17]), .P18(Y[18]), .P19(Y[19]), .P20(Y[20]), .P21(Y[21]), .P22(Y[22]), .P23(Y[23]), .P24(Y[24]), .P25(Y[25]), .P26(Y[26]), .P27(Y[27]), .P28(Y[28]), .P29(Y[29]), .P30(Y[30]), .P31(Y[31]), .P32(Y[32]), .P33(Y[33]), .P34(Y[34]), .P35(Y[35]) +	); +endmodule diff --git a/techlibs/ecp5/synth_ecp5.cc b/techlibs/ecp5/synth_ecp5.cc index a8075e86e..0a3dcc62c 100644 --- a/techlibs/ecp5/synth_ecp5.cc +++ b/techlibs/ecp5/synth_ecp5.cc @@ -89,6 +89,9 @@ struct SynthEcp5Pass : public ScriptPass  		log("        generate an output netlist (and BLIF file) suitable for VPR\n");  		log("        (this feature is experimental and incomplete)\n");  		log("\n"); +		log("    -nodsp\n"); +		log("        do not map multipliers to MULT18X18D\n"); +		log("\n");  		log("\n");  		log("The following commands are executed by this synthesis command:\n");  		help_script(); @@ -96,7 +99,7 @@ struct SynthEcp5Pass : public ScriptPass  	}  	string top_opt, blif_file, edif_file, json_file; -	bool noccu2, nodffe, nobram, nolutram, nowidelut, flatten, retime, abc2, abc9, vpr; +	bool noccu2, nodffe, nobram, nolutram, nowidelut, flatten, retime, abc2, abc9, nodsp, vpr;  	void clear_flags() YS_OVERRIDE  	{ @@ -114,6 +117,7 @@ struct SynthEcp5Pass : public ScriptPass  		abc2 = false;  		vpr = false;  		abc9 = false; +		nodsp = false;  	}  	void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE @@ -192,6 +196,10 @@ struct SynthEcp5Pass : public ScriptPass  				abc9 = true;  				continue;  			} +			if (args[argidx] == "-nodsp") { +				nodsp = true; +				continue; +			}  			break;  		}  		extra_args(args, argidx, design); @@ -228,7 +236,29 @@ struct SynthEcp5Pass : public ScriptPass  		if (check_label("coarse"))  		{ -			run("synth -run coarse"); +			run("opt_expr"); +			run("opt_clean"); +			run("check"); +			run("opt"); +			run("wreduce"); +			run("peepopt"); +			run("opt_clean"); +			run("share"); +			run("techmap -map +/cmp2lut.v -D LUT_WIDTH=4"); +			run("opt_expr"); +			run("opt_clean"); +			if (!nodsp) { +				run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18  -D DSP_A_MINWIDTH=2 -D DSP_B_MINWIDTH=2  -D DSP_NAME=$__MUL18X18", "(unless -nodsp)"); +				run("clean", "(unless -nodsp)"); +				run("techmap -map +/ecp5/dsp_map.v", "(unless -nodsp)"); +				run("chtype -set $mul t:$__soft_mul", "(unless -nodsp)"); +			} +			run("alumacc"); +			run("opt"); +			run("fsm"); +			run("opt -fast"); +			run("memory -nomap"); +			run("opt_clean");  		}  		if (!nobram && check_label("map_bram", "(skip if -nobram)")) @@ -280,12 +310,17 @@ struct SynthEcp5Pass : public ScriptPass  			if (abc2 || help_mode) {  				run("abc", "      (only if -abc2)");  			} -			run("techmap -map +/ecp5/latches_map.v"); +			std::string techmap_args = "-map +/ecp5/latches_map.v"; +			if (abc9) +				techmap_args += " -map +/ecp5/abc_map.v -max_iter 1"; +			run("techmap " + techmap_args); +  			if (abc9) {  				if (nowidelut)  					run("abc9 -lut +/ecp5/abc_5g_nowide.lut -box +/ecp5/abc_5g.box -W 200");  				else  					run("abc9 -lut +/ecp5/abc_5g.lut -box +/ecp5/abc_5g.box -W 200"); +				run("techmap -map +/ecp5/abc_unmap.v");  			} else {  				if (nowidelut)  					run("abc -lut 4 -dress"); | 
