...
 
Commits (19)
.gitignore
Dockerfile
README
INSTALL
*.o
*.a
*.lo
*.la
*.gcov
*.gcda
*.gcno
*.rej
*.orig
TAGS
*~
\#*#
.~lock.*#
.DS_Store
Makefile
/build
/debug
/rel
# /util/
/util/StaConfig.hh
# /app/
/app/StaApp_wrap.cc
/app/TclInitVar.cc
/app/sta
/app/sta.exe
/app/sta.dSYM
# /doc/
/doc/._Sta.docx
/doc/.~lock.Sta.doc#
/doc/.~lock.Sta.odt#
# /liberty/
/liberty/LibertyExprLex.cc
/liberty/LibertyExprLex.hh
/liberty/LibertyExprParse.cc
/liberty/LibertyExprParse.h
/liberty/LibertyLex.cc
/liberty/LibertyLex.hh
/liberty/LibertyParse.cc
/liberty/LibertyParse.h
/liberty/LibertyExprParse.hh
/liberty/LibertyParse.hh
# /parasitics/
/parasitics/SpefLex.cc
/parasitics/SpefLex.hh
/parasitics/SpefParse.cc
/parasitics/SpefParse.hh
/parasitics/SpfLex.cc
/parasitics/SpfLex.hh
/parasitics/SpfParse.cc
/parasitics/SpfParse.hh
# /sdf/
/sdf/SdfLex.cc
/sdf/SdfLex.hh
/sdf/SdfParse.cc
/sdf/SdfParse.hh
# /tcl/
/tcl/history.tcl
/tcl/init.tcl
# /test/
/test/gmon.out
/test/results
# ngspice turd
/test/b3v3_1check.log
/test_native
# /verilog/
/verilog/VerilogLex.hh
/verilog/VerilogLex.cc
/verilog/VerilogParse.cc
/verilog/VerilogParse.h
/verilog/VerilogParse.output
/verilog/VerilogParse.hh
This diff is collapsed.
FROM ubuntu:18.04
LABEL author="James Cherry"
LABEL maintainer="Abdelrahman Hosny <abdelrahman@brown.edu>"
# install basics
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y wget apt-utils git cmake gcc tcl-dev swig bison flex
# download CUDD
RUN wget https://www.davidkebo.com/source/cudd_versions/cudd-3.0.0.tar.gz && \
tar -xvf cudd-3.0.0.tar.gz && \
rm cudd-3.0.0.tar.gz
# install CUDD
RUN cd cudd-3.0.0 && \
mkdir ../cudd && \
./configure --prefix=$HOME/cudd && \
make && \
make install
# copy files and install OpenSTA
RUN mkdir OpenSTA
COPY . OpenSTA
RUN cd OpenSTA && \
mkdir build && \
cd build && \
cmake .. -DCUDD=$HOME/cudd && \
make
# Run sta on entry
ENTRYPOINT ["OpenSTA/app/sta"]
# Parallax Static Timing Analyzer
OpenSTA is a gate level static timing verifier. As a stand-alone
executable it can be used to verify the timing of a design using
standard file formats.
* Verilog netlist
* Liberty library
* SDC timing constraints
* SDF delay annotation
* SPEF parasitics
OpenSTA uses a TCL command interpreter to read the design, specify
timing constraints and print timing reports.
##### Clocks
* Generated
* Latency
* Source latency (insertion delay)
* Uncertainty
* Propagated/Ideal
* Gated clock checks
* Multiple frequency clocks
##### Exception paths
* False path
* Multicycle path
* Min/Max path delay
* Exception points
* -from clock/pin/instance -through pin/net -to clock/pin/instance
* Edge specific exception points
* -rise_from/-fall_from, -rise_through/-fall_through, -rise_to/-fall_to
##### Delay calculation
* Integrated Dartu/Menezes/Pileggi RC effective capacitance algorithm
* External delay calculator API
##### Analysis
* Report timing checks -from, -through, -to, multiple paths to endpoint
* Report delay calculation
* Check timing setup
##### Timing Engine
OpenSTA is architected to be easily bolted on to other tools as a
timing engine. By using a network adapter, OpenSTA can access the host
netlist data structures without duplicating them.
* Query based incremental update of delays, arrival and required times
* Simulator to propagate constants from constraints and netlist tie high/low
See doc/OpenSTA.pdf for complete documentiaton.
## Getting Started
OpenSTA can be run as a [Docker](https://www.docker.com/) container
or built as local executable with CMake.
### Run using Docker
* Install Docker on [Windows](https://docs.docker.com/docker-for-windows/), [Mac](https://docs.docker.com/docker-for-mac/) or [Linux](https://docs.docker.com/install/).
* Navigate to the directory where you have the input files.
* Run OpenSTA as a binary using
````
docker run -it -v $(pwd):/data openroad/opensta
````
4. From the interactive terminal, use OpenSTA commands. You can read input files from `/data` directory inside the docker container (e.g. `read_liberty /data/liberty.lib`). You can use OpenSTA in non-interactive mode by passing a command file using the `-f` flag as follows.
```
docker run -it -v $(pwd):/data openroad/opensta -f /data/cmd_file
```
Note that the path after `-f` is the path inside container, not on the guest machine.
### Prerequisites
The build dependency versions are show below. Other versions may
work, but these are the versions used for development.
```
from Ubuntu Xcode
18.04.1 10.1
cmake 3.9
clang 9.1.0 10.0.0
gcc 3.3.2 7.3.0
tcl 8.2 8.6 8.6.6
swig 1.3.28 3.0.12 3.0.12
bison 1.35 3.0.4 2.3
flex 2.5.4 2.6.4 2.5.35
```
These packages are **optional**:
```
libz 1.1.4 1.2.5 1.2.8
cudd 2.4.1 3.0.0
```
CUDD is a binary decision diageram (BDD) package that is used to improve conditional timing arc handling. OpenSTA does not require it to be installed. It is available [here](https://www.davidkebo.com/source/cudd_versions/cudd-3.0.0.tar.gz) or [here](https://sourceforge.net/projects/cudd-mirror/).
Note that the file hierarchy of the CUDD installation changed with version 3.0.
Some changes to CMakeLists.txt are required to support older versions.
When building CUDD you may use the `--prefix ` option to `configure` to
install in a location other than the default (`/usr/local/lib`).
```
cd $HOME/cudd-3.0.0
mkdir $HOME/cudd
./configure --prefix $HOME/cudd
make
make install
```
To not use CUDD specify `CUDD=0`.
Cmake looks for the CUDD library in `CUDD/lib, CUDD/cudd/lib`
and for the header in `CUDD/include, CUDD/cudd/include`.
```
# equivalent to -DCUDD=0
cmake ..
or
cmake .. -DCUDD=0
or
# look in ~/cudd/lib, ~/cudd/include
cmake .. -DCUDD=$HOME/cudd
or
# look in /usr/local/lib/cudd, /usr/local/include/cudd
cmake .. -DCUDD=/usr/local
```
The Zlib library is an optional. If CMake finds libz, OpenSTA can
read Verilog, SDF, SPF, and SPEF files compressed with gzip.
### Installing with CMake
Use the following commands to checkout the git repository and build the
OpenSTA library and excutable.
```
git clone https://xp-dev.com/git/opensta
cd opensta
mkdir build
cd build
cmake ..
make
```
The default build type is release to compile optimized code.
The resulting executable is in `app/sta`.
The library without a `main()` procedure is `app/libSTA.a`.
Optional CMake variables passed as -D<var>=<value> arguments to CMake are show below.
```
CMAKE_BUILD_TYPE DEBUG|RELEASE
CMAKE_CXX_FLAGS - additional compiler flags
TCL_LIB - path to tcl library
TCL_HEADER - path to tcl.h
CUDD - path to cudd installation
ZLIB_ROOT - path to zlib
CMAKE_INSTALL_PREFIX
```
If `TCL_LIB` is specified the CMake script will attempt to locate the
header from the library path.
The default install directory is `/usr/local`.
To install in a different directory with CMake use:
```
cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>
```
Alternatively, you can use the `DESTDIR` variable with make.
```
make DESTDIR=<prefix_path> install
```
If you make changes to `CMakeLists.txt` you may need to clean out
existing CMake cached variable values by deleting all of the
files in the build directory.
### Installing on Windoz
Use a .bat file to start a cygwin shell that has its path set to
support the Microcruft cl compiler by calling the vsvars32.bat script
from the Visual C++ installation.
```
tcsh-startup.bat
@echo off
call "c:\Microsoft Visual Studio 9.0\Common7\Tools\vsvars.bat"
set path=c:\cygwin\bin;%PATH%
c:\cygwin\bin\tcsh
```
CMake is supposedly more compatible with the windoz environment
so you may have better luck wih it.
Cmake and build from the shell. Note that tcl and zlib must be
built with the Visual C++ compiler to link to the sta libraries.
mkdir build
cd build
cmakd ..
make
...
Good luck and don't bother me with windoz specific issues.
I am happy to say I haven't owned a windoz machine in 20 years.
## Authors
* James Cherry
* William Scott authored the arnoldi delay calculator at Blaze, Inc which was subsequently licensed to Nefelus, Inc that has graciously contributed it to OpenSTA.
## License
OpenSTA, Static Timing Analyzer
Copyright (c) 2019, Parallax Software, Inc.
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/>.
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
#include <stdio.h>
#include "Machine.hh"
#include "StaConfig.hh" // STA_VERSION
#include "StringUtil.hh"
#include "Sta.hh"
#include "StaMain.hh"
using sta::stringEq;
using sta::Sta;
using sta::staMain;
using sta::showUseage;
// Swig uses C linkage for init functions.
extern "C" {
extern int Sta_Init(Tcl_Interp *interp);
}
int
main(int argc, char **argv)
{
if (argc == 2 && stringEq(argv[1], "-help")) {
showUseage(argv[0]);
return 0;
}
else if (argc == 2 && stringEq(argv[1], "-version")) {
printf("%s\n", STA_VERSION);
return 0;
}
else {
Sta *sta = new Sta;
staMain(sta, argc, argv, Sta_Init);
return 0;
}
}
# OpenSTA, Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
#
# 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/>.
bin_PROGRAMS = sta
include_HEADERS = \
StaMain.hh
sta_SOURCES = \
Main.cc \
StaMain.cc \
StaApp_wrap.cc \
TclInitVar.cc
NETWORK_LIBS = \
../verilog/libverilog.la
sta_DEPENDENCIES = $(NETWORK_LIBS) $(STA_LIBS) $(CUDD_LIBS)
sta_LDADD = $(NETWORK_LIBS) $(STA_LIBS) $(CUDD_LIBS)
StaApp_wrap.cc: $(SWIG_DEPEND) StaApp.i ../verilog/Verilog.i
$(SWIG) $(SWIG_FLAGS) -namespace -prefix sta \
-o StaApp_wrap.cc StaApp.i
../etc/SwigCleanup.tcl StaApp_wrap.cc
# TCL files included as part of the executable.
# These files are encoded and shipped as part of the executable
# so that they do not have to be installed on the client host.
TclInitVar.cc: ../etc/TclEncode.tcl $(TCL_INIT_FILES)
../etc/TclEncode.tcl TclInitVar.cc "tcl_inits" \
$(TCL_INIT_FILES) ../verilog/Verilog.tcl
EXTRA_DIST = \
StaApp.i
# TclInitVar.cc is derived and TCL version specific, so don't dist it.
dist-hook:
rm -rf $(distdir)/TclInitVar.cc
MAINTAINERCLEANFILES = \
StaApp_wrap.cc \
TclInitVar.cc
libs: $(sta_OBJECTS)
xtags: $(SOURCES) $(HEADERS)
etags -a -o ../TAGS $(SOURCES) $(HEADERS)
%module sta
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
%include "../tcl/StaException.i"
%include "../tcl/StaTcl.i"
%include "../verilog/Verilog.i"
%include "../tcl/NetworkEdit.i"
%include "../sdf/Sdf.i"
%include "../dcalc/DelayCalc.i"
%include "../parasitics/Parasitics.i"
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
#include <tcl.h>
#include <stdlib.h>
#include "Machine.hh"
#include "StringUtil.hh"
#include "Vector.hh"
#include "Sta.hh"
#include "StaMain.hh"
namespace sta {
typedef sta::Vector<SwigInitFunc> SwigInitFuncSeq;
// "Arguments" passed to staTclAppInit.
static int sta_argc;
static char **sta_argv;
static SwigInitFunc sta_swig_init;
static const char *init_filename = "[file join $env(HOME) .sta]";
extern const char *tcl_inits[];
static void
sourceTclFileEchoVerbose(const char *filename,
Tcl_Interp *interp);
void
staMain(Sta *sta,
int argc,
char **argv,
SwigInitFunc swig_init)
{
initSta();
Sta::setSta(sta);
sta->makeComponents();
int thread_count = 1;
bool threads_exists = false;
parseThreadsArg(argc, argv, thread_count, threads_exists);
if (threads_exists)
sta->setThreadCount(thread_count);
staSetupAppInit(argc, argv, swig_init);
// Set argc to 1 so Tcl_Main doesn't source any files.
// Tcl_Main never returns.
Tcl_Main(1, argv, staTclAppInit);
}
void
parseThreadsArg(int argc,
char **argv,
int &thread_count,
bool &exists)
{
char *thread_arg = findCmdLineKey(argc, argv, "-threads");
if (thread_arg) {
if (stringEqual(thread_arg, "max")) {
thread_count = processorCount();
exists = true;
}
else if (isDigits(thread_arg)) {
thread_count = atoi(thread_arg);
exists = true;
}
else
fprintf(stderr,"Warning: -threads must be max or a positive integer.\n");
}
}
// Set globals to pass to staTclAppInit.
void
staSetupAppInit(int argc,
char **argv,
SwigInitFunc swig_init)
{
sta_argc = argc;
sta_argv = argv;
sta_swig_init = swig_init;
}
// Tcl init executed inside Tcl_Main.
int
staTclAppInit(Tcl_Interp *interp)
{
int argc = sta_argc;
char **argv = sta_argv;
// source init.tcl
Tcl_Init(interp);
// Define swig commands.
sta_swig_init(interp);
Sta *sta = Sta::sta();
sta->setTclInterp(interp);
// Eval encoded sta TCL sources.
evalTclInit(interp, tcl_inits);
if (!findCmdLineFlag(argc, argv, "-no_splash"))
Tcl_Eval(interp, "sta::show_splash");
// Import exported commands from sta namespace to global namespace.
Tcl_Eval(interp, "sta::define_sta_cmds");
const char *export_cmds = "namespace import sta::*";
Tcl_Eval(interp, export_cmds);
if (!findCmdLineFlag(argc, argv, "-no_init"))
sourceTclFileEchoVerbose(init_filename, interp);
// "-x cmd" is evaled before -f file is sourced.
char *cmd = findCmdLineKey(argc, argv, "-x");
if (cmd)
Tcl_Eval(interp, cmd);
// "-f cmd_file" is evaled as "source -echo -verbose file".
char *file = findCmdLineKey(argc, argv, "-f");
if (file)
sourceTclFileEchoVerbose(file, interp);
return TCL_OK;
}
bool
findCmdLineFlag(int argc,
char **argv,
const char *flag)
{
for (int argi = 1; argi < argc; argi++) {
char *arg = argv[argi];
if (stringEq(arg, flag))
return true;
}
return false;
}
char *
findCmdLineKey(int argc,
char **argv,
const char *key)
{
for (int argi = 1; argi < argc; argi++) {
char *arg = argv[argi];
if (stringEq(arg, key) && argi + 1 < argc)
return argv[argi + 1];
}
return 0;
}
// Use overridden version of source to echo cmds and results.
static void
sourceTclFileEchoVerbose(const char *filename,
Tcl_Interp *interp)
{
string cmd;
stringPrint(cmd, "source -echo -verbose %s", filename);
Tcl_Eval(interp, cmd.c_str());
}
void
evalTclInit(Tcl_Interp *interp,
const char *inits[])
{
size_t length = 0;
for (const char **e = inits; *e; e++) {
const char *init = *e;
length += strlen(init);
}
char *unencoded = new char[length / 3 + 1];
char *u = unencoded;
for (const char **e = inits; *e; e++) {
const char *init = *e;
size_t init_length = strlen(init);
for (const char *s = init; s < &init[init_length]; s += 3) {
char code[4] = {s[0], s[1], s[2], '\0'};
char ch = atoi(code);
*u++ = ch;
}
}
*u = '\0';
if (Tcl_Eval(interp, unencoded) != TCL_OK) {
// Get a backtrace for the error.
Tcl_Eval(interp, "$errorInfo");
const char *tcl_err = Tcl_GetStringResult(interp);
fprintf(stderr, "Error: TCL init script: %s.\n", tcl_err);
fprintf(stderr, " Try deleting app/TclInitVar.cc and rebuilding.\n");
exit(0);
}
delete [] unencoded;
}
void
showUseage(char *prog)
{
printf("Usage: %s [-help] [-version] [-no_init] [-f cmd_file]\n", prog);
printf(" -help show help and exit\n");
printf(" -version show version and exit\n");
printf(" -no_init do not read .sta init file\n");
printf(" -x cmd evaluate cmd\n");
printf(" -f cmd_file source cmd_file\n");
printf(" -threads count|max use count threads\n");
}
} // namespace
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
#ifndef STA_APP_H
#define STA_APP_H
struct Tcl_Interp;
namespace sta {
typedef int (*SwigInitFunc)(Tcl_Interp *);
// The swig_init function is called to define the swig interface
// functions to the tcl interpreter.
void
staMain(Sta *sta,
int argc,
char **argv,
SwigInitFunc swig_init);
// Set arguments passed to staTclAppInit inside the tcl interpreter.
void
staSetupAppInit(int argc,
char **argv,
SwigInitFunc swig_init);
// The variable tcl_init is an implicit argument to this function that
// provides the definitions for builtin tcl commands encoded by
// etc/TclEncode.tcl.
int
staTclAppInit(Tcl_Interp *interp);
// TCL init files are encoded into the string init using the three
// digit decimal equivalent for each ascii character. This function
// unencodes the string and evals it. This packages the TCL init
// files as part of the executable so they don't have to be shipped as
// separate files that have to be located and loaded at run time.
void
evalTclInit(Tcl_Interp *interp,
const char *inits[]);
bool
findCmdLineFlag(int argc,
char **argv,
const char *flag);
char *
findCmdLineKey(int argc,
char **argv,
const char *key);
void
showUseage(char *prog);
void
parseThreadsArg(int argc,
char **argv,
int &threads,
bool &exists);
void
parseCmdsArg(int argc,
char **argv,
bool &native_cmds,
bool &compatibility_cmds);
} // namespace
#endif
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
#include "Machine.hh"
#include "TimingModel.hh"
#include "TimingArc.hh"
#include "GraphDelayCalc.hh"
#include "ArcDelayCalc.hh"
namespace sta {
ArcDelayCalc::ArcDelayCalc(StaState *sta):
StaState(sta)
{
}
TimingModel *
ArcDelayCalc::model(TimingArc *arc,
const DcalcAnalysisPt *dcalc_ap) const
{
const OperatingConditions *op_cond = dcalc_ap->operatingConditions();
TimingArc *corner_arc = arc->cornerArc(dcalc_ap->libertyIndex());
return corner_arc->model(op_cond);
}
GateTimingModel *
ArcDelayCalc::gateModel(TimingArc *arc,
const DcalcAnalysisPt *dcalc_ap) const
{
return dynamic_cast<GateTimingModel*>(model(arc, dcalc_ap));
}
CheckTimingModel *
ArcDelayCalc::checkModel(TimingArc *arc,
const DcalcAnalysisPt *dcalc_ap) const
{
return dynamic_cast<CheckTimingModel*>(model(arc, dcalc_ap));
}
} // namespace
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
#ifndef STA_ARC_DELAY_CALC_H
#define STA_ARC_DELAY_CALC_H
#include <string>
#include "DisallowCopyAssign.hh"
#include "MinMax.hh"
#include "Delay.hh"
#include "StaState.hh"
#include "LibertyClass.hh"
#include "NetworkClass.hh"
namespace sta {
using std::string;
class Parasitic;
class DcalcAnalysisPt;
// Delay calculator class hierarchy.
// ArcDelayCalc
// UnitDelayCalc
// LumpedCapDelayCalc
// RCDelayCalc
// SimpleRCDelayCalc
// DmpCeffDelayCalc
// DmpCeffElmoreDelayCalc
// DmpCeffTwoPoleDelayCalc
// Abstract class to interface to a delay calculator primitive.
class ArcDelayCalc : public StaState
{
public:
explicit ArcDelayCalc(StaState *sta);
virtual ~ArcDelayCalc() {}
virtual ArcDelayCalc *copy() = 0;
// Find the parasitic for drvr_pin that is acceptable to the delay
// calculator by probing parasitics_.
virtual void findParasitic(const Pin *drvr_pin,
const TransRiseFall *tr,
const DcalcAnalysisPt *dcalc_ap,
// Return values.
Parasitic *&parasitic,
bool &delete_at_finish) = 0;
// Call after the parasitic returned by findParasitic is no longer
// needed. This gives the arc delay calculator a chance to delete
// temporary estimated or reduced parasitics. The default action is
// to do nothing.
virtual void finish(const Pin *drvr_pin,
const TransRiseFall *tr,
const DcalcAnalysisPt *dcalc_ap,
Parasitic *parasitic,
bool delete_at_finish) = 0;
// Find the wire delays and slews for an input port without a driving cell.
// This call primarily initializes the load delay/slew iterator.
virtual void inputPortDelay(const Pin *port_pin,
float in_slew,
const TransRiseFall *tr,
Parasitic *parasitic,
const DcalcAnalysisPt *dcalc_ap) = 0;
// Find the delay and slew for arc driving drvr_pin.
virtual void gateDelay(const LibertyCell *drvr_cell,
TimingArc *arc,
const Slew &in_slew,
// Pass in load_cap or drvr_parasitic.
float load_cap,
Parasitic *drvr_parasitic,
float related_out_cap,
const Pvt *pvt,
const DcalcAnalysisPt *dcalc_ap,
// Return values.
ArcDelay &gate_delay,
Slew &drvr_slew) = 0;
// Find the wire delay and load slew of a load pin.
// Called after inputPortDelay or gateDelay.
virtual void loadDelay(const Pin *load_pin,
// Return values.
ArcDelay &wire_delay,
Slew &load_slew) = 0;
virtual void setMultiDrvrSlewFactor(float factor) = 0;
// Ceff for parasitics with pi models.
virtual float ceff(const LibertyCell *drvr_cell,
TimingArc *arc,
const Slew &in_slew,
float load_cap,
Parasitic *drvr_parasitic,
float related_out_cap,
const Pvt *pvt,
const DcalcAnalysisPt *dcalc_ap) = 0;
// Find the delay for a timing check arc given the arc's
// from/clock, to/data slews and related output pin parasitic.
virtual void checkDelay(const LibertyCell *drvr_cell,
TimingArc *arc,
const Slew &from_slew,
const Slew &to_slew,
float related_out_cap,
const Pvt *pvt,
const DcalcAnalysisPt *dcalc_ap,
// Return values.
ArcDelay &margin) = 0;
// Report delay and slew calculation.
virtual void reportGateDelay(const LibertyCell *drvr_cell,
TimingArc *arc,
const Slew &in_slew,
// Pass in load_cap or drvr_parasitic.
float load_cap,
Parasitic *drvr_parasitic,
float related_out_cap,
const Pvt *pvt,
const DcalcAnalysisPt *dcalc_ap,
int digits,
string *result) = 0;
// Report timing check delay calculation.
virtual void reportCheckDelay(const LibertyCell *cell,
TimingArc *arc,
const Slew &from_slew,
const char *from_slew_annotation,
const Slew &to_slew,
float related_out_cap,
const Pvt *pvt,
const DcalcAnalysisPt *dcalc_ap,
int digits,
string *result) = 0;
protected:
GateTimingModel *gateModel(TimingArc *arc,
const DcalcAnalysisPt *dcalc_ap) const;
CheckTimingModel *checkModel(TimingArc *arc,
const DcalcAnalysisPt *dcalc_ap) const;
TimingModel *model(TimingArc *arc,
const DcalcAnalysisPt *dcalc_ap) const;
private:
DISALLOW_COPY_AND_ASSIGN(ArcDelayCalc);
};
} // namespace
#endif
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
// (c) 2018 Nefelus, Inc.
//
// Author: W. Scott
#ifndef ARNOLDI_H
#define ARNOLDI_H
#include "ConcreteParasiticsPvt.hh"
namespace sta {
struct delay_work;
class rcmodel;
class GateTableModel;
class Pin;
//
// single-driver arnoldi model
//
class arnoldi1
{
public:
arnoldi1() { order=0; n=0; d=nullptr; e=nullptr; U=nullptr; ctot=0.0; sqc=0.0; }
~arnoldi1();
double elmore(int term_index);
//
// calculate poles/residues for given rdrive
//
void calculate_poles_res(delay_work *D,double rdrive);
public:
int order;
int n; // number of terms, including driver
double *d; // [order]
double *e; // [order-1]
double **U; // [order][n]
double ctot;
double sqc;
};
// This is the rcmodel, without Rd.
// n is the number of terms
// The vectors U[j] are of size n
class rcmodel : public ConcreteParasitic,
public arnoldi1
{
public:
rcmodel();
virtual ~rcmodel();
virtual float capacitance() const;
const Pin **pinV; // [n]
};
struct timing_table
{
GateTableModel *table;
const LibertyCell *cell;
const Pvt *pvt;
float in_slew;
float relcap;
};
} // namespace
#endif
The method is used for simulation with a time-and-voltage-dependent
current source. But it is simpler to describe with a linear driver.
Suppose we are given:
voltage nodes 1,..n initialized to V[j]=1.0
a resistor network described by a conductance matrix G[j,k]
a drive resistance from node 1 to ground, Rdrv
capacitance of the nodes, c[j], also written as a
diagonal matrix C[j,k]
The node voltages will fall to zero with time.
Matrix equation:
GV+CdV/dt = -(V[0]/Rdrv)e0
where e0 is the unit vector (1,0,0,..0).
Let G' be the matrix formed by taking G and adding 1/Rdrv in the
[0,0] position. Then we are solving G'V + CdV/dt = 0.
Let R be the inverse of G'. (In implementation, R may not actually
be formed as a matrix, instead some method of producing RV given V).
The exact solution would diagonalize sqrt(C) R sqrt(C).
The Arnoldi method takes a matrix M and a vector of interest V, and
considers the subspace of vectors near V in terms of the action of M,
that is, the space spanned by V, MV, MMV, etc, for a small number of
powers. We do this here, but instead of finding the part of MV orthogonal
to V, we find the part of RCV that is C-orthogonal of V. We use C
as the metric, so the basis vectors U0, U1, U2 that we generate satisfy
Ui.CUj = (i==j?1:0)
U0 = (1,1,..1)/sqrt(sum C)
representing the initial value of V, V[j] = sqrt(n)U0[j] at t=0.
sum(C) = C[0]+..C[n-1], so U0.C U0 = 1.
Let:
W = R C U0
d0 = U0.C W
W' = W - d0 U0
e0 = sqrt(W'.C W')
U1 = W'/e0
Then: U0.C U0 = U1.C U1 = 1, U0.C U1 = 0, and
R C U0 = d0 U0 + e0 U1
Next step:
W = R C U1
d1 = U1.C W
W' = W - d1 U1 - e0 U0
e1 = sqrt(W'.C W')
U2 = W'/e1
and we have U2.C U2 = 1, U2.C U1 = U2.C U0 = 0, and
RC U1 = e0 U0 + d1 U1 + e1 U2
In this way, RC, which in nonsymmetric in the original basis,
becomes a symmetric tridiagonal matrix in the U0,U1,.. basis.
We stop at, say, U3. The resulting 4x4 tridiagonal matrix is
positive definite, because it is the projection of sqrt(C)R sqrt(C)
to a subspace. So the eigenvalues of this small tridiagonal matrix
are guaranteed to be positive. This is the advantage over AWE.
In the actual implementation, I remember there was some way of
isolating the node 0 where drive resistance is attached, so that the
tridiagonal matrix (d,e) can be recalculated without knowing Rdrv,
and then just the first d0,e0 updated when the Rdrv is known, or
when Rdrv changes in a simulation.
This diff is collapsed.
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
#ifndef ARNOLDIDELAYCALC_H
#define ARNOLDIDELAYCALC_H
namespace sta {
ArcDelayCalc *
makeArnoldiDelayCalc(StaState *sta);
} // namespace
#endif
This diff is collapsed.
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
//
// 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/>.
// (c) 2018 Nefelus, Inc.
//
// Author: W. Scott
#ifndef STA_ARNOLDI_REDUCE_H
#define STA_ARNOLDI_REDUCE_H
#include "Map.hh"
#include "NetworkClass.hh"
#include "ParasiticsClass.hh"
namespace sta {
class ConcreteParasiticNetwork;
class ConcreteParasiticNode;
class rcmodel;
struct ts_edge;
struct ts_point;
typedef Map<ConcreteParasiticNode*, int> ArnolidPtMap;
class ArnoldiReduce : public StaState
{
public:
ArnoldiReduce(StaState *sta);
~ArnoldiReduce();
Parasitic *reduceToArnoldi(Parasitic *parasitic,
const Pin *drvr_pin,
float coupling_cap_factor,
const TransRiseFall *tr,
const OperatingConditions *op_cond,
const Corner *corner,
const MinMax *cnst_min_max,
const ParasiticAnalysisPt *ap);
protected:
void loadWork();
rcmodel *makeRcmodelDrv();
void allocPoints();
void allocTerms(int nterms);
ts_point *findPt(ParasiticNode *node);
void makeRcmodelDfs(ts_point *pdrv);
void getRC();
float pinCapacitance(ParasiticNode *node);
void setTerms(ts_point *pdrv);
void makeRcmodelFromTs();
rcmodel *makeRcmodelFromW();
ConcreteParasiticNetwork *parasitic_network_;
const Pin *drvr_pin_;
float coupling_cap_factor_;
const TransRiseFall *tr_;
const OperatingConditions *op_cond_;
const Corner *corner_;
const MinMax *cnst_min_max_;
const ParasiticAnalysisPt *ap_;
// ParasiticNode -> ts_point index.
ArnolidPtMap pt_map_;
// rcWork
ts_point *ts_pointV;
int ts_pointN;
int ts_pointNmax;
static const int ts_point_count_incr_;
ts_edge *ts_edgeV;
int ts_edgeN;
int ts_edgeNmax;
static const int ts_edge_count_incr_;
ts_edge **ts_eV;
ts_edge **ts_stackV;
int *ts_ordV;
ts_point **ts_pordV;
int ts_ordN;
int termNmax;
int termN;
ts_point *pterm0;
const Pin **pinV; // fixed order, offset from pterm0
int *termV; // from drv-ordered to fixed order
int *outV; // from drv-ordered to ts_pordV
int dNmax;
double *d;
double *e;
double *U0;
double **U;
double ctot_;
double sqc_;
double *_u0, *_u1;
double *y, *iv;
double *c, *r;
int *par;
int order;
};
} // namespace
#endif