Skip to content

Commit

Permalink
Merge pull request #3982 from povik/booth-fix
Browse files Browse the repository at this point in the history
booth: Fix vacancy check when summing down result
  • Loading branch information
mmicko authored Oct 5, 2023
2 parents 3e02b63 + 4506e11 commit 881ce80
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 3 additions & 3 deletions passes/techmap/booth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ struct BoothPassWorker {
// get the bits in this column.
SigSpec column_bits;
for (int row_ix = 0; row_ix < row_size; row_ix++) {
if (bits_to_reduce[row_ix][column_ix].wire)
if (bits_to_reduce[row_ix][column_ix] != State::S0)
column_bits.append(bits_to_reduce[row_ix][column_ix]);
}
for (auto c : carry_bits_to_add_to_next_column) {
Expand Down Expand Up @@ -750,7 +750,7 @@ struct BoothPassWorker {
SigSpec first_csa_ips;
// get the first 3 inputs, if possible
for (var_ix = 0; var_ix < column_bits.size() && first_csa_ips.size() != 3; var_ix++) {
if (column_bits[var_ix].is_wire())
if (column_bits[var_ix] != State::S0)
first_csa_ips.append(column_bits[var_ix]);
}

Expand Down Expand Up @@ -782,7 +782,7 @@ struct BoothPassWorker {
// get the next two variables to sum
for (; var_ix <= column_bits.size() - 1 && csa_ips.size() < 2;) {
// skip any empty bits
if (column_bits[var_ix].is_wire())
if (column_bits[var_ix] != State::S0)
csa_ips.append(column_bits[var_ix]);
var_ix++;
}
Expand Down
16 changes: 15 additions & 1 deletion tests/techmap/booth.ys
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
test_cell -s 1694091355 -n 100 -script booth_map_script.ys_ $mul
read_verilog <<EOF
module test(clk, a, b, y);
input wire clk;
input wire [9:0] a;
input wire [6:0] b;
output wire [20:0] y;

assign y = a * b;
endmodule
EOF
booth
sat -verify -set a 0 -set b 0 -prove y 0
design -reset

test_cell -s 1694091355 -n 100 -script booth_map_script.ys_ $mul

0 comments on commit 881ce80

Please sign in to comment.