Skip to content

Commit 0ae774d

Browse files
committed
Merge remote-tracking branch 'origin/master' into odb-refactor3
Signed-off-by: Matt Liberty <[email protected]>
2 parents 8de157e + 7559f96 commit 0ae774d

File tree

7 files changed

+68
-174
lines changed

7 files changed

+68
-174
lines changed

src/drt/src/io/GuideProcessor.cpp

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "frBaseTypes.h"
2525
#include "frDesign.h"
2626
#include "frProfileTask.h"
27+
#include "global.h"
2728
#include "odb/db.h"
2829
#include "odb/dbTypes.h"
2930
#include "odb/geom.h"
@@ -207,7 +208,8 @@ Point3D findBestPinLocation(frDesign* design,
207208
*/
208209
int findClosestGuide(const Point3D& best_pin_loc_coords,
209210
const std::vector<frRect>& guides,
210-
const frCoord layer_change_penalty)
211+
const frCoord layer_change_penalty,
212+
const RouterConfiguration* router_cfg)
211213
{
212214
int closest_guide_idx = 0;
213215
int dist = 0;
@@ -217,6 +219,9 @@ int findClosestGuide(const Point3D& best_pin_loc_coords,
217219
dist = odb::manhattanDistance(guide.getBBox(), best_pin_loc_coords);
218220
dist += abs(guide.getLayerNum() - best_pin_loc_coords.z())
219221
* layer_change_penalty;
222+
if (guide.getLayerNum() < router_cfg->BOTTOM_ROUTING_LAYER) {
223+
dist += 1e9;
224+
}
220225
if (dist < min_dist) {
221226
min_dist = dist;
222227
closest_guide_idx = guide_idx;
@@ -352,41 +357,6 @@ void fillGuidesUpToZ(const Point3D& best_pin_loc_coords,
352357
net);
353358
}
354359
}
355-
/**
356-
* @brief Connects the guides with the best pin shape location (on the 2D
357-
* plane only)
358-
*
359-
* The function creates a patch guide that connects the closest guide to
360-
* best_pin_loc_coords (without consideration to different layers)
361-
*
362-
* @param guide_pt The center of the gcell on the guide that is closest to
363-
* best_pin_loc_coords
364-
* @param best_pin_loc_coords The gcell center point of the chosen pin shape
365-
* @param gcell_half_size_horz Half the horizontal size of the gcell
366-
* @param gcell_half_size_vert Half the vertical size of the gcell
367-
*/
368-
void connectGuidesWithBestPinLoc(const Point3D& guide_pt,
369-
const odb::Point& best_pin_loc_coords,
370-
const frCoord gcell_half_size_horz,
371-
const frCoord gcell_half_size_vert,
372-
frNet* net,
373-
std::vector<frRect>& guides)
374-
{
375-
if (guide_pt.x() != best_pin_loc_coords.x()
376-
|| guide_pt.y() != best_pin_loc_coords.y()) {
377-
const odb::Point pl = {std::min(best_pin_loc_coords.x(), guide_pt.x()),
378-
std::min(best_pin_loc_coords.y(), guide_pt.y())};
379-
const odb::Point ph = {std::max(best_pin_loc_coords.x(), guide_pt.x()),
380-
std::max(best_pin_loc_coords.y(), guide_pt.y())};
381-
382-
guides.emplace_back(pl.x() - gcell_half_size_horz,
383-
pl.y() - gcell_half_size_vert,
384-
ph.x() + gcell_half_size_horz,
385-
ph.y() + gcell_half_size_vert,
386-
guide_pt.z(),
387-
net);
388-
}
389-
}
390360

391361
/**
392362
* @brief logs the number of guides read so far
@@ -949,6 +919,43 @@ void GuideProcessor::buildGCellPatterns()
949919
}
950920
}
951921

922+
void GuideProcessor::connectGuidesWithBestPinLoc(
923+
Point3D& guide_pt,
924+
const odb::Point& best_pin_loc_coords,
925+
const frCoord gcell_half_size_horz,
926+
const frCoord gcell_half_size_vert,
927+
frNet* net,
928+
std::vector<frRect>& guides)
929+
{
930+
if (guide_pt.x() != best_pin_loc_coords.x()
931+
|| guide_pt.y() != best_pin_loc_coords.y()) {
932+
const odb::Point pl = {std::min(best_pin_loc_coords.x(), guide_pt.x()),
933+
std::min(best_pin_loc_coords.y(), guide_pt.y())};
934+
const odb::Point ph = {std::max(best_pin_loc_coords.x(), guide_pt.x()),
935+
std::max(best_pin_loc_coords.y(), guide_pt.y())};
936+
bool is_horizontal = pl.x() != ph.x();
937+
bool is_vertical = pl.y() != ph.y();
938+
frLayerNum layer_num = guide_pt.z();
939+
if (is_horizontal ^ is_vertical) {
940+
if ((is_vertical && design_->isHorizontalLayer(layer_num))
941+
|| (is_horizontal && design_->isVerticalLayer(layer_num))) {
942+
if (layer_num + 2 <= router_cfg_->TOP_ROUTING_LAYER) {
943+
layer_num += 2;
944+
} else {
945+
layer_num -= 2;
946+
}
947+
}
948+
}
949+
guide_pt.setZ(layer_num);
950+
guides.emplace_back(pl.x() - gcell_half_size_horz,
951+
pl.y() - gcell_half_size_vert,
952+
ph.x() + gcell_half_size_horz,
953+
ph.y() + gcell_half_size_vert,
954+
layer_num,
955+
net);
956+
}
957+
}
958+
952959
void GuideProcessor::patchGuides_helper(frNet* net,
953960
std::vector<frRect>& guides,
954961
const Point3D& best_pin_loc_idx,
@@ -1012,7 +1019,7 @@ void GuideProcessor::patchGuides(frNet* net,
10121019
// get the guide that is closest to the gCell
10131020
// TODO: test passing layer_change_penalty = gcell size
10141021
const int closest_guide_idx
1015-
= findClosestGuide(best_pin_loc_coords, guides, 1);
1022+
= findClosestGuide(best_pin_loc_coords, guides, 1, router_cfg_);
10161023

10171024
patchGuides_helper(
10181025
net, guides, best_pin_loc_idx, best_pin_loc_coords, closest_guide_idx);

src/drt/src/io/GuideProcessor.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ class GuideProcessor
9191
const Point3D& best_pin_loc_idx,
9292
const Point3D& best_pin_loc_coords,
9393
int closest_guide_idx);
94+
/**
95+
* @brief Connects the guides with the best pin shape location (on the 2D
96+
* plane only)
97+
*
98+
* The function creates a patch guide that connects the closest guide to
99+
* best_pin_loc_coords (without consideration to different layers)
100+
*
101+
* @param guide_pt The center of the gcell on the guide that is closest to
102+
* best_pin_loc_coords
103+
* @param best_pin_loc_coords The gcell center point of the chosen pin shape
104+
* @param gcell_half_size_horz Half the horizontal size of the gcell
105+
* @param gcell_half_size_vert Half the vertical size of the gcell
106+
*/
107+
void connectGuidesWithBestPinLoc(Point3D& guide_pt,
108+
const odb::Point& best_pin_loc_coords,
109+
frCoord gcell_half_size_horz,
110+
frCoord gcell_half_size_vert,
111+
frNet* net,
112+
std::vector<frRect>& guides);
94113
/**
95114
* @brief Patches guides to cover part of the pin if needed.
96115
*

src/rcx/include/rcx/extMeasureRC.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,6 @@ struct CouplingState
5252
one_count_table++;
5353
}
5454
}
55-
56-
// Print statistics
57-
void printStats(FILE* fp, uint dir) const
58-
{
59-
if (fp) {
60-
fprintf(fp,
61-
"\nDir=%d wireCnt=%d NotOrderedCnt=%d oneEmptyTable=%d "
62-
"oneCntTable=%d\n",
63-
dir,
64-
wire_count,
65-
not_ordered_count,
66-
empty_table_count,
67-
one_count_table);
68-
}
69-
}
7055
};
7156
struct CouplingConfig
7257
{

src/rcx/include/rcx/extRCap.h

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,6 @@ class extRCModel
763763
const char* name,
764764
const char* suffix,
765765
const char* permissions);
766-
FILE* openSolverFile();
767766
void mkNet_prefix(extMeasure* m, const char* wiresNameSuffix);
768767
void mkFileNames(extMeasure* m, char* wiresNameSuffix);
769768
void writeWires2(FILE* fp, extMeasure* measure, uint wireCnt);
@@ -1367,7 +1366,6 @@ class extMeasure
13671366
double s2 = 0.0);
13681367
void setEffParams(double wTop, double wBot, double teff);
13691368
void addCap();
1370-
void printStats(FILE* fp);
13711369
void printMets(FILE* fp);
13721370

13731371
ext2dBox* addNew2dBox(odb::dbNet* net, int* ll, int* ur, uint m, bool cntx);
@@ -2698,7 +2696,6 @@ class extMain
26982696
uint _ccUp = 0;
26992697
uint _couplingFlag = 0;
27002698
bool _rotatedGs = false;
2701-
// uint _ccContextDepth = 0;
27022699
int _ccMinX;
27032700
int _ccMinY;
27042701
int _ccMaxX;
@@ -2789,95 +2786,14 @@ class extMain
27892786

27902787
int _noVariationIndex;
27912788

2792-
bool _ignoreWarning_1st;
2793-
bool _keepExtModel;
2794-
27952789
friend class extMeasure;
27962790

2797-
FILE* _blkInfoVDD = nullptr;
2798-
FILE* _viaInfoVDD = nullptr;
2799-
FILE* _blkInfoGND = nullptr;
2800-
FILE* _viaInfoGND = nullptr;
2801-
2802-
FILE* _stdCirVDD = nullptr;
2803-
FILE* _globCirVDD = nullptr;
2804-
FILE* _globGeomVDD = nullptr;
2805-
FILE* _stdCirGND = nullptr;
2806-
FILE* _globCirGND = nullptr;
2807-
2808-
FILE* _stdCirHeadVDD = nullptr;
2809-
FILE* _globCirHeadVDD = nullptr;
2810-
FILE* _globGeomGND = nullptr;
2811-
FILE* _stdCirHeadGND = nullptr;
2812-
FILE* _globCirHeadGND = nullptr;
2813-
FILE* _blkInfo = nullptr;
2814-
FILE* _viaInfo = nullptr;
2815-
FILE* _globCir = nullptr;
2816-
FILE* _globGeom = nullptr;
2817-
FILE* _stdCir = nullptr;
2818-
FILE* _globCirHead = nullptr;
2819-
FILE* _stdCirHead = nullptr;
2820-
FILE* _viaStackGlobCir = nullptr;
2821-
FILE* _viaStackGlobVDD = nullptr;
2822-
FILE* _viaStackGlobGND = nullptr;
2823-
2824-
Ath__array1D<int>* _junct2viaMap = nullptr;
2825-
bool _dbgPowerFlow;
2826-
dbCreateNetUtil* _netUtil = nullptr;
2827-
2828-
std::vector<odb::dbBox*> _viaUp_VDDtable;
2829-
std::vector<odb::dbBox*> _viaUp_GNDtable;
2830-
std::vector<odb::dbBox*> _viaM1_GNDtable;
2831-
std::vector<odb::dbBox*> _viaM1_VDDtable;
2832-
std::vector<odb::dbBox*>* _viaM1Table = nullptr;
2833-
std::vector<odb::dbBox*>* _viaUpTable = nullptr;
2834-
2835-
uint _stackedViaResCnt;
2836-
uint _totViaResCnt;
2837-
Ath__array1D<int>* _via2JunctionMap = nullptr;
2838-
std::map<odb::dbBox*, odb::dbNet*> _via_map;
2839-
std::map<uint, odb::dbNet*> _via_id_map;
2840-
std::map<uint, float> _capNode_map;
2841-
std::vector<odb::dbInst*> _powerMacroTable;
2842-
std::vector<odb::dbBox*> _viaUpperTable[2];
2843-
Ath__array1D<char*>** _supplyViaMap[2]{nullptr, nullptr};
2844-
Ath__array1D<odb::dbBox*>** _supplyViaTable[2]{nullptr, nullptr};
2845-
char* _power_source_file = nullptr;
2846-
std::vector<char*> _powerSourceTable[2];
2847-
FILE* _coordsFP = nullptr;
2848-
FILE* _coordsGND = nullptr;
2849-
FILE* _coordsVDD = nullptr;
2850-
std::vector<uint> _vddItermIdTable;
2851-
std::vector<uint> _gndItermIdTable;
2852-
FILE* _subCktNodeFP[2][2]{{nullptr, nullptr}, {nullptr, nullptr}};
2853-
uint _subCktNodeCnt[2][2];
2854-
bool _nodeCoords;
2855-
int _prevX;
2856-
int _prevY;
2857-
char _node_blk_dir[1024];
2858-
char _node_blk_prefix[1024];
2859-
char _node_inst_prefix[1024];
2860-
Ath__array1D<odb::dbITerm*>* _junct2iterm = nullptr;
2861-
std::map<uint, odb::dbSBox*> _sbox_id_map;
2862-
2863-
uint _powerWireCnt;
2864-
uint _mergedPowerWireCnt;
2865-
uint _overlapPowerWireCnt;
2866-
uint _viaOverlapPowerCnt;
2867-
uint _multiViaCnt;
2868-
2869-
std::vector<odb::Rect*> _multiViaTable[20];
2870-
std::vector<odb::dbBox*> _multiViaBoxTable[20];
2871-
2872-
// v2 uint _debug_net_id = 0;
28732791
float _previous_percent_extracted = 0;
28742792

28752793
double _minCapTable[64][64];
28762794
double _maxCapTable[64][64];
28772795
double _minResTable[64][64];
28782796
double _maxResTable[64][64];
2879-
uint _rcLayerCnt;
2880-
uint _rcCornerCnt;
28812797

28822798
public:
28832799
bool _lef_res;

src/rcx/src/extRCmodel.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,22 +2618,6 @@ void extMeasure::printMets(FILE* fp)
26182618
}
26192619
}
26202620

2621-
void extMeasure::printStats(FILE* fp)
2622-
{
2623-
fprintf(fp,
2624-
"<==> w= %g[%g %g] s= %g[%g] th= %g[%g] h= %g[%g] r= %g",
2625-
_w_m,
2626-
_topWidth,
2627-
_botWidth,
2628-
_s_m,
2629-
_seff,
2630-
_t,
2631-
_teff,
2632-
_h,
2633-
_heff,
2634-
_r);
2635-
}
2636-
26372621
FILE* extRCModel::openFile(const char* topDir,
26382622
const char* name,
26392623
const char* suffix,
@@ -2787,16 +2771,6 @@ FILE* extRCModel::mkPatternFile()
27872771
return fp;
27882772
}
27892773

2790-
FILE* extRCModel::openSolverFile()
2791-
{
2792-
FILE* fp = openFile(_wireDirName, _wireFileName, ".out", "r");
2793-
if (fp != nullptr) {
2794-
_parser->setInputFP(fp);
2795-
}
2796-
2797-
return fp;
2798-
}
2799-
28002774
bool extRCModel::openCapLogFile()
28012775
{
28022776
if (!_readSolver && !_runSolver) {

src/rcx/src/parse.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ static char* ATH__allocCharWord(int n, utl::Logger* logger)
4949
Ath__parser::Ath__parser(utl::Logger* logger)
5050
{
5151
_logger = logger;
52-
_lineSize = 10000;
53-
_maxWordCnt = 100;
5452
init();
5553
}
5654

@@ -69,7 +67,6 @@ Ath__parser::~Ath__parser()
6967
}
7068
delete[] _inputFile;
7169
delete[] _line;
72-
delete[] _tmpLine;
7370
delete[] _wordSeparators;
7471

7572
for (int ii = 0; ii < _maxWordCnt; ii++) {
@@ -86,7 +83,6 @@ Ath__parser::~Ath__parser()
8683
void Ath__parser::init()
8784
{
8885
_line = ATH__allocCharWord(_lineSize, _logger);
89-
_tmpLine = ATH__allocCharWord(_lineSize, _logger);
9086

9187
_wordArray = new char*[_maxWordCnt];
9288

@@ -98,15 +94,11 @@ void Ath__parser::init()
9894

9995
strcpy(_wordSeparators, " \n\t");
10096

101-
_commentChar = '#';
102-
10397
_lineNum = 0;
10498
_currentWordCnt = -1;
10599

106100
_inFP = nullptr;
107101
_inputFile = ATH__allocCharWord(512, _logger);
108-
109-
_progressLineChunk = 1000000;
110102
}
111103

112104
int Ath__parser::getLineNum()

src/rcx/src/parse.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@ class Ath__parser
5454
char* _tmpLine;
5555
char* _wordSeparators;
5656
char** _wordArray;
57-
char _commentChar;
58-
int _maxWordCnt;
5957

6058
int _lineNum;
6159
int _currentWordCnt;
62-
int _lineSize;
6360
FILE* _inFP;
6461
char* _inputFile;
6562

66-
int _progressLineChunk;
6763
utl::Logger* _logger;
64+
65+
static constexpr int _progressLineChunk = 1000000;
66+
static constexpr char _commentChar = '#';
67+
static constexpr int _maxWordCnt = 100;
68+
static constexpr int _lineSize = 10000;
6869
};
6970

7071
} // namespace rcx

0 commit comments

Comments
 (0)