Hurricane VLSI Database


PhysicalRule.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2009-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | H u r r i c a n e A n a l o g |
9 // | |
10 // | Authors : Damien Dupuis |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./hurricane/PhysicalRule.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #pragma once
18 #include <tuple>
19 #include "hurricane/DbU.h"
20 #include "hurricane/Rule.h"
21 
22 
23 namespace Hurricane {
24 
25 
26  class RuleStep {
27  public:
28  inline RuleStep ( Hurricane::DbU::Unit uValue );
29  inline RuleStep ( Hurricane::DbU::Unit hValue, Hurricane::DbU::Unit vValue );
30  inline Hurricane::DbU::Unit getValue () const;
31  inline Hurricane::DbU::Unit getHValue () const;
32  inline Hurricane::DbU::Unit getVValue () const;
33  inline Hurricane::DbU::Unit getThreshold () const;
34  inline void setThreshold ( Hurricane::DbU::Unit );
35  public:
36  std::string _getTypeName () const;
37  std::string _getString () const;
38  Record* _getRecord () const;
39  private:
40  Hurricane::DbU::Unit _hValue;
41  Hurricane::DbU::Unit _vValue;
42  Hurricane::DbU::Unit _threshold;
43  };
44 
45 
46  inline RuleStep::RuleStep ( Hurricane::DbU::Unit uValue )
47  : _hValue (uValue)
48  , _vValue (uValue)
49  , _threshold(0)
50  { }
51 
52  inline RuleStep::RuleStep ( Hurricane::DbU::Unit hValue, Hurricane::DbU::Unit vValue )
53  : _hValue (hValue)
54  , _vValue (vValue)
55  , _threshold(0)
56  { }
57 
58  inline Hurricane::DbU::Unit RuleStep::getValue () const { return _hValue; }
59  inline Hurricane::DbU::Unit RuleStep::getHValue () const { return _hValue; }
60  inline Hurricane::DbU::Unit RuleStep::getVValue () const { return _vValue; }
61  inline Hurricane::DbU::Unit RuleStep::getThreshold () const { return _threshold; }
62  inline void RuleStep::setThreshold ( Hurricane::DbU::Unit t ) { _threshold = t; }
63 
64 
65  class PhysicalRule : public Rule {
66  public:
67  typedef Rule Super;
68  typedef std::vector<RuleStep> Steps;
69  public:
70  inline PhysicalRule ( const Name& name, const std::string& reference );
71  inline PhysicalRule ( const PhysicalRule& rule );
72  virtual ~PhysicalRule ();
73  inline bool isDouble () const;
74  inline bool isDbU () const;
75  inline bool isSymmetric () const;
76  inline bool hasSteps () const;
77  inline void setSymmetric ( bool );
78  inline double getDoubleValue () const;
79  inline DbU::Unit getValue ( Hurricane::DbU::Unit length=0, bool hDir=true ) const;
80  inline void addValue ( double );
81  inline void addValue ( Hurricane::DbU::Unit value
82  , Hurricane::DbU::Unit maxLength );
83  inline void addValue ( Hurricane::DbU::Unit hValue
84  , Hurricane::DbU::Unit vValue
85  , Hurricane::DbU::Unit maxLength );
86  public:
87  virtual std::string _getTypeName () const;
88  virtual std::string _getString () const;
89  virtual Record* _getRecord () const;
90  public:
91  inline void _addValue ( const RuleStep& );
92  private:
93  Steps _stepsValue;
94  double _doubleValue;
95  bool _symmetric;
96  };
97 
98 
99  inline PhysicalRule::PhysicalRule ( const Name& name
100  , const std::string& reference )
101  : Rule(name,reference)
102  , _stepsValue ()
103  , _doubleValue(0.0)
104  , _symmetric (true)
105  { }
106 
107 
108  inline PhysicalRule::PhysicalRule ( const PhysicalRule& rule )
109  : Rule(rule.getName(),rule.getReference())
110  , _stepsValue (rule._stepsValue)
111  , _doubleValue(rule._doubleValue)
112  { }
113 
114 
115  inline bool PhysicalRule::isDouble () const { return _doubleValue != 0; }
116  inline bool PhysicalRule::isDbU () const { return not _stepsValue.empty(); }
117  inline bool PhysicalRule::isSymmetric () const { return _symmetric; }
118  inline bool PhysicalRule::hasSteps () const { return not (_stepsValue.size() > 1); }
119  inline double PhysicalRule::getDoubleValue () const { return _doubleValue; }
120  inline void PhysicalRule::setSymmetric ( bool state ) { _symmetric = state; }
121  inline void PhysicalRule::addValue ( double value ) { _doubleValue = value; }
122 
123 
125  {
126  if (_stepsValue.empty()) return 0;
127  for ( const RuleStep& step : _stepsValue ) {
128  if (length < step.getThreshold()) {
129  return (hDir) ? step.getHValue() : step.getVValue();
130  }
131  }
132  return (hDir) ? _stepsValue.back().getHValue() : _stepsValue.back().getVValue();;
133  }
134 
135 
137  {
138  RuleStep step ( value );
139  step.setThreshold( maxLength );
140  _addValue( step );
141  }
142 
143 
145  {
146  RuleStep step ( hValue, vValue );
147  step.setThreshold( maxLength );
148  _addValue( step );
149  }
150 
151 
152  inline void PhysicalRule::_addValue ( const RuleStep& step )
153  {
154  for ( auto istep = _stepsValue.begin() ; istep != _stepsValue.end() ; ++istep ) {
155  if (step.getThreshold() < (*istep).getThreshold()) {
156  _stepsValue.insert( istep, step );
157  return;
158  }
159  }
160  _stepsValue.push_back( step );
161  }
162 
163 
164 } // Hurricane namespace.
165 
166 
167 INSPECTOR_P_SUPPORT(Hurricane::PhysicalRule);
168 INSPECTOR_PR_SUPPORT(Hurricane::RuleStep);
std::int64_t Unit
Definition: DbU.h:67
Name description (API)
Definition: Name.h:35
Define a rule for the technology (API).
Definition: PhysicalRule.h:65
bool isSymmetric() const
Definition: PhysicalRule.h:117
double getDoubleValue() const
Definition: PhysicalRule.h:119
bool hasSteps() const
Definition: PhysicalRule.h:118
DbU::Unit getValue(Hurricane::DbU::Unit length=0, bool hDir=true) const
Definition: PhysicalRule.h:124
bool isDouble() const
Definition: PhysicalRule.h:115
void addValue(double)
Definition: PhysicalRule.h:121
bool isDbU() const
Definition: PhysicalRule.h:116
void setSymmetric(bool)
Definition: PhysicalRule.h:120
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5


Generated by doxygen 1.9.1 on Thu Aug 11 2022 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved