Skip to content

Commit 9d18ad6

Browse files
authored
Merge pull request #10495 from The-OpenROAD-Project-staging/syn-fixes
syn: Fix combinational mapper; extend tests
2 parents 67f0055 + dba6a8e commit 9d18ad6

18 files changed

Lines changed: 436 additions & 59 deletions

bazel/bzl_fmt_test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
1111
[ -L MODULE.bazel ] || { echo "MODULE.bazel missing from runfiles" >&2; exit 1; }
1212
WORKSPACE="$(dirname "$(readlink MODULE.bazel)")"
1313
cd "$WORKSPACE"
14-
# `git ls-files` skips submodule contents (src/sta, third-party/abc).
14+
# `-c submodule.recurse=false` keeps git ls-files from descending into
15+
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
16+
# fmt sub-submodule nested in it) — we never want to reformat files
17+
# owned by another repo. The override is needed because CI sets
18+
# submodule.recurse=true globally.
1519
# Explicit -mode=check -lint=off separates format errors from lint warnings,
1620
# and overrides the repo-root .buildifier.json default (mode: fix).
17-
git ls-files '*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
21+
git -c submodule.recurse=false ls-files \
22+
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1823
| xargs -0 "$TOOL" -mode=check -lint=off

bazel/bzl_lint_test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
1111
[ -L MODULE.bazel ] || { echo "MODULE.bazel missing from runfiles" >&2; exit 1; }
1212
WORKSPACE="$(dirname "$(readlink MODULE.bazel)")"
1313
cd "$WORKSPACE"
14-
# `git ls-files` skips submodule contents (src/sta, third-party/abc), so
15-
# we never try to reformat files owned by another repo.
14+
# `-c submodule.recurse=false` keeps git ls-files from descending into
15+
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
16+
# fmt sub-submodule nested in it) — we never want to reformat files
17+
# owned by another repo. The override is needed because CI sets
18+
# submodule.recurse=true globally.
1619
# Explicit -mode=check overrides the repo-root .buildifier.json default.
17-
git ls-files '*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
20+
git -c submodule.recurse=false ls-files \
21+
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1822
| xargs -0 "$TOOL" -mode=check -lint=warn

bazel/bzl_tidy.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
set -euo pipefail
77
TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
88
cd "${BUILD_WORKSPACE_DIRECTORY:-$PWD}"
9-
# `git ls-files` skips submodule contents (src/sta, third-party/abc),
10-
# so we never rewrite files owned by another repo.
11-
git ls-files '*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
9+
# `-c submodule.recurse=false` keeps git ls-files from descending into
10+
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
11+
# fmt sub-submodule nested in it) — we never want to rewrite files
12+
# owned by another repo. The override is needed because CI sets
13+
# submodule.recurse=true globally.
14+
git -c submodule.recurse=false ls-files \
15+
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1216
| xargs -0 "$TOOL" -mode=fix -lint=fix

src/syn/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ cc_library(
1616
srcs = [
1717
"src/flow/abc.cc",
1818
"src/flow/bitblast.cc",
19-
"src/flow/bitblast.h",
2019
"src/flow/combinational_mapper.cc",
21-
"src/flow/combinational_mapper.h",
2220
"src/flow/combinational_mapper_npn.cc",
2321
"src/flow/combinational_mapper_npn.h",
2422
"src/flow/constant_fold.cc",

src/syn/include/syn/synthesis.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,15 @@ class Synthesis : public sta::dbStaState
117117
// Free-function entry points re-declared here so tests don't need to
118118
// pull in the private flow/ headers. The Synthesis methods of the same
119119
// names forward to these.
120+
void bitblast(Graph& g, bool blast_arith = true);
120121
void mapSequentials(Graph& g,
121122
sta::Network* network,
122123
utl::Logger* logger,
123124
const Synthesis& syn);
125+
void mapCombinationals(Graph& g,
126+
sta::Network* network,
127+
utl::Logger* logger,
128+
const Synthesis& syn);
124129
void abcRoundtrip(Graph& g, const std::string& commands, utl::Logger* logger);
125130
void livenessOpt(Graph& g,
126131
utl::Logger* logger,

src/syn/src/flow/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_library(syn_flow
1515
)
1616

1717
set(_syn_flow_stage ${CMAKE_CURRENT_BINARY_DIR}/include/flow)
18-
foreach(_h bitblast.h combinational_mapper.h combinational_mapper_npn.h export.h import.h opt_gatefusion.h)
18+
foreach(_h combinational_mapper_npn.h export.h import.h opt_gatefusion.h)
1919
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${_h} ${_syn_flow_stage}/${_h} COPYONLY)
2020
endforeach()
2121

src/syn/src/flow/bitblast.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
// Bitblast pass: converts arithmetic operations and muxes
55
// to And/Andnot/Or/Xor/Not gates.
66

7-
#include "flow/bitblast.h"
8-
97
#include <algorithm>
108
#include <cassert>
119
#include <cstddef>
@@ -22,6 +20,7 @@
2220
#include "syn/ir/Graph.h"
2321
#include "syn/ir/Instance.h"
2422
#include "syn/ir/Net.h"
23+
#include "syn/synthesis.h"
2524

2625
namespace syn {
2726

src/syn/src/flow/bitblast.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/syn/src/flow/combinational_mapper.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// standard cells from a liberty library using cut-based technology
66
// mapping with NPN canonicalization.
77

8-
#include "flow/combinational_mapper.h"
9-
108
#include <algorithm>
119
#include <cassert>
1210
#include <cmath>
@@ -677,8 +675,8 @@ void Mapping::prepareMatches(const int npriority_cuts,
677675
int psSlot = 0;
678676
ClassMatch* matchBuf = allocMatches(nmatches_max);
679677

680-
for (int i = -1; i < cache[n1->fid].ps.size(); i++) {
681-
for (int j = -1; j < cache[n2->fid].ps.size(); j++) {
678+
for (int i = -1; i < (int) cache[n1->fid].ps.size(); i++) {
679+
for (int j = -1; j < (int) cache[n2->fid].ps.size(); j++) {
682680
Net* n1Cut = ((i == -1) ? t1 : cache[n1->fid].ps[i].cut);
683681
Net* n2Cut = ((j == -1) ? t2 : cache[n2->fid].ps[j].cut);
684682
int n1CutLen = (i == -1) ? 1 : cutLen(n1Cut);

src/syn/src/flow/combinational_mapper.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)