mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-24 01:25:33 +00:00
abc9: add flop boxes to basic $_DFF_P_ and $_DFF_N_ too
This commit is contained in:
parent
7812a2959b
commit
48052ad813
7 changed files with 88 additions and 24 deletions
|
@ -30,4 +30,6 @@ $(eval $(call add_share_file,share,techlibs/common/cmp2lut.v))
|
|||
$(eval $(call add_share_file,share,techlibs/common/cells.lib))
|
||||
$(eval $(call add_share_file,share,techlibs/common/mul2dsp.v))
|
||||
$(eval $(call add_share_file,share,techlibs/common/abc9_model.v))
|
||||
$(eval $(call add_share_file,share,techlibs/common/abc9_map.v))
|
||||
$(eval $(call add_share_file,share,techlibs/common/abc9_unmap.v))
|
||||
$(eval $(call add_share_file,share,techlibs/common/cmp2lcu.v))
|
||||
|
|
21
techlibs/common/abc9_map.v
Normal file
21
techlibs/common/abc9_map.v
Normal file
|
@ -0,0 +1,21 @@
|
|||
(* techmap_celltype = "$_DFF_N_ $_DFF_P_" *)
|
||||
module $_DFF_x_(input C, D, output Q);
|
||||
parameter [0:0] _TECHMAP_WIREINIT_Q_ = 1'bx;
|
||||
parameter _TECHMAP_CELLTYPE_ = "";
|
||||
generate if (_TECHMAP_WIREINIT_Q_ === 1'b1)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
else if (_TECHMAP_CELLTYPE_ == "$_DFF_N_") begin
|
||||
wire D_;
|
||||
$__DFF_N__$abc9_flop #(.INIT(_TECHMAP_WIREINIT_Q_)) _TECHMAP_REPLACE_ (.C(C), .D(D), .Q(Q), .n1(D_));
|
||||
$_DFF_N_ ff (.C(C), .D(D_), .Q(Q));
|
||||
end
|
||||
else if (_TECHMAP_CELLTYPE_ == "$_DFF_P_") begin
|
||||
wire D_;
|
||||
$__DFF_P__$abc9_flop #(.INIT(_TECHMAP_WIREINIT_Q_)) _TECHMAP_REPLACE_ (.C(C), .D(D), .Q(Q), .n1(D_));
|
||||
$_DFF_P_ ff (.C(C), .D(D_), .Q(Q));
|
||||
end
|
||||
else if (_TECHMAP_CELLTYPE_ != "")
|
||||
$error("Unrecognised _TECHMAP_CELLTYPE_");
|
||||
endgenerate
|
||||
wire _TECHMAP_REMOVEINIT_Q_ = 1;
|
||||
endmodule
|
|
@ -5,3 +5,23 @@ module \$__ABC9_DELAY (input I, output O);
|
|||
(I => O) = DELAY;
|
||||
endspecify
|
||||
endmodule
|
||||
|
||||
(* abc9_flop, abc9_box, lib_whitebox *)
|
||||
module $__DFF_N__$abc9_flop(input C, D, Q, (* init=INIT *) output n1);
|
||||
parameter [0:0] INIT = 1'bx;
|
||||
assign n1 = D;
|
||||
specify
|
||||
$setup(D, posedge C, 0);
|
||||
(posedge C => (n1:D)) = 0;
|
||||
endspecify
|
||||
endmodule
|
||||
|
||||
(* abc9_flop, abc9_box, lib_whitebox *)
|
||||
module $__DFF_P__$abc9_flop(input C, D, Q, (* init=INIT *) output n1);
|
||||
parameter [0:0] INIT = 1'bx;
|
||||
assign n1 = D;
|
||||
specify
|
||||
$setup(D, posedge C, 0);
|
||||
(posedge C => (n1:D)) = 0;
|
||||
endspecify
|
||||
endmodule
|
||||
|
|
12
techlibs/common/abc9_unmap.v
Normal file
12
techlibs/common/abc9_unmap.v
Normal file
|
@ -0,0 +1,12 @@
|
|||
(* techmap_celltype = "$__DFF_N__$abc9_flop $__DFF_P__$abc9_flop" *)
|
||||
module $__DFF_x__$abc9_flop (input C, D, Q, (* init = INIT *) output n1);
|
||||
parameter [0:0] INIT = 1'bx;
|
||||
parameter _TECHMAP_CELLTYPE_ = "";
|
||||
generate if (_TECHMAP_CELLTYPE_ == "$__DFF_N__$abc9_flop")
|
||||
$_DFF_N_ _TECHMAP_REPLACE_ (.C(C), .D(D), .Q(Q));
|
||||
else if (_TECHMAP_CELLTYPE_ == "$__DFF_P__$abc9_flop")
|
||||
$_DFF_P_ _TECHMAP_REPLACE_ (.C(C), .D(D), .Q(Q));
|
||||
else if (_TECHMAP_CELLTYPE_ != "")
|
||||
$error("Unrecognised _TECHMAP_CELLTYPE_");
|
||||
endgenerate
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue