mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 01:54:10 +00:00
Merge pull request #4298 from povik/kogge-stone
techmap: Add a Kogge-Stone option for `$lcu` mapping
This commit is contained in:
commit
dc746080f5
|
@ -35,3 +35,4 @@ $(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/abc9_unmap.v))
|
||||||
$(eval $(call add_share_file,share,techlibs/common/cmp2lcu.v))
|
$(eval $(call add_share_file,share,techlibs/common/cmp2lcu.v))
|
||||||
$(eval $(call add_share_file,share,techlibs/common/cmp2softlogic.v))
|
$(eval $(call add_share_file,share,techlibs/common/cmp2softlogic.v))
|
||||||
|
$(eval $(call add_share_file,share/choices,techlibs/common/choices/kogge-stone.v))
|
||||||
|
|
54
techlibs/common/choices/kogge-stone.v
Normal file
54
techlibs/common/choices/kogge-stone.v
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* yosys -- Yosys Open SYnthesis Suite
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 Martin Povišer <povik@cutebit.org>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
(* techmap_celltype = "$lcu" *)
|
||||||
|
module _80_lcu_kogge_stone (P, G, CI, CO);
|
||||||
|
parameter WIDTH = 2;
|
||||||
|
|
||||||
|
(* force_downto *)
|
||||||
|
input [WIDTH-1:0] P, G;
|
||||||
|
input CI;
|
||||||
|
|
||||||
|
(* force_downto *)
|
||||||
|
output [WIDTH-1:0] CO;
|
||||||
|
|
||||||
|
integer i, j;
|
||||||
|
(* force_downto *)
|
||||||
|
reg [WIDTH-1:0] p, g;
|
||||||
|
|
||||||
|
wire [1023:0] _TECHMAP_DO_ = "proc; opt -fast";
|
||||||
|
|
||||||
|
always @* begin
|
||||||
|
p = P;
|
||||||
|
g = G;
|
||||||
|
|
||||||
|
// in almost all cases CI will be constant zero
|
||||||
|
g[0] = g[0] | (p[0] & CI);
|
||||||
|
|
||||||
|
for (i = 0; i < $clog2(WIDTH); i = i + 1) begin
|
||||||
|
// iterate in reverse so we don't confuse a result from this stage and the previous
|
||||||
|
for (j = WIDTH - 1; j >= 2**i; j = j - 1) begin
|
||||||
|
g[j] = g[j] | p[j] & g[j - 2**i];
|
||||||
|
p[j] = p[j] & p[j - 2**i];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
assign CO = g;
|
||||||
|
endmodule
|
|
@ -207,7 +207,7 @@ module _90_fa (A, B, C, X, Y);
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
(* techmap_celltype = "$lcu" *)
|
(* techmap_celltype = "$lcu" *)
|
||||||
module _90_lcu (P, G, CI, CO);
|
module _90_lcu_brent_kung (P, G, CI, CO);
|
||||||
parameter WIDTH = 2;
|
parameter WIDTH = 2;
|
||||||
|
|
||||||
(* force_downto *)
|
(* force_downto *)
|
||||||
|
|
1
tests/techmap/kogge-stone.ys
Normal file
1
tests/techmap/kogge-stone.ys
Normal file
|
@ -0,0 +1 @@
|
||||||
|
test_cell -s 1711533949 -n 10 -map +/techmap.v -map +/choices/kogge-stone.v $lcu
|
Loading…
Reference in a new issue