File size: 1,291 Bytes
d1be154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#include <ot/liberty/cell.hpp>

namespace ot {

// Procedure: scale_time
void Cell::scale_time(float s) {
  for(auto& kvp : cellpins) {
    kvp.second.scale_time(s);
  }
}

// Procedure: scale_capacitance
void Cell::scale_capacitance(float s) {
  for(auto& kvp : cellpins) {
    kvp.second.scale_capacitance(s);
  }
}

// Function: cellpin
const Cellpin* Cell::cellpin(const std::string& name) const {
  if(auto itr = cellpins.find(name); itr == cellpins.end()) {
    return nullptr;
  }
  else return &(itr->second);
}

// Operator:: <<
std::ostream& operator << (std::ostream& os, const Cell& c) {

  // Write the cell name.
  os << "cell (\"" << c.name << "\") {\n";

  if(!c.cell_footprint.empty()) {
    os << "  cell_footprint : " << c.cell_footprint << ";\n";
  }

  if(c.leakage_power) {
    os << "  cell_leakage_power : " << *c.leakage_power << ";\n";
  }

  if(c.area) {
    os << "  area : " << *c.area << ";\n";
  }

  // Write the cellpins.
  for(const auto& kvp : c.cellpins) {
    os << kvp.second;
  }
  
  // Write the ending group symbol.
  os << "}\n";

  return os;
}

// ------------------------------------------------------------------------------------------------

};  // end of namespace ot. -----------------------------------------------------------------------