2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2025-01-22 02:54:33 +01:00
|
|
|
// Copyright (c) 2025, Parallax Software, Inc.
|
2018-09-28 17:54:21 +02: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
|
2022-01-04 18:17:08 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-09-28 17:54:21 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2022-01-04 18:17:08 +01:00
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2025-01-22 02:54:33 +01:00
|
|
|
//
|
|
|
|
|
// The origin of this software must not be misrepresented; you must not
|
|
|
|
|
// claim that you wrote the original software.
|
|
|
|
|
//
|
|
|
|
|
// Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
// misrepresented as being the original software.
|
|
|
|
|
//
|
|
|
|
|
// This notice may not be removed or altered from any source distribution.
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2020-02-16 01:13:16 +01:00
|
|
|
#pragma once
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2024-02-08 21:54:52 +01:00
|
|
|
#include <map>
|
|
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "Zlib.hh"
|
|
|
|
|
#include "StringSeq.hh"
|
|
|
|
|
#include "NetworkClass.hh"
|
|
|
|
|
#include "ParasiticsClass.hh"
|
2024-02-08 21:54:52 +01:00
|
|
|
#include "StaState.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
2019-01-17 00:37:31 +01:00
|
|
|
class Report;
|
2024-02-08 21:54:52 +01:00
|
|
|
class MinMaxAll;
|
2018-09-28 17:54:21 +02:00
|
|
|
class SpefRspfPi;
|
|
|
|
|
class SpefTriple;
|
|
|
|
|
class Corner;
|
2025-02-01 23:49:30 +01:00
|
|
|
class SpefScanner;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2025-04-12 01:59:48 +02:00
|
|
|
typedef std::map<int, std::string> SpefNameMap;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2024-02-08 21:54:52 +01:00
|
|
|
class SpefReader : public StaState
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SpefReader(const char *filename,
|
|
|
|
|
Instance *instance,
|
|
|
|
|
ParasiticAnalysisPt *ap,
|
2018-11-26 18:15:52 +01:00
|
|
|
bool pin_cap_included,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool keep_coupling_caps,
|
|
|
|
|
float coupling_cap_factor,
|
2024-02-08 21:54:52 +01:00
|
|
|
bool reduce,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMaxAll *min_max,
|
|
|
|
|
StaState *sta);
|
2018-09-28 17:54:21 +02:00
|
|
|
virtual ~SpefReader();
|
2025-02-01 23:49:30 +01:00
|
|
|
bool read();
|
2019-01-17 00:37:31 +01:00
|
|
|
char divider() const { return divider_; }
|
|
|
|
|
void setDivider(char divider);
|
|
|
|
|
char delimiter() const { return delimiter_; }
|
|
|
|
|
void setDelimiter(char delimiter);
|
|
|
|
|
const char *filename() const { return filename_; }
|
|
|
|
|
// Translate from spf/spef namespace to sta namespace.
|
|
|
|
|
char *translated(const char *token);
|
2020-12-14 02:21:35 +01:00
|
|
|
void warn(int id,
|
|
|
|
|
const char *fmt,
|
|
|
|
|
...)
|
|
|
|
|
__attribute__((format (printf, 3, 4)));
|
2018-09-28 17:54:21 +02:00
|
|
|
void setBusBrackets(char left,
|
|
|
|
|
char right);
|
|
|
|
|
void setTimeScale(float scale,
|
|
|
|
|
const char *units);
|
|
|
|
|
void setCapScale(float scale,
|
|
|
|
|
const char *units);
|
|
|
|
|
void setResScale(float scale,
|
|
|
|
|
const char *units);
|
|
|
|
|
void setInductScale(float scale,
|
|
|
|
|
const char *units);
|
2025-02-11 01:32:50 +01:00
|
|
|
void makeNameMapEntry(const char *index,
|
|
|
|
|
const char *name);
|
|
|
|
|
const char *nameMapLookup(const char *index);
|
2018-09-28 17:54:21 +02:00
|
|
|
void setDesignFlow(StringSeq *flow_keys);
|
|
|
|
|
Pin *findPin(char *name);
|
2025-02-11 01:32:50 +01:00
|
|
|
Net *findNet(const char *name);
|
2018-09-28 17:54:21 +02:00
|
|
|
void rspfBegin(Net *net,
|
|
|
|
|
SpefTriple *total_cap);
|
|
|
|
|
void rspfFinish();
|
|
|
|
|
void rspfDrvrBegin(Pin *drvr_pin,
|
|
|
|
|
SpefRspfPi *pi);
|
|
|
|
|
void rspfLoad(Pin *load_pin,
|
|
|
|
|
SpefTriple *rc);
|
|
|
|
|
void rspfDrvrFinish();
|
|
|
|
|
void dspfBegin(Net *net,
|
|
|
|
|
SpefTriple *total_cap);
|
|
|
|
|
void dspfFinish();
|
|
|
|
|
void makeCapacitor(int id,
|
|
|
|
|
char *node_name,
|
|
|
|
|
SpefTriple *cap);
|
|
|
|
|
void makeCapacitor(int id,
|
|
|
|
|
char *node_name1,
|
|
|
|
|
char *node_name2,
|
|
|
|
|
SpefTriple *cap);
|
|
|
|
|
void makeResistor(int id,
|
|
|
|
|
char *node_name1,
|
|
|
|
|
char *node_name2,
|
|
|
|
|
SpefTriple *res);
|
|
|
|
|
PortDirection *portDirection(char *spef_dir);
|
|
|
|
|
|
|
|
|
|
private:
|
2019-01-17 00:37:31 +01:00
|
|
|
Pin *findPinRelative(const char *name);
|
|
|
|
|
Pin *findPortPinRelative(const char *name);
|
|
|
|
|
Net *findNetRelative(const char *name);
|
|
|
|
|
Instance *findInstanceRelative(const char *name);
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticNode *findParasiticNode(char *name,
|
|
|
|
|
bool local_only);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2019-01-17 00:37:31 +01:00
|
|
|
const char *filename_;
|
2025-02-01 23:49:30 +01:00
|
|
|
SpefScanner *scanner_;
|
2019-01-17 00:37:31 +01:00
|
|
|
Instance *instance_;
|
|
|
|
|
const ParasiticAnalysisPt *ap_;
|
|
|
|
|
bool pin_cap_included_;
|
|
|
|
|
bool keep_coupling_caps_;
|
2024-02-08 21:54:52 +01:00
|
|
|
bool reduce_;
|
2019-01-17 00:37:31 +01:00
|
|
|
const Corner *corner_;
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMaxAll *min_max_;
|
2019-01-17 00:37:31 +01:00
|
|
|
// Normally no need to keep device names.
|
|
|
|
|
char divider_;
|
|
|
|
|
char delimiter_;
|
|
|
|
|
char bus_brkt_left_;
|
|
|
|
|
char bus_brkt_right_;
|
|
|
|
|
Net *net_;
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
int triple_index_;
|
|
|
|
|
float time_scale_;
|
|
|
|
|
float cap_scale_;
|
|
|
|
|
float res_scale_;
|
|
|
|
|
float induct_scale_;
|
|
|
|
|
SpefNameMap name_map_;
|
|
|
|
|
StringSeq *design_flow_;
|
|
|
|
|
Parasitic *parasitic_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SpefTriple
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SpefTriple(float value);
|
|
|
|
|
SpefTriple(float value1,
|
|
|
|
|
float value2,
|
|
|
|
|
float value3);
|
|
|
|
|
float value(int index) const;
|
|
|
|
|
bool isTriple() const { return is_triple_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
float values_[3];
|
|
|
|
|
bool is_triple_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SpefRspfPi
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SpefRspfPi(SpefTriple *c2, SpefTriple *r1, SpefTriple *c1);
|
|
|
|
|
~SpefRspfPi();
|
|
|
|
|
SpefTriple *c2() { return c2_; }
|
|
|
|
|
SpefTriple *r1() { return r1_; }
|
|
|
|
|
SpefTriple *c1() { return c1_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
SpefTriple *c2_;
|
|
|
|
|
SpefTriple *r1_;
|
|
|
|
|
SpefTriple *c1_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern SpefReader *spef_reader;
|
|
|
|
|
|
|
|
|
|
} // namespace
|