Commit e4d0d0d6 authored by Ruben Undheim's avatar Ruben Undheim

New upstream version 0~20190328gita55cbb7

parents
.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.