This repository has been archived by the owner on Jan 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mgwoo
committed
Mar 4, 2019
1 parent
d033df8
commit 79b6b1c
Showing
1 changed file
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
#ifndef __REPLACE_ROUTE__ | ||
#define __REPLACE_ROUTE__ 0 | ||
#include "global.h" | ||
#include "lefdefIO.h" | ||
|
||
|
||
enum LayerDirection { | ||
Horizontal, Vertical | ||
}; | ||
|
||
struct Layer { | ||
string layerName; | ||
float layerPitchX, layerPitchY; | ||
float layerWidth; | ||
LayerDirection layerDirection; | ||
Layer(string _layerName, float _layerPitchX, float _layerPitchY, | ||
float _layerWidth, LayerDirection _layerDirection) : | ||
layerName(_layerName), | ||
layerPitchX(_layerPitchX), layerPitchY(_layerPitchY), | ||
layerWidth(_layerWidth), | ||
layerDirection(_layerDirection) {}; | ||
|
||
|
||
void Dump() { | ||
cout << "name: " << layerName << endl; | ||
cout << "pitch: " << layerPitchX << " " << layerPitchY << endl; | ||
cout << "width: " << layerWidth << endl; | ||
cout << "direction: " << | ||
((layerDirection == LayerDirection::Horizontal)? "horizontal" : "vertical") << endl << endl; | ||
} | ||
}; | ||
|
||
struct ReducedTrack { | ||
int layerIdx; | ||
int lx, ly, ux, uy; | ||
int trackCnt; | ||
ReducedTrack( int _layerIdx, int _lx, int _ly, | ||
int _ux, int _uy, int _trackCnt ) : | ||
layerIdx(_layerIdx), lx(_lx), ly(_ly), | ||
ux(_ux), uy(_uy), trackCnt(_trackCnt) {}; | ||
|
||
void Dump() { | ||
cout << "layerIdx: " << layerIdx << endl; | ||
cout << "tileXY: (" << lx << ", " << ly << ") - (" << ux << ", " << uy << ")" << endl; | ||
cout << "track: " << trackCnt << endl << endl; | ||
} | ||
}; | ||
|
||
class RouteInstance { | ||
private: | ||
|
||
vector<Layer> _layerStor; | ||
// LayerIdx --> get corresponding track Count | ||
vector<int> _trackCount; | ||
|
||
|
||
Circuit::Circuit* _ckt; | ||
|
||
float _defDbu; | ||
|
||
float _unitX, _unitY; | ||
float _offsetX, _offsetY; | ||
|
||
// GCellSize in Micron | ||
float _gCellSizeX, _gCellSizeY; | ||
|
||
// to generate *.route files for bookshelf | ||
// GCellSize in Bookshelf's scale, i.e., tileSize | ||
int _tileSizeX, _tileSizeY; | ||
int _gridCountX, _gridCountY; | ||
|
||
int _gridInnerCountX, _gridInnerCountY; | ||
|
||
float _gridOriginX, _gridOriginY; | ||
|
||
dense_hash_map< string, int > _layerMap; | ||
|
||
// Layer Name -> Metal Layer Resources control | ||
dense_hash_map< string, float > _layerCapacityMap; | ||
|
||
// below is for bookshelf | ||
vector< ReducedTrack > _bsReducedTrackStor; | ||
|
||
// located in routeOpt.cpp | ||
// for netInstance, moduleInstance, terminalInstance, ... | ||
void SetReplaceStructure(); | ||
|
||
void FillGCellXY(); | ||
void FillTrack(); | ||
void FillGridXY(); | ||
|
||
void FillForReducedTrackStor(); | ||
|
||
// located in lefdefIO.cpp | ||
void SetScaleFactor(); | ||
void SetCircuitInst(); | ||
|
||
|
||
public: | ||
RouteInstance() : _defDbu(FLT_MIN), _unitX(FLT_MIN), _unitY(FLT_MIN), | ||
_offsetX(FLT_MIN), _offsetY(FLT_MIN), | ||
_gCellSizeX(FLT_MIN), _gCellSizeY(FLT_MIN), | ||
_tileSizeX(INT_MIN), _tileSizeY(INT_MIN), | ||
_gridCountX(INT_MIN), _gridCountY(INT_MIN), | ||
_gridInnerCountX(INT_MIN), _gridInnerCountY(INT_MIN), | ||
_gridOriginX(FLT_MIN), _gridOriginY(FLT_MIN) {}; | ||
|
||
// located in routeOpt.cpp | ||
void Init(); | ||
void FillLayerStor(); | ||
void FillLayerCapacityRatio(string fileName); | ||
|
||
// helper function | ||
int GetLayerCount() { return _layerStor.size(); }; | ||
Layer& GetLayer( int layerIdx ) { return _layerStor[layerIdx]; }; | ||
vector<Layer>& GetLayerStor() {return _layerStor; }; | ||
vector<int>& GetTrackCount() {return _trackCount; }; | ||
int GetTrackCount(int layerIdx) { return _trackCount[layerIdx]; }; | ||
int GetTileSizeX() { return _tileSizeX; }; | ||
int GetTileSizeY() { return _tileSizeY; }; | ||
int GetGridCountX() { return _gridCountX; }; | ||
int GetGridCountY() { return _gridCountY; }; | ||
float GetGridOriginX() {return _gridOriginX; }; | ||
float GetGridOriginY() {return _gridOriginY; }; | ||
Circuit::Circuit* GetCircuitInst() { return _ckt; }; | ||
dense_hash_map<string, int>& GetLayerMap() {return _layerMap; }; | ||
|
||
int GetReducedTrackCount() { return _bsReducedTrackStor.size(); }; | ||
ReducedTrack& GetReducedTrack( int idx ) { return _bsReducedTrackStor[idx]; }; | ||
vector<ReducedTrack>& GetReducedTrackStor() { return _bsReducedTrackStor; }; | ||
|
||
bool IsRoutingLayer( string input ) { return _layerMap.find(input) != _layerMap.end(); }; | ||
int GetRoutingLayerIdx( string input ) { | ||
auto lmPtr = _layerMap.find(input); | ||
if( lmPtr == _layerMap.end() ) { | ||
exit(1); | ||
} | ||
return lmPtr->second; | ||
}; | ||
|
||
}; | ||
|
||
void congEstimation(struct FPOS *st); | ||
extern RouteInstance routeInst; | ||
|
||
#endif |