mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #2238 from YosysHQ/mwk/dfflegalize-anlogic
anlogic: Use dfflegalize.
This commit is contained in:
commit
910f421324
|
@ -1,31 +1,17 @@
|
||||||
module \$_DFF_N_ (input D, C, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'bx), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(1'b1), .sr(1'b0)); endmodule
|
module \$_DFFE_PN0P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C) ,.ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFF_P_ (input D, C, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'bx), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(1'b1), .sr(1'b0)); endmodule
|
module \$_DFFE_PN1P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
|
module \$_DFFE_PP0P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("SR"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
|
module \$_DFFE_PP1P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("SR"), . SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
|
|
||||||
module \$_DFFE_NN_ (input D, C, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'bx), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(E), .sr(1'b0)); endmodule
|
module \$_SDFFE_PN0P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("INV"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C) ,.ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFFE_NP_ (input D, C, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'bx), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(E), .sr(1'b0)); endmodule
|
module \$_SDFFE_PN1P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("INV"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFFE_PN_ (input D, C, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'bx), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(1'b0)); endmodule
|
module \$_SDFFE_PP0P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFFE_PP_ (input D, C, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'bx), .SRMUX("SR"), .SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(1'b0)); endmodule
|
module \$_SDFFE_PP1P_ (input D, C, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("SR"), . SRMODE("SYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(E), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
|
|
||||||
module \$_DFF_NN0_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(1'b1), .sr(R)); endmodule
|
module \$_DLATCH_NN0_ (input D, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("LATCH"), .REGSET(1'b0), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(E) ,.ce(1'b1), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFF_NN1_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(1'b1), .sr(R)); endmodule
|
module \$_DLATCH_NN1_ (input D, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("LATCH"), .REGSET(1'b1), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(E), .ce(1'b1), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFF_NP0_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("SR"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(1'b1), .sr(R)); endmodule
|
module \$_DLATCH_NP0_ (input D, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("LATCH"), .REGSET(1'b0), .SRMUX("SR"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(E), .ce(1'b1), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFF_NP1_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("SR"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(~C), .ce(1'b1), .sr(R)); endmodule
|
module \$_DLATCH_NP1_ (input D, R, E, output Q); AL_MAP_SEQ #(.DFFMODE("LATCH"), .REGSET(1'b1), .SRMUX("SR"), . SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(E), .ce(1'b1), .sr(R)); wire _TECHMAP_REMOVEINIT_Q_ = 1'b1; endmodule
|
||||||
module \$_DFF_PN0_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C) , .ce(1'b1), .sr(R)); endmodule
|
|
||||||
module \$_DFF_PN1_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("INV"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(1'b1), .sr(R)); endmodule
|
|
||||||
module \$_DFF_PP0_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b0), .SRMUX("SR"), .SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(1'b1), .sr(R)); endmodule
|
|
||||||
module \$_DFF_PP1_ (input D, C, R, output Q); AL_MAP_SEQ #(.DFFMODE("FF"), .REGSET(1'b1), .SRMUX("SR"), . SRMODE("ASYNC")) _TECHMAP_REPLACE_ (.d(D), .q(Q), .clk(C), .ce(1'b1), .sr(R)); endmodule
|
|
||||||
|
|
||||||
module \$_DLATCH_N_ (E, D, Q);
|
|
||||||
wire [1023:0] _TECHMAP_DO_ = "simplemap; opt";
|
|
||||||
input E, D;
|
|
||||||
output Q = !E ? D : Q;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
module \$_DLATCH_P_ (E, D, Q);
|
|
||||||
wire [1023:0] _TECHMAP_DO_ = "simplemap; opt";
|
|
||||||
input E, D;
|
|
||||||
output Q = E ? D : Q;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
`ifndef NO_LUT
|
`ifndef NO_LUT
|
||||||
module \$lut (A, Y);
|
module \$lut (A, Y);
|
||||||
|
|
|
@ -10,9 +10,6 @@ module AL_MAP_SEQ (
|
||||||
parameter SRMUX = "SR"; //SR/INV
|
parameter SRMUX = "SR"; //SR/INV
|
||||||
parameter SRMODE = "SYNC"; //SYNC/ASYNC
|
parameter SRMODE = "SYNC"; //SYNC/ASYNC
|
||||||
|
|
||||||
wire clk_ce;
|
|
||||||
assign clk_ce = ce ? clk : 1'b0;
|
|
||||||
|
|
||||||
wire srmux;
|
wire srmux;
|
||||||
generate
|
generate
|
||||||
case (SRMUX)
|
case (SRMUX)
|
||||||
|
@ -38,18 +35,18 @@ module AL_MAP_SEQ (
|
||||||
begin
|
begin
|
||||||
if (SRMODE == "ASYNC")
|
if (SRMODE == "ASYNC")
|
||||||
begin
|
begin
|
||||||
always @(posedge clk_ce, posedge srmux)
|
always @(posedge clk, posedge srmux)
|
||||||
if (srmux)
|
if (srmux)
|
||||||
q <= regset;
|
q <= regset;
|
||||||
else
|
else if (ce)
|
||||||
q <= d;
|
q <= d;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
always @(posedge clk_ce)
|
always @(posedge clk)
|
||||||
if (srmux)
|
if (srmux)
|
||||||
q <= regset;
|
q <= regset;
|
||||||
else
|
else if (ce)
|
||||||
q <= d;
|
q <= d;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -58,21 +55,23 @@ module AL_MAP_SEQ (
|
||||||
// DFFMODE == "LATCH"
|
// DFFMODE == "LATCH"
|
||||||
if (SRMODE == "ASYNC")
|
if (SRMODE == "ASYNC")
|
||||||
begin
|
begin
|
||||||
always @(clk_ce, srmux)
|
always @*
|
||||||
if (srmux)
|
if (srmux)
|
||||||
q <= regset;
|
q <= regset;
|
||||||
else
|
else if (~clk & ce)
|
||||||
q <= d;
|
q <= d;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
always @(clk_ce)
|
always @*
|
||||||
|
if (~clk) begin
|
||||||
if (srmux)
|
if (srmux)
|
||||||
q <= regset;
|
q <= regset;
|
||||||
else
|
else if (ce)
|
||||||
q <= d;
|
q <= d;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
endgenerate
|
endgenerate
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
|
@ -182,8 +182,8 @@ struct SynthAnlogicPass : public ScriptPass
|
||||||
|
|
||||||
if (check_label("map_ffs"))
|
if (check_label("map_ffs"))
|
||||||
{
|
{
|
||||||
|
run("dfflegalize -cell $_DFFE_P??P_ r -cell $_SDFFE_P??P_ r -cell $_DLATCH_N??_ r");
|
||||||
run("techmap -D NO_LUT -map +/anlogic/cells_map.v");
|
run("techmap -D NO_LUT -map +/anlogic/cells_map.v");
|
||||||
run("dffinit -strinit SET RESET -ff AL_MAP_SEQ q REGSET -noreinit");
|
|
||||||
run("opt_expr -mux_undef");
|
run("opt_expr -mux_undef");
|
||||||
run("simplemap");
|
run("simplemap");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,31 +3,33 @@ design -save read
|
||||||
|
|
||||||
hierarchy -top latchp
|
hierarchy -top latchp
|
||||||
proc
|
proc
|
||||||
# Can't run any sort of equivalence check because latches are blown to LUTs
|
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic
|
||||||
synth_anlogic
|
design -load postopt
|
||||||
cd latchp # Constrain all select calls below inside the top module
|
cd latchp # Constrain all select calls below inside the top module
|
||||||
select -assert-count 1 t:AL_MAP_LUT3
|
|
||||||
|
|
||||||
select -assert-none t:AL_MAP_LUT3 %% t:* %D
|
select -assert-count 1 t:AL_MAP_SEQ
|
||||||
|
select -assert-count 1 t:AL_MAP_LUT1
|
||||||
|
select -assert-none t:AL_MAP_SEQ t:AL_MAP_LUT1 %% t:* %D
|
||||||
|
|
||||||
|
|
||||||
design -load read
|
design -load read
|
||||||
hierarchy -top latchn
|
hierarchy -top latchn
|
||||||
proc
|
proc
|
||||||
# Can't run any sort of equivalence check because latches are blown to LUTs
|
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic
|
||||||
synth_anlogic
|
design -load postopt
|
||||||
cd latchn # Constrain all select calls below inside the top module
|
cd latchn # Constrain all select calls below inside the top module
|
||||||
select -assert-count 1 t:AL_MAP_LUT3
|
|
||||||
|
|
||||||
select -assert-none t:AL_MAP_LUT3 %% t:* %D
|
select -assert-count 1 t:AL_MAP_SEQ
|
||||||
|
select -assert-none t:AL_MAP_SEQ %% t:* %D
|
||||||
|
|
||||||
|
|
||||||
design -load read
|
design -load read
|
||||||
hierarchy -top latchsr
|
hierarchy -top latchsr
|
||||||
proc
|
proc
|
||||||
# Can't run any sort of equivalence check because latches are blown to LUTs
|
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic
|
||||||
synth_anlogic
|
design -load postopt
|
||||||
cd latchsr # Constrain all select calls below inside the top module
|
cd latchsr # Constrain all select calls below inside the top module
|
||||||
select -assert-count 1 t:AL_MAP_LUT5
|
|
||||||
|
|
||||||
select -assert-none t:AL_MAP_LUT5 %% t:* %D
|
select -assert-count 1 t:AL_MAP_SEQ
|
||||||
|
select -assert-count 2 t:AL_MAP_LUT3
|
||||||
|
select -assert-none t:AL_MAP_SEQ t:AL_MAP_LUT3 %% t:* %D
|
||||||
|
|
Loading…
Reference in New Issue