Ophidian
 All Classes Namespaces Functions
sta_timing_arc_calculator.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_TIMING_STA_TIMING_ARC_CALCULATOR_H_
22 #define SRC_TIMING_STA_TIMING_ARC_CALCULATOR_H_
23 
24 #include <lemon/list_graph.h>
25 #include "graph_nodes_timing.h"
26 #include "graph_arcs_timing.h"
27 #include "library.h"
28 
29 #include "sta_arc_calculator.h"
30 #include "graph.h"
31 
32 namespace openeda {
33 namespace timing {
34 
35 class sta_timing_arc_calculator: public sta_timing_edge_calculator {
36  const library & m_library;
37 
38 public:
39  sta_timing_arc_calculator(const library & lib);
40  virtual ~sta_timing_arc_calculator();
41 
42  void update(const graph& g, const graph_nodes_timing& nodes_timing, sta_timing_point_calculator & tpoints, graph_arcs_timing & m_arcs) {
43  boost::units::quantity<boost::units::si::capacitance> target_load;
44  boost::units::quantity<boost::units::si::time> source_slew ;
45  for (std::deque<lemon::ListDigraph::Arc>::const_iterator arc_it = m_to_process.begin(); arc_it != m_to_process.end(); ++arc_it) {
46  target_load = nodes_timing.load(g.edge_target(*arc_it));
47  source_slew = nodes_timing.slew(g.edge_source(*arc_it));
48  const entity::entity tarc = g.edge_entity(*arc_it);
49  boost::units::quantity<boost::units::si::time> delay, slew;
50  switch (g.node_edge( g.edge_target(*arc_it) )) {
51  case edges::RISE:
52  delay = m_library.timing_arc_rise_delay(tarc).compute(target_load, source_slew);
53  slew = m_library.timing_arc_rise_slew(tarc).compute(target_load, source_slew);
54  break;
55  case edges::FALL:
56  delay = m_library.timing_arc_fall_delay(tarc).compute(target_load, source_slew);
57  slew = m_library.timing_arc_fall_slew(tarc).compute(target_load, source_slew);
58  break;
59  default:
60  break;
61  }
62  m_arcs.slew(*arc_it, slew);
63  m_arcs.delay(*arc_it, delay);
64  }
65  // CRITICAL >>>>
66  for (lemon::ListDigraph::Arc arc : m_to_process) {
67  tpoints.push(g.edge_target(arc));
68  }
69  // <<<<
70  m_to_process.clear();
71  }
72 };
73 
74 } /* namespace timing */
75 } /* namespace openeda */
76 
77 #endif /* SRC_TIMING_STA_TIMING_ARC_CALCULATOR_H_ */