OpenSTA/include/sta/Property.hh

194 lines
4.9 KiB
C++
Raw Normal View History

2018-12-26 20:03:31 +01:00
// OpenSTA, Static Timing Analyzer
2020-03-07 03:50:37 +01:00
// Copyright (c) 2020, Parallax Software, Inc.
2018-12-26 20:03:31 +01:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2020-02-16 01:13:16 +01:00
#pragma once
2018-12-26 20:03:31 +01:00
2019-01-17 00:37:31 +01:00
#include <string>
2020-04-05 20:35:51 +02:00
2020-04-05 23:53:44 +02:00
#include "LibertyClass.hh"
#include "NetworkClass.hh"
#include "SearchClass.hh"
#include "SdcClass.hh"
#include "Power.hh"
2018-12-26 20:03:31 +01:00
namespace sta {
2019-01-17 00:37:31 +01:00
using std::string;
2018-12-26 20:03:31 +01:00
class Sta;
// Adding a new property type
// value union
// enum Type
// constructor
// copy constructor switch clause
// move constructor switch clause
// operator= & switch clause
// operator= && switch clause
// StaTcl.i swig %typemap(out) PropertyValue switch clause
2018-12-26 20:03:31 +01:00
class PropertyValue
{
public:
2019-05-26 05:02:33 +02:00
enum Type { type_none, type_string, type_float, type_bool,
type_library, type_cell, type_port,
type_liberty_library, type_liberty_cell, type_liberty_port,
2018-12-26 20:03:31 +01:00
type_instance, type_pin, type_pins, type_net,
2019-04-29 17:39:05 +02:00
type_clk, type_clks, type_path_refs, type_pwr_activity };
2018-12-26 20:03:31 +01:00
PropertyValue();
PropertyValue(const char *value);
2019-01-17 00:37:31 +01:00
PropertyValue(string &value);
2018-12-26 20:03:31 +01:00
PropertyValue(float value);
2019-05-26 05:02:33 +02:00
PropertyValue(bool value);
PropertyValue(Library *value);
PropertyValue(Cell *value);
PropertyValue(Port *value);
2019-01-17 00:37:31 +01:00
PropertyValue(LibertyLibrary *value);
PropertyValue(LibertyCell *value);
PropertyValue(LibertyPort *value);
2018-12-26 20:03:31 +01:00
PropertyValue(Instance *value);
PropertyValue(Pin *value);
PropertyValue(PinSeq *value);
PropertyValue(PinSet *value);
PropertyValue(Net *value);
PropertyValue(Clock *value);
PropertyValue(ClockSeq *value);
PropertyValue(ClockSet *value);
PropertyValue(PathRefSeq *value);
2019-04-29 17:39:05 +02:00
PropertyValue(PwrActivity *value);
2018-12-26 20:03:31 +01:00
// Copy constructor.
PropertyValue(const PropertyValue &props);
2019-03-13 01:25:53 +01:00
// Move constructor.
PropertyValue(PropertyValue &&props);
2018-12-26 20:03:31 +01:00
~PropertyValue();
Type type() const { return type_; }
2019-01-17 00:37:31 +01:00
const char *stringValue() const { return string_; }
2018-12-26 20:03:31 +01:00
float floatValue() const { return float_; }
2019-05-26 05:02:33 +02:00
bool boolValue() const { return bool_; }
2019-01-17 00:37:31 +01:00
LibertyLibrary *libertyLibrary() const { return liberty_library_; }
LibertyCell *libertyCell() const { return liberty_cell_; }
LibertyPort *libertyPort() const { return liberty_port_; }
2019-02-17 00:31:39 +01:00
Library *library() const { return library_; }
2019-01-17 00:37:31 +01:00
Cell *cell() const { return cell_; }
Port *port() const { return port_; }
2018-12-26 20:03:31 +01:00
Instance *instance() const { return inst_; }
Pin *pin() const { return pin_; }
PinSeq *pins() const { return pins_; }
Net *net() const { return net_; }
Clock *clock() const { return clk_; }
ClockSeq *clocks() const { return clks_; }
PathRefSeq *pathRefs() const { return path_refs_; }
2019-04-29 17:39:05 +02:00
PwrActivity pwrActivity() const { return pwr_activity_; }
2019-03-13 01:25:53 +01:00
// Copy assignment.
PropertyValue &operator=(const PropertyValue &);
// Move assignment.
PropertyValue &operator=(PropertyValue &&);
2018-12-26 20:03:31 +01:00
private:
Type type_;
2019-03-13 01:25:53 +01:00
union {
const char *string_;
float float_;
2019-05-26 05:02:33 +02:00
bool bool_;
2019-03-13 01:25:53 +01:00
Library *library_;
Cell *cell_;
Port *port_;
LibertyLibrary *liberty_library_;
LibertyCell *liberty_cell_;
LibertyPort *liberty_port_;
2019-03-13 01:25:53 +01:00
Instance *inst_;
Pin *pin_;
PinSeq *pins_;
Net *net_;
Clock *clk_;
ClockSeq *clks_;
PathRefSeq *path_refs_;
2019-04-29 17:39:05 +02:00
PwrActivity pwr_activity_;
2019-03-13 01:25:53 +01:00
};
2018-12-26 20:03:31 +01:00
};
PropertyValue
getProperty(const Instance *inst,
const char *property,
Sta *sta);
PropertyValue
getProperty(const Pin *pin,
const char *property,
Sta *sta);
PropertyValue
getProperty(const Net *net,
const char *property,
Sta *sta);
PropertyValue
getProperty(const Port *port,
const char *property,
Sta *sta);
2019-01-17 00:37:31 +01:00
PropertyValue
getProperty(const Cell *cell,
const char *property,
Sta *sta);
2018-12-26 20:03:31 +01:00
PropertyValue
getProperty(const LibertyCell *cell,
const char *property,
Sta *sta);
PropertyValue
getProperty(const LibertyPort *port,
const char *property,
Sta *);
PropertyValue
getProperty(const LibertyLibrary *lib,
const char *property,
Sta *sta);
PropertyValue
getProperty(const Library *lib,
const char *property,
Sta *sta);
PropertyValue
getProperty(Edge *edge,
const char *property,
Sta *sta);
PropertyValue
getProperty(Clock *clk,
const char *property,
Sta *sta);
PropertyValue
getProperty(PathEnd *end,
const char *property,
Sta *sta);
PropertyValue
getProperty(PathRef *end,
const char *property,
Sta *sta);
2019-01-17 00:37:31 +01:00
PropertyValue
getProperty(TimingArcSet *arc_set,
const char *property,
Sta *sta);
2018-12-26 20:03:31 +01:00
} // namespace