Ophidian
 All Classes Namespaces Functions
lef.h
1 /*
2  * Copyright 2016 Ophidian
3 Licensed to the Apache Software Foundation (ASF) under one
4 or more contributor license agreements. See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership. The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License. You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0
12 
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations
18 under the License.
19  */
20 
21 #ifndef OPHIDIAN_PARSING_LEF_H
22 #define OPHIDIAN_PARSING_LEF_H
23 
24 #include <string>
25 #include <vector>
26 #include <map>
27 #include <LEF/lefrReader.hpp>
28 
29 namespace ophidian {
30 namespace parsing {
31 
32 class lef {
33 public:
34  struct site {
35  enum symmetries {
36  X=1, Y=2, NINETY=4
37  };
38  std::string name;
39  std::string class_;
40  double x, y;
41  char symmetry{0};
42  void setXsymmetry();
43  void setYsymmetry();
44  void set90symmetry();
45 
46  // void addRowPattern(const char* name, int orient);
47  };
48 
49 
50  struct layer {
51  enum directions {
52  NOT_ASSIGNED, HORIZONTAL, VERTICAL
53  };
54  std::string name;
55  std::string type;
56  directions direction;
57  double pitch;
58  double width;
59  };
60 
61  struct rect {
62  double xl;
63  double yl;
64  double xh;
65  double yh;
66  };
67 
68  struct port {
69  std::vector<std::string> layers;
70  std::vector<rect> rects;
71  };
72 
73  struct pin {
74  enum directions {
75  INPUT, OUTPUT, INOUT, NA
76  };
77 
78  std::string name;
79  directions direction{NA};
80  std::vector<port> ports;
81 
82  };
83 
84  struct macro_size {
85  double x, y;
86  };
87 
88  struct macro_foreign {
89  std::string name;
90  double x;
91  double y;
92  };
93 
94  struct obs {
95  std::map< std::string, std::vector<rect> > layer2rects;
96  };
97 
98  struct macro {
99  std::string name;
100  std::string class_;
101  std::vector<pin> pins;
102  macro_foreign foreign;
103  macro_size size;
104  std::string site;
105  obs obses;
106  macro_size origin;
107 
108  };
109 
110 
111 
112 private:
113 
114 
115  LefDefParser::lefiUnits m_units;
116  std::vector<site> m_sites;
117  std::vector<layer> m_layers;
118  std::vector<macro> m_macros;
119 
120 public:
121  lef(const std::string & filename);
122  virtual ~lef();
123 
124  const std::vector<site> & sites() const
125  {
126  return m_sites;
127  }
128 
129  const std::vector<layer> & layers() const
130  {
131  return m_layers;
132  }
133 
134  const std::vector<macro> & macros() const
135  {
136  return m_macros;
137  }
138 
139  double database_units() const {
140  return m_units.databaseNumber();
141  }
142 
143 };
144 
145 } /* namespace placement */
146 } /* namespace ophidian */
147 
148 #endif /* OPHIDIAN_PARSING_LEF_H */
Definition: lef.h:34
Definition: lef.h:32
Definition: lef.h:98
Definition: lef.h:94
Definition: lef.h:50
Definition: lef.h:73
Definition: lef.h:61
Definition: lef.h:68