3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00

Add bitwise $bweqx and $bwmux cells

The new bitwise case equality (`$bweqx`) and bitwise mux (`$bwmux`)
cells enable compact encoding and decoding of 3-valued logic signals
using multiple 2-valued signals.
This commit is contained in:
Jannis Harder 2022-11-02 17:12:51 +01:00
parent f2c531e65f
commit 7203ba7bc1
9 changed files with 179 additions and 11 deletions

View file

@ -1601,6 +1601,43 @@ endmodule
// --------------------------------------------------------
module \$bweqx (A, B, Y);
parameter WIDTH = 0;
input [WIDTH-1:0] A, B;
output [WIDTH-1:0] Y;
genvar i;
generate
for (i = 0; i < WIDTH; i = i + 1) begin:slices
assign Y[i] = A[i] === B[i];
end
endgenerate
endmodule
// --------------------------------------------------------
module \$bwmux (A, B, S, Y);
parameter WIDTH = 0;
input [WIDTH-1:0] A, B;
input [WIDTH-1:0] S;
output [WIDTH-1:0] Y;
genvar i;
generate
for (i = 0; i < WIDTH; i = i + 1) begin:slices
assign Y[i] = S[i] ? B[i] : A[i];
end
endgenerate
endmodule
// --------------------------------------------------------
module \$assert (A, EN);
input A, EN;

View file

@ -59,7 +59,7 @@ module _90_simplemap_compare_ops;
endmodule
(* techmap_simplemap *)
(* techmap_celltype = "$pos $slice $concat $mux $tribuf $bmux" *)
(* techmap_celltype = "$pos $slice $concat $mux $tribuf $bmux $bwmux $bweqx" *)
module _90_simplemap_various;
endmodule