-
Notifications
You must be signed in to change notification settings - Fork 6
/
LefDefNetwork.hh
147 lines (128 loc) · 4.07 KB
/
LefDefNetwork.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Resizer, LEF/DEF gate resizer
// Copyright (c) 2019, Parallax Software, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef RESIZER_LEF_DEF_NETWORK_H
#define RESIZER_LEF_DEF_NETWORK_H
#include "UnorderedMap.hh"
#include "ConcreteLibrary.hh"
#include "ConcreteNetwork.hh"
#include "lefiLayer.hpp"
#include "lefiMacro.hpp"
#include "defiComponent.hpp"
#include "defiNet.hpp"
namespace sta {
class DefPt;
// Database location type used by DEF parser.
typedef int DefDbu;
class DefPt
{
public:
DefPt();
DefPt(DefDbu x,
DefDbu y);
DefDbu x() const { return x_; }
DefDbu y() const { return y_; }
private:
DefDbu x_;
DefDbu y_;
};
// No need to specializing ConcreteLibrary at this point.
typedef UnorderedMap<Cell*, LibertyCell*> LibertyCellMap;
typedef UnorderedMap<Port*, DefPt> DefPortLocations;
typedef UnorderedMap<Instance*, defiComponent *> InstanceDefComponentMap;
typedef UnorderedMap<Cell*, lefiMacro*> CellLefMacroMap;
typedef Map<const char*, lefiSite*, CharPtrLess> LefSiteMap;
typedef Vector<lefiLayer> LefLayerSeq;
class LefDefNetwork : public ConcreteNetwork
{
public:
LefDefNetwork();
virtual ~LefDefNetwork();
void initState(Report *report,
Debug *debug);
virtual void clear();
void setDivider(char divider);
const char *defFilename() { return def_filename_; }
void setDefFilename(const char *filename);
// dbu/micron
float defUnits() const { return def_units_; }
void setDefUnits(int def_units);
double dbuToMeters(DefDbu dbu) const;
DefDbu metersToDbu(double dist) const;
// LEF
void setManufacturingGrid(double grid);
// microns
double manufacturingGrid() const { return manufacturing_grid_; }
Library *makeLefLibrary(const char *name,
const char *filename);
Library *lefLibrary() const { return lef_library_; }
lefiSite *findLefSite(const char *name);
void makeLefSite(lefiSite *site);
void makeLefLayer(lefiLayer *layer);
LefLayerSeq &lefLayers() { return lef_layers_; }
lefiMacro *lefMacro(Cell *cell) const;
void setLefMacro(Cell *cell,
lefiMacro *lef_macro);
Cell *lefCell(LibertyCell *cell);
bool isLefCell(Cell *cell) const;
// DEF
void setDieArea(DefDbu die_lx,
DefDbu die_ly,
DefDbu die_ux,
DefDbu die_uy);
void dieArea(// Return values.
DefDbu &die_lx,
DefDbu &die_ly,
DefDbu &die_ux,
DefDbu &die_uy);
void initTopInstancePins();
Instance *makeDefComponent(Cell *cell,
const char *name,
defiComponent *def_component);
defiComponent *defComponent(Instance *inst) const;
// In DBUs.
DefPt location(const Pin *pin) const;
void setLocation(Instance *instance,
DefPt location);
// Set top level pin/port location.
void setLocation(Port *port,
DefPt location);
bool isPlaced(const Pin *pin) const;
virtual Instance *findInstance(const char *path_name) const;
virtual Net *findNet(const char *path_name) const;
void connectedPins(const Net *net,
PinSeq &pins);
double area(Cell *cell) const;
double area(Instance *inst) const;
double designArea();
using ConcreteNetwork::connect;
using ConcreteNetwork::findNet;
protected:
const char *def_filename_;
Library *lef_library_;
int def_units_; // dbu/micron
double manufacturing_grid_; // microns
DefDbu die_lx_;
DefDbu die_ly_;
DefDbu die_ux_;
DefDbu die_uy_;
DefPortLocations port_locations_;
InstanceDefComponentMap def_component_map_;
CellLefMacroMap lef_macro_map_;
LefSiteMap lef_size_map_;
LefLayerSeq lef_layers_;
};
} // namespace
#endif