Skip to content

Commit

Permalink
Merge branch 'master' into mpl2-property
Browse files Browse the repository at this point in the history
  • Loading branch information
AcKoucher committed Mar 12, 2024
2 parents a8772b8 + eb75455 commit 4a038ea
Show file tree
Hide file tree
Showing 91 changed files with 18,521 additions and 1,305 deletions.
1 change: 1 addition & 0 deletions .github/workflows/github-actions-clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
build_dir: './build'
cmake_command: cmake . -B build
config_file: '.clang-tidy'
exclude: "*/codeGenerator/templates/*"
split_workflow: true
- name: Upload Artifacts
uses: actions/upload-artifact@v3
Expand Down
6 changes: 6 additions & 0 deletions etc/CodeCoverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ EOF
_lcov() {
./test/regression

# sta has a private test suite; mpl is obsoleted by mpl2;
# drt's gr is not in use
mkdir -p coverage-output
lcov \
--capture \
Expand All @@ -27,6 +29,10 @@ _lcov() {
--exclude "*/.local/*" \
--exclude "*build*" \
--exclude "*/third-party/*" \
--exclude "*/sta/*" \
--exclude "*/mpl/*" \
--exclude "*/drt/src/gr/*" \
--exclude "*/drt/src/db/grObj/*" \
--output-file ./coverage-output/main_coverage.info

genhtml ./coverage-output/main_coverage.info \
Expand Down
3 changes: 2 additions & 1 deletion etc/test_delta_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# variable names such as $(false), unused variables, etc.
set -ue -o pipefail

cd "$(dirname $(readlink -f $0))/../flow"
cd "$(dirname $(readlink -f $0))"
cd ../../../flow

testname=uart

Expand Down
9 changes: 9 additions & 0 deletions include/ord/Design.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

namespace odb {
class dbBlock;
class dbDatabase;
class dbMaster;
class dbMTerm;
class dbNet;
Expand Down Expand Up @@ -192,6 +193,14 @@ class Design
pdn::PdnGen* getPdnGen();
pad::ICeWall* getICeWall();

// This returns a database that is not the one associated with
// the rest of the application. It is usable as a standalone
// db but should not passed to any other Design or Tech APIs.
//
// This is useful if you need a second database for specialized
// use cases and is not ordinarily required.
static odb::dbDatabase* createDetachedDb();

private:
sta::dbSta* getSta();
sta::LibertyCell* getLibertyCell(odb::dbMaster* master);
Expand Down
9 changes: 9 additions & 0 deletions src/Design.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,13 @@ pad::ICeWall* Design::getICeWall()
return app->getICeWall();
}

/* static */
odb::dbDatabase* Design::createDetachedDb()
{
auto app = OpenRoad::openRoad();
auto db = odb::dbDatabase::create();
db->setLogger(app->getLogger());
return db;
}

} // namespace ord
6 changes: 5 additions & 1 deletion src/cts/src/TechChar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,12 @@ void TechChar::initCharacterization()
sta::LibertyLibrary* lib = libertyCell->libertyLibrary();

output->slewLimit(sta::MinMax::max(), maxSlew, maxSlewExist);
if (!maxSlewExist)
if (!maxSlewExist) {
input->slewLimit(sta::MinMax::max(), maxSlew, maxSlewExist);
}
if (!maxSlewExist) {
lib->defaultMaxSlew(maxSlew, maxSlewExist);
}
if (!maxSlewExist)
logger_->error(
CTS, 107, "No max slew found for cell {}.", bufMasterName);
Expand Down
10 changes: 5 additions & 5 deletions src/cts/test/array.ok
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ legalized HPWL 133357.9 u
delta HPWL 0 %

Clock clk
Latency CRPR Skew
inst_7_12/clk ^
1.27
inst_8_12/clk ^
1.14 0.00 0.13
1.27 source latency inst_7_12/clk ^
-1.14 target latency inst_8_12/clk ^
0.00 CRPR
--------------
0.13 setup skew

Startpoint: inst_1_1 (rising edge-triggered flip-flop clocked by clk)
Endpoint: inst_2_1 (rising edge-triggered flip-flop clocked by clk)
Expand Down
12 changes: 7 additions & 5 deletions src/cts/test/array_ins_delay.ok
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ legalized HPWL 186297.4 u
delta HPWL 0 %

Clock clk
Latency CRPR Skew
inst_7_9/clk ^
1.30
inst_8_9/clk ^
1.13 0.00 0.17
1.30 source latency inst_7_9/clk ^
0.00 source clock tree delay
-1.13 target latency inst_8_9/clk ^
-0.00 target clock tree delay
0.00 CRPR
--------------
0.17 setup skew

Startpoint: inst_1_1 (rising edge-triggered flip-flop clocked by clk)
Endpoint: inst_2_1 (rising edge-triggered flip-flop clocked by clk)
Expand Down
10 changes: 5 additions & 5 deletions src/cts/test/array_no_blockages.ok
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ legalized HPWL 133583.9 u
delta HPWL 0 %

Clock clk
Latency CRPR Skew
inst_8_14/clk ^
1.24
inst_10_14/clk ^
1.10 0.00 0.14
1.24 source latency inst_8_14/clk ^
-1.10 target latency inst_10_14/clk ^
0.00 CRPR
--------------
0.14 setup skew

4 changes: 2 additions & 2 deletions src/drt/src/dr/FlexGridGraph_maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ frCost FlexGridGraph::getEstCost(const FlexMazeIdx& src,
0)
* 1;
frCoord minCostZ
= std::max(std::max(getZHeight(dstMazeIdx1.z()) - getZHeight(src.z()),
getZHeight(src.z()) - getZHeight(dstMazeIdx2.z())),
= std::max(std::max(getZHeight(dstMazeIdx1.z()) - getZHeight(gridZ),
getZHeight(gridZ) - getZHeight(dstMazeIdx2.z())),
0)
* 1;

Expand Down
16 changes: 15 additions & 1 deletion src/drt/src/ta/FlexTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ class FlexTAWorkerRegionQuery
frLayerNum layerNum,
std::vector<rq_box_value_t<std::pair<frBlockObject*, frConstraint*>>>&
result) const;
void addViaCost(const Rect& box,
frLayerNum layerNum,
frBlockObject* obj,
frConstraint* con);
void removeViaCost(const Rect& box,
frLayerNum layerNum,
frBlockObject* obj,
frConstraint* con);
void queryViaCost(
const Rect& box,
frLayerNum layerNum,
std::vector<rq_box_value_t<std::pair<frBlockObject*, frConstraint*>>>&
result) const;

void init();

Expand Down Expand Up @@ -213,7 +226,8 @@ class FlexTAWorker
void initFixedObjs_helper(const Rect& box,
frCoord bloatDist,
frLayerNum lNum,
frNet* net);
frNet* net,
bool isViaCost = false);
void initTracks();
void initIroutes();
void initIroute(frGuide* guide);
Expand Down
47 changes: 43 additions & 4 deletions src/drt/src/ta/FlexTA_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ void FlexTAWorker::modMinSpacingCostVia(

auto con = layer->getMinSpacing();
if (isAddCost) {
workerRegionQuery.addCost(blockBox, cutLNum, fig, con);
workerRegionQuery.addViaCost(blockBox, cutLNum, fig, con);
if (pinS) {
workerRegionQuery.query(blockBox, cutLNum, *pinS);
}
} else {
workerRegionQuery.removeCost(blockBox, cutLNum, fig, con);
workerRegionQuery.removeViaCost(blockBox, cutLNum, fig, con);
if (pinS) {
workerRegionQuery.query(blockBox, cutLNum, *pinS);
}
Expand Down Expand Up @@ -501,12 +501,12 @@ void FlexTAWorker::modCutSpacingCost(const Rect& box,
}
if (hasViol) {
if (isAddCost) {
workerRegionQuery.addCost(blockBox, lNum, fig, con);
workerRegionQuery.addViaCost(blockBox, lNum, fig, con);
if (pinS) {
workerRegionQuery.query(blockBox, lNum, *pinS);
}
} else {
workerRegionQuery.removeCost(blockBox, lNum, fig, con);
workerRegionQuery.removeViaCost(blockBox, lNum, fig, con);
if (pinS) {
workerRegionQuery.query(blockBox, lNum, *pinS);
}
Expand Down Expand Up @@ -715,6 +715,7 @@ frUInt4 FlexTAWorker::assignIroute_getDRCCost_helper(taPin* iroute,
Rect& box,
frLayerNum lNum)
{
auto layer = getDesign()->getTech()->getLayer(lNum);
auto& workerRegionQuery = getWorkerRegionQuery();
std::vector<rq_box_value_t<std::pair<frBlockObject*, frConstraint*>>> result;
int overlap = 0;
Expand All @@ -727,6 +728,44 @@ frUInt4 FlexTAWorker::assignIroute_getDRCCost_helper(taPin* iroute,
box.bloat(r, box);
}
workerRegionQuery.queryCost(box, lNum, result);

auto getPartialBox = [this, lNum](Rect box, bool begin) {
auto layer = getTech()->getLayer(lNum);
Rect result;
frCoord addHorz = 0;
frCoord addVert = 0;
if (layer->isHorizontal()) {
addHorz = getDesign()->getTopBlock()->getGCellSizeHorizontal() / 2;
} else {
addVert = getDesign()->getTopBlock()->getGCellSizeVertical() / 2;
}
if (begin) {
result.reset(box.xMin(),
box.yMin(),
std::min(box.xMax(), box.xMin() + addHorz),
std::min(box.yMax(), box.yMin() + addVert));
} else {
result.reset(std::max(box.xMin(), box.xMax() - addHorz),
std::max(box.yMin(), box.yMax() - addVert),
box.xMax(),
box.yMax());
}
return result;
};
std::vector<rq_box_value_t<std::pair<frBlockObject*, frConstraint*>>>
tmpResult;
if (layer->getType() == dbTechLayerType::CUT) {
workerRegionQuery.queryViaCost(box, lNum, tmpResult);
result.insert(result.end(), tmpResult.begin(), tmpResult.end());
} else {
Rect tmpBox = getPartialBox(box, true);
workerRegionQuery.queryViaCost(tmpBox, lNum, tmpResult);
result.insert(result.end(), tmpResult.begin(), tmpResult.end());
tmpResult.clear();
tmpBox = getPartialBox(box, false);
workerRegionQuery.queryViaCost(tmpBox, lNum, tmpResult);
result.insert(result.end(), tmpResult.begin(), tmpResult.end());
}
bool isCut = false;

// save same net overlaps
Expand Down
21 changes: 13 additions & 8 deletions src/drt/src/ta/FlexTA_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ void FlexTAWorker::sortIroutes()
void FlexTAWorker::initFixedObjs_helper(const Rect& box,
frCoord bloatDist,
frLayerNum lNum,
frNet* net)
frNet* net,
bool isViaCost)
{
Rect bloatBox;
box.bloat(bloatDist, bloatBox);
Expand Down Expand Up @@ -664,7 +665,11 @@ void FlexTAWorker::initFixedObjs_helper(const Rect& box,
} else {
tmpBox.init(trackLoc, bloatBox.yMin(), trackLoc, bloatBox.yMax());
}
workerRegionQuery.addCost(tmpBox, lNum, net, con);
if (isViaCost) {
workerRegionQuery.addViaCost(tmpBox, lNum, net, con);
} else {
workerRegionQuery.addCost(tmpBox, lNum, net, con);
}
}
}

Expand Down Expand Up @@ -722,7 +727,7 @@ void FlexTAWorker::initFixedObjs()
if (viaWidth > width) {
bloatDist = initFixedObjs_calcOBSBloatDistVia(
cutLayer->getDefaultViaDef(), layerNum, bounds, false);
initFixedObjs_helper(box, bloatDist, layerNum, netPtr);
initFixedObjs_helper(box, bloatDist, layerNum, netPtr, true);
}
}
// up-via
Expand All @@ -737,7 +742,7 @@ void FlexTAWorker::initFixedObjs()
if (viaWidth > width) {
bloatDist = initFixedObjs_calcOBSBloatDistVia(
cutLayer->getDefaultViaDef(), layerNum, bounds, false);
initFixedObjs_helper(box, bloatDist, layerNum, netPtr);
initFixedObjs_helper(box, bloatDist, layerNum, netPtr, true);
}
}
}
Expand Down Expand Up @@ -777,16 +782,16 @@ void FlexTAWorker::initFixedObjs()

Rect borderBox(
bloatBox.xMin(), bloatBox.yMin(), box.xMin(), bloatBox.yMax());
initFixedObjs_helper(borderBox, 0, layerNum, nullptr);
initFixedObjs_helper(borderBox, 0, layerNum, nullptr, true);
borderBox.init(
bloatBox.xMin(), box.yMax(), bloatBox.xMax(), bloatBox.yMax());
initFixedObjs_helper(borderBox, 0, layerNum, nullptr);
initFixedObjs_helper(borderBox, 0, layerNum, nullptr, true);
borderBox.init(
box.xMax(), bloatBox.yMin(), bloatBox.xMax(), bloatBox.yMax());
initFixedObjs_helper(borderBox, 0, layerNum, nullptr);
initFixedObjs_helper(borderBox, 0, layerNum, nullptr, true);
borderBox.init(
bloatBox.xMin(), bloatBox.yMin(), bloatBox.xMax(), box.yMin());
initFixedObjs_helper(borderBox, 0, layerNum, nullptr);
initFixedObjs_helper(borderBox, 0, layerNum, nullptr, true);
break;
}
default:
Expand Down
Loading

0 comments on commit 4a038ea

Please sign in to comment.