1 // OpenSTA, Static Timing Analyzer
2 // Copyright (c) 2020, Parallax Software, Inc.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 
17 #pragma once
18 
19 #include "DisallowCopyAssign.hh"
20 #include "LibertyClass.hh"
21 #include "NetworkClass.hh"
22 
23 namespace sta {
24 
25 // Register/Latch
26 class Sequential
27 {
28 public:
29   ~Sequential();
isLatch() const30   bool isLatch() const { return !is_register_; }
isRegister() const31   bool isRegister() const { return is_register_; }
clock() const32   FuncExpr *clock() const { return clock_; }
data() const33   FuncExpr *data() const { return data_; }
clear() const34   FuncExpr *clear() const { return clear_; }
preset() const35   FuncExpr *preset() const { return preset_; }
36   // State of output when clear and preset are both true.
clearPresetOutput() const37   LogicValue clearPresetOutput() const { return clr_preset_out_; }
38   // State of outputInv when clear and preset are both true.
clearPresetOutputInv() const39   LogicValue clearPresetOutputInv() const {return clr_preset_out_inv_;}
output() const40   LibertyPort *output() const { return output_; }
outputInv() const41   LibertyPort *outputInv() const { return output_inv_; }
42 
43 protected:
44   // clock/data are:
45   //   clocked_on/next_state for registers
46   //   enable/data for latches
47   Sequential(bool is_register,
48 	     FuncExpr *clock,
49 	     FuncExpr *data,
50 	     FuncExpr *clear,
51 	     FuncExpr *preset,
52 	     LogicValue clr_preset_out,
53 	     LogicValue clr_preset_out_inv,
54 	     LibertyPort *output,
55 	     LibertyPort *output_inv);
56 
57   bool is_register_;
58   FuncExpr *clock_;
59   FuncExpr *data_;
60   FuncExpr *clear_;
61   FuncExpr *preset_;
62   LogicValue clr_preset_out_;
63   LogicValue clr_preset_out_inv_;
64   LibertyPort *output_;
65   LibertyPort *output_inv_;
66 
67 private:
68   DISALLOW_COPY_AND_ASSIGN(Sequential);
69 
70   friend class LibertyCell;
71 };
72 
73 } // namespace
74