Ophidian
 All Classes Namespaces Functions
standard_cells.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 SRC_STANDARD_CELL_STANDARD_CELLS_H_
22 #define SRC_STANDARD_CELL_STANDARD_CELLS_H_
23 
24 #include "../entity_system/entity_system.h"
25 #include "../standard_cell/cells.h"
26 #include "../standard_cell/pins.h"
27 #include <unordered_map>
28 
29 namespace ophidian {
31 namespace standard_cell {
32 
34 
38 
39  entity_system::entity_system m_cell_system;
40  entity_system::entity_system m_pin_system;
41 
42  cells m_cells;
43  pins m_pins;
44 
45  std::unordered_map<std::string, entity_system::entity> m_name2cell;
46  std::unordered_map<std::string, entity_system::entity> m_name2pin;
47 public:
49 
53  virtual ~standard_cells();
54 
56 
62 
67 
69 
74  return m_cells.names();
75  }
77 
82  entity_system::entity cell_create(std::string name);
84 
89  std::string cell_name(entity_system::entity cell) const {
90  return m_cells.name(cell);
91  }
93 
98  const std::vector<entity_system::entity> & cell_pins(entity_system::entity cell) const {
99  return m_cells.pins(cell);
100  }
102 
106  std::size_t cell_count() const {
107  return m_cell_system.size();
108  }
110 
115  return m_cell_system;
116  }
118 
123  void cell_sequential(entity_system::entity cell, bool sequential);
125 
130  bool cell_sequential(entity_system::entity cell) const {
131  return m_cells.sequential(cell);
132  }
133 
135 
141  entity_system::entity pin_create(entity_system::entity cell, std::string name);
143 
148  entity_system::entity pin_owner(entity_system::entity pin) const
149  {
150  return m_pins.owner(pin);
151  }
153 
158  std::string pin_name(entity_system::entity pin) const {
159  std::string the_name;
160  entity_system::entity owner{m_pins.owner(pin)};
161  if(!(owner == entity_system::invalid_entity))
162  the_name = m_cells.name(owner) + ":";
163  the_name += m_pins.name(pin);
164  return the_name;
165  }
167 
171  std::size_t pin_count() const {
172  return m_pin_system.size();
173  }
175 
180  return m_pin_system;
181  }
183 
188  pin_directions pin_direction(entity_system::entity pin) const {
189  return m_pins.direction(pin);
190  }
192 
197  bool pin_clock_input(entity_system::entity pin) const {
198  return m_pins.clock_input(pin);
199  }
201 
206  void pin_clock_input(entity_system::entity pin, bool clock_input);
208 
213  void pin_direction(entity_system::entity pin, pin_directions direction);
214 
216 
221  entity_system::entity pad_create(std::string name);
222 
223 
224 
225 };
226 
227 } /* namespace standard_cell */
228 } /* namespace ophidian */
229 
230 #endif /* SRC_STANDARD_CELL_STANDARD_CELLS_H_ */
bool cell_sequential(entity_system::entity cell) const
Cell sequential attribute getter.
Definition: standard_cells.h:130
const entity_system::entity_system & pin_system() const
Pin system getter.
Definition: standard_cells.h:179
pin_directions pin_direction(entity_system::entity pin) const
Pin direction getter.
Definition: standard_cells.h:188
std::string cell_name(entity_system::entity cell) const
Cell name getter.
Definition: standard_cells.h:89
entity_system::entity pin_owner(entity_system::entity pin) const
Pin owner getter.
Definition: standard_cells.h:148
Definition: cells.h:30
void register_pin_property(entity_system::property *property)
Registers pin property.
Definition: standard_cells.cpp:54
entity_system::entity pad_create(std::string name)
Creates a pad.
Definition: standard_cells.cpp:82
bool pin_clock_input(entity_system::entity pin) const
Pin clock input attribute getter.
Definition: standard_cells.h:197
standard_cells()
Constructor.
Definition: standard_cells.cpp:26
std::size_t pin_count() const
Returns the number of pins.
Definition: standard_cells.h:171
entity_system::entity pin_create(entity_system::entity cell, std::string name)
Creates a pin.
Definition: standard_cells.cpp:59
const entity_system::vector_property< std::string > & cell_names() const
Cell names getter.
Definition: standard_cells.h:73
entity_system::entity cell_create(std::string name)
Creates a cell.
Definition: standard_cells.cpp:34
const std::vector< entity_system::entity > & cell_pins(entity_system::entity cell) const
Cell pins getter.
Definition: standard_cells.h:98
Property class.
Definition: property.h:33
entity_system class.
Definition: entity_system.h:40
void register_cell_property(entity_system::property *property)
Registers cell property.
Definition: standard_cells.cpp:50
std::size_t cell_count() const
Returns the number of cells.
Definition: standard_cells.h:106
std::size_t size() const
Returns the size of the system.
Definition: entity_system.h:82
Definition: pins.h:35
Standard cell class.
Definition: standard_cells.h:37
std::string pin_name(entity_system::entity pin) const
Pin name getter.
Definition: standard_cells.h:158
const entity_system::entity_system & cell_system() const
Cell system getter.
Definition: standard_cells.h:114
void cell_sequential(entity_system::entity cell, bool sequential)
Cell sequential attribute setter.
Definition: standard_cells.cpp:45