...
 
Commits (19)

Too many changes to show.

To preserve performance only 191 of 191+ files are displayed.

.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
# Parallax Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
# All rights reserved.
#
# No part of this document may be copied, transmitted or
# disclosed in any form or fashion without the express
# written consent of Parallax Software, Inc.
cmake_minimum_required (VERSION 3.9)
project(STA VERSION 2.0.11)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(STA_HOME ${PROJECT_SOURCE_DIR})
message(STATUS "STA version: ${PROJECT_VERSION}")
# Default to bulding optimnized/release executable.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELEASE)
endif()
message(STATUS "Host system: ${CMAKE_HOST_SYSTEM}")
message(STATUS "Compiler version: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Compiler path: ${CMAKE_CXX_COMPILER}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
message(STATUS "CXX flags DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CXX flags RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CXX flags RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
################################################################
#
# Source files.
#
################################################################
set(STA_SOURCE
app/StaMain.cc
app/StaApp_wrap.cc
app/TclInitVar.cc
app/StaApp_wrap.cc
dcalc/ArcDelayCalc.cc
dcalc/ArnoldiDelayCalc.cc
dcalc/ArnoldiReduce.cc
dcalc/DcalcAnalysisPt.cc
dcalc/DelayCalc.cc
dcalc/DmpCeff.cc
dcalc/DmpDelayCalc.cc
dcalc/GraphDelayCalc.cc
dcalc/GraphDelayCalc1.cc
dcalc/LumpedCapDelayCalc.cc
dcalc/NetCaps.cc
dcalc/RCDelayCalc.cc
dcalc/SimpleRCDelayCalc.cc
dcalc/UnitDelayCalc.cc
graph/DelayFloat.cc
graph/DelayNormal1.cc
graph/DelayNormal2.cc
graph/Graph.cc
graph/GraphCmp.cc
liberty/EquivCells.cc
liberty/FuncExpr.cc
liberty/InternalPower.cc
liberty/LeakagePower.cc
liberty/Liberty.cc
liberty/LibertyBuilder.cc
liberty/LibertyExpr.cc
liberty/LibertyExpr.hh
liberty/LibertyExprLex.cc
liberty/LibertyExprParse.cc
liberty/LibertyExprPvt.hh
liberty/LibertyLex.cc
liberty/LibertyParse.cc
liberty/LibertyParser.cc
liberty/LibertyReader.cc
liberty/LinearModel.cc
liberty/Sequential.cc
liberty/TableModel.cc
liberty/TimingArc.cc
liberty/TimingRole.cc
liberty/Transition.cc
liberty/Units.cc
liberty/Wireload.cc
network/ConcreteLibrary.cc
network/ConcreteNetwork.cc
network/HpinDrvrLoad.cc
network/Network.cc
network/NetworkCmp.cc
network/ParseBus.cc
network/PortDirection.cc
network/SdcNetwork.cc
network/VerilogNamespace.cc
parasitics/ConcreteParasitics.cc
parasitics/EstimateParasitics.cc
parasitics/NullParasitics.cc
parasitics/Parasitics.cc
parasitics/ReduceParasitics.cc
parasitics/SpefLex.cc
parasitics/SpefNamespace.cc
parasitics/SpefParse.cc
parasitics/SpefReader.cc
parasitics/SpefReaderPvt.hh
sdc/Clock.cc
sdc/ClockGatingCheck.cc
sdc/ClockGroups.cc
sdc/ClockInsertion.cc
sdc/ClockLatency.cc
sdc/CycleAccting.cc
sdc/DataCheck.cc
sdc/DeratingFactors.cc
sdc/DisabledPorts.cc
sdc/ExceptionPath.cc
sdc/InputDrive.cc
sdc/PinPair.cc
sdc/PortDelay.cc
sdc/PortExtCap.cc
sdc/RiseFallMinMax.cc
sdc/RiseFallValues.cc
sdc/Sdc.cc
sdc/SdcCmdComment.cc
sdc/WriteSdc.cc
sdf/ReportAnnotation.cc
sdf/SdfReader.cc
sdf/SdfParse.cc
sdf/SdfLex.cc
sdf/SdfWriter.cc
search/Bfs.cc
search/CheckMaxSkews.cc
search/CheckMinPeriods.cc
search/CheckMinPulseWidths.cc
search/CheckSlewLimits.cc
search/CheckTiming.cc
search/ClkInfo.cc
search/ClkSkew.cc
search/Corner.cc
search/Crpr.cc
search/FindRegister.cc
search/GatedClk.cc
search/Genclks.cc
search/Latches.cc
search/Levelize.cc
search/Path.cc
search/PathAnalysisPt.cc
search/PathEnd.cc
search/PathEnum.cc
search/PathEnumed.cc
search/PathExpanded.cc
search/PathGroup.cc
search/PathRef.cc
search/PathVertex.cc
search/PathVertexRep.cc
search/Power.cc
search/Property.cc
search/ReportPath.cc
search/Search.cc
search/SearchPred.cc
search/Sim.cc
search/Sta.cc
search/StaState.cc
search/Tag.cc
search/TagGroup.cc
search/VertexVisitor.cc
search/VisitPathEnds.cc
search/VisitPathGroupVertices.cc
search/WorstSlack.cc
search/WritePathSpice.cc
util/Debug.cc
util/Error.cc
util/Fuzzy.cc
util/Machine.cc
util/MinMax.cc
util/PatternMatch.cc
util/Report.cc
util/ReportStd.cc
util/ReportTcl.cc
util/Stats.cc
util/StringSeq.cc
util/StringSet.cc
util/StringUtil.cc
util/TokenParser.cc
verilog/VerilogReader.cc
verilog/VerilogLex.cc
verilog/VerilogParse.cc
)
set(STA_HEADERS
app/StaMain.hh
dcalc/ArcDelayCalc.hh
dcalc/Arnoldi.hh
dcalc/ArnoldiDelayCalc.hh
dcalc/ArnoldiReduce.hh
dcalc/DelayCalc.hh
dcalc/DcalcAnalysisPt.hh
dcalc/DmpCeff.hh
dcalc/DmpDelayCalc.hh
dcalc/GraphDelayCalc.hh
dcalc/GraphDelayCalc1.hh
dcalc/LumpedCapDelayCalc.hh
dcalc/NetCaps.hh
dcalc/RCDelayCalc.hh
dcalc/SimpleRCDelayCalc.hh
dcalc/UnitDelayCalc.hh
graph/Delay.hh
graph/DelayFloat.hh
graph/DelayNormal1.hh
graph/DelayNormal2.hh
graph/Graph.hh
graph/GraphClass.hh
graph/GraphCmp.hh
liberty/EquivCells.hh
liberty/FuncExpr.hh
liberty/InternalPower.hh
liberty/LeakagePower.hh
liberty/Liberty.hh
liberty/LibertyBuilder.hh
liberty/LibertyClass.hh
liberty/LibertyParser.hh
liberty/LibertyReader.hh
liberty/LibertyReaderPvt.hh
liberty/LinearModel.hh
liberty/Sequential.hh
liberty/TableModel.hh
liberty/TimingArc.hh
liberty/TimingModel.hh
liberty/TimingRole.hh
liberty/Transition.hh
liberty/Units.hh
liberty/Wireload.hh
network/ConcreteLibrary.hh
network/ConcreteNetwork.hh
network/HpinDrvrLoad.hh
network/MakeConcreteNetwork.hh
network/Network.hh
network/NetworkClass.hh
network/NetworkCmp.hh
network/ParseBus.hh
network/PortDirection.hh
network/SdcNetwork.hh
network/VerilogNamespace.hh
parasitics/ConcreteParasitics.hh
parasitics/ConcreteParasiticsPvt.hh
parasitics/EstimateParasitics.hh
parasitics/MakeConcreteParasitics.hh
parasitics/NullParasitics.hh
parasitics/Parasitics.hh
parasitics/ParasiticsClass.hh
parasitics/ReduceParasitics.hh
parasitics/SpefNamespace.hh
parasitics/SpefReader.hh
sdc/Clock.hh
sdc/ClockGatingCheck.hh
sdc/ClockGroups.hh
sdc/ClockInsertion.hh
sdc/ClockLatency.hh
sdc/CycleAccting.hh
sdc/DataCheck.hh
sdc/DeratingFactors.hh
sdc/DisabledPorts.hh
sdc/ExceptionPath.hh
sdc/InputDrive.hh
sdc/MinMaxValues.hh
sdc/PinPair.hh
sdc/PortDelay.hh
sdc/PortExtCap.hh
sdc/RiseFallMinMax.hh
sdc/RiseFallValues.hh
sdc/Sdc.hh
sdc/SdcClass.hh
sdc/SdcCmdComment.hh
sdc/WriteSdc.hh
sdc/WriteSdcPvt.hh
sdf/ReportAnnotation.hh
sdf/Sdf.hh
sdf/SdfReader.hh
sdf/SdfWriter.hh
search/Bfs.hh
search/CheckMaxSkews.hh
search/CheckMinPeriods.hh
search/CheckMinPulseWidths.hh
search/CheckSlewLimits.hh
search/CheckTiming.hh
search/ClkInfo.hh
search/ClkSkew.hh
search/Corner.hh
search/Crpr.hh
search/FindRegister.hh
search/GatedClk.hh
search/Genclks.hh
search/Latches.hh
search/Levelize.hh
search/Path.hh
search/PathAnalysisPt.hh
search/PathEnd.hh
search/PathEnum.hh
search/PathEnumed.hh
search/PathExpanded.hh
search/PathRef.hh
search/PathGroup.hh
search/PathVertex.hh
search/PathVertexRep.hh
search/Power.hh
search/Property.hh
search/ReportPath.hh
search/Search.hh
search/SearchClass.hh
search/SearchPred.hh
search/Sim.hh
search/Sta.hh
search/StaState.hh
search/Tag.hh
search/TagGroup.hh
search/VertexVisitor.hh
search/VisitPathEnds.hh
search/VisitPathGroupVertices.hh
search/WorstSlack.hh
search/WritePathSpice.hh
util/Debug.hh
util/DisallowCopyAssign.hh
util/EnumNameMap.hh
util/Error.hh
util/Fuzzy.hh
util/Hash.hh
util/HashSet.hh
util/Iterator.hh
util/Machine.hh
util/Map.hh
util/MinMax.hh
util/Mutex.hh
util/ObjectIndex.hh
util/PatternMatch.hh
util/Pool.hh
util/Report.hh
util/ReportStd.hh
util/ReportTcl.hh
util/Set.hh
util/StaConfig.hh
util/Stats.hh
util/StringSeq.hh
util/StringSet.hh
util/StringUtil.hh
util/ThreadForEach.hh
util/TokenParser.hh
util/UnorderedMap.hh
util/UnorderedSet.hh
util/Vector.hh
util/Zlib.hh
verilog/Verilog.hh
verilog/VerilogReader.hh
)
# Source files.
set(STA_TCL_FILES
tcl/Util.tcl
tcl/Graph.tcl
tcl/Liberty.tcl
tcl/Link.tcl
tcl/Network.tcl
tcl/NetworkEdit.tcl
tcl/Sdc.tcl
tcl/Search.tcl
tcl/Cmds.tcl
tcl/Variables.tcl
tcl/Sta.tcl
tcl/Power.tcl
tcl/Splash.tcl
dcalc/DelayCalc.tcl
parasitics/Parasitics.tcl
sdf/Sdf.tcl
tcl/Compatibility.tcl
verilog/Verilog.tcl
)
set(STA_SWIG_FILES
tcl/NetworkEdit.i
tcl/StaException.i
sdf/Sdf.i
dcalc/DelayCalc.i
parasitics/Parasitics.i
verilog/Verilog.i
tcl/StaTcl.i
app/StaApp.i
)
################################################################
#
# Library dependencies
#
################################################################
# Zlib
include(FindZLIB)
# translate cmake bool to ifdef bool
if (ZLIB_FOUND)
set(ZLIB 1)
else()
set(ZLIB 0)
endif()
################################################################
#
# Locate CUDD bdd packagte
# -DCUDD=0 to not use CUDD.
# Look for library in CUDD/lib, CUDD/cudd/lib
# Look for header in CUDD/include, CUDD/cudd/include
#
if("${CUDD}" STREQUAL "" OR "${CUDD}" STREQUAL "0")
set(CUDD_INCLUDE "")
set(CUDD_LIB "")
set(CUDD_FOUND FALSE)
set(CUDD 0)
message(STATUS "CUDD library: not found")
else()
find_library(CUDD_LIB NAMES cudd PATHS ${CUDD}/lib ${CUDD}/lib/cudd)
if (CUDD_LIB)
message(STATUS "CUDD library: ${CUDD_LIB}")
get_filename_component(CUDD_LIB_DIR "${CUDD_LIB}" PATH)
get_filename_component(CUDD_LIB_PARENT1 "${CUDD_LIB_DIR}" PATH)
get_filename_component(CUDD_LIB_PARENT2 "${CUDD_LIB_PARENT1}" PATH)
find_file(CUDD_HEADER cudd.h
PATHS ${CUDD}/include ${CUDD_LIB_PARENT2}/include/cudd)
if (CUDD_HEADER)
get_filename_component(CUDD_INCLUDE "${CUDD_HEADER}" PATH)
message(STATUS "CUDD header: ${CUDD_HEADER}")
# CUDD referenced by StaConfig.hh.cmake
set(CUDD 1)
else()
message(STATUS "CUDD header: not found")
endif()
else()
set(CUDD_INCLUDE "")
set(CUDD_LIB "")
set(CUDD_FOUND FALSE)
set(CUDD 0)
message(STATUS "CUDD library: not found")
endif()
endif()
if("${SSTA}" STREQUAL "")
set(SSTA 0)
endif()
message(STATUS "SSTA: ${SSTA}")
# configure a header file to pass some of the CMake settins
configure_file(${STA_HOME}/util/StaConfig.hh.cmake
${STA_HOME}/util/StaConfig.hh
)
################################################################
#
# Locate TCL library.
#
# Note that the cmake findTcl module is hopeless for OSX
# because there doesn't appear to be a way to override
# searching OSX system directories before unix directories.
set(TCL_POSSIBLE_NAMES tcl87 tcl8.7
tcl86 tcl8.6
tcl85 tcl8.5
tcl84 tcl8.4
tcl83 tcl8.3
tcl82 tcl8.2
)
# tcl lib path guesses.
if (NOT TCL_LIB_PATHS)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(TCL_LIB_PATHS /usr/local/lib)
set(TCL_NO_DEFAULT_PATH TRUE)
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TCL_LIB_PATHS /usr/lib
/usr/local/lib
)
set(TCL_NO_DEFAULT_PATH FALSE)
endif()
if (NOT TCL_LIB)
# bagbiter cmake doesn't have a way to pass NO_DEFAULT_PATH as a parameter.
if (TCL_NO_DEFAULT_PATH)
find_library(TCL_LIB
NAMES tcl ${TCL_POSSIBLE_NAMES}
PATHS ${TCL_LIB_PATHS}
NO_DEFAULT_PATH
)
else()
find_library(TCL_LIB
NAMES tcl ${TCL_POSSIBLE_NAMES}
PATHS ${TCL_LIB_PATHS}
)
endif()
endif()
message(STATUS "TCL lib: ${TCL_LIB}")
get_filename_component(TCL_LIB_DIR "${TCL_LIB}" PATH)
get_filename_component(TCL_LIB_PARENT1 "${TCL_LIB_DIR}" PATH)
get_filename_component(TCL_LIB_PARENT2 "${TCL_LIB_PARENT1}" PATH)
# Locate tcl.h
if (NOT TCL_HEADER)
find_file(TCL_HEADER tcl.h
PATHS ${TCL_LIB_PARENT1} ${TCL_LIB_PARENT2}
PATH_SUFFIXES include include/tcl
NO_DEFAULT_PATH
)
endif()
message(STATUS "TCL header: ${TCL_HEADER}")
get_filename_component(TCL_HEADER_DIR "${TCL_HEADER}" PATH)
################################################################
#
# Flex/bison scanner/parsers
#
################################################################
find_package(FLEX)
find_package(BISON)
# LibertyExpr scan/parse.
bison_target(LibertyExprParser liberty/LibertyExprParse.yy ${STA_HOME}/liberty/LibertyExprParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprParse.hh
COMPILE_FLAGS --name-prefix=LibertyExprParse_
)
flex_target(LibertyExprLex liberty/LibertyExprLex.ll ${STA_HOME}/liberty/LibertyExprLex.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprLex.hh
COMPILE_FLAGS --prefix=LibertyExprLex_
)
add_flex_bison_dependency(LibertyExprLex LibertyExprParser)
# Liberty scan/parse.
bison_target(LibertyParser liberty/LibertyParse.yy ${STA_HOME}/liberty/LibertyParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyParse.hh
COMPILE_FLAGS --name-prefix=LibertyParse_
)
flex_target(LibertyLex liberty/LibertyLex.ll ${STA_HOME}/liberty/LibertyLex.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyLex.hh
COMPILE_FLAGS --prefix=LibertyLex_
)
add_flex_bison_dependency(LibertyLex LibertyParser)
# Spef scan/parse.
bison_target(SpefParser parasitics/SpefParse.yy ${STA_HOME}/parasitics/SpefParse.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpefParse.hh
COMPILE_FLAGS --name-prefix=SpefParse_
)
flex_target(SpefLex parasitics/SpefLex.ll ${STA_HOME}/parasitics/SpefLex.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpefLex.hh
COMPILE_FLAGS --prefix=SpefLex_
)
add_flex_bison_dependency(SpefLex SpefParser)
# Verilog scan/parse.
bison_target(VerilogParser verilog/VerilogParse.yy ${STA_HOME}/verilog/VerilogParse.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogParse.hh
COMPILE_FLAGS --name-prefix=VerilogParse_
)
flex_target(VerilogLex verilog/VerilogLex.ll ${STA_HOME}/verilog/VerilogLex.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogLex.hh
COMPILE_FLAGS --prefix=VerilogLex_
)
add_flex_bison_dependency(VerilogLex VerilogParser)
# Sdf scan/parse.
bison_target(SdfParser sdf/SdfParse.yy ${STA_HOME}/sdf/SdfParse.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfParse.hh
COMPILE_FLAGS --name-prefix=SdfParse_
)
flex_target(SdfLex sdf/SdfLex.ll ${STA_HOME}/sdf/SdfLex.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfLex.hh
COMPILE_FLAGS --prefix=SdfLex_
)
add_flex_bison_dependency(SdfLex SdfParser)
################################################################
include(FindSWIG)
add_custom_command(OUTPUT ${STA_HOME}/app/StaApp_wrap.cc
COMMAND ${SWIG_EXECUTABLE} -tcl8 -c++ -namespace -prefix sta -o ${STA_HOME}/app/StaApp_wrap.cc ${STA_HOME}/app/StaApp.i
COMMAND ${STA_HOME}/etc/SwigCleanup.tcl ${STA_HOME}/app/StaApp_wrap.cc
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_SWIG_FILES}
)
################################################################
# TCL files included as part of the executable are shoved into TclInitVar.cc.
# These files are encoded and shipped as part of the executable
# so that they do not have to be installed on the client host.
add_custom_command(OUTPUT ${STA_HOME}/app/TclInitVar.cc
COMMAND etc/TclEncode.tcl app/TclInitVar.cc tcl_inits ${STA_TCL_FILES}
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_TCL_FILES} etc/TclEncode.tcl
)
################################################################
set(STA_INCLUDE_DIRS
app
dcalc
dcalc/verilog
graph
liberty
network
parasitics
sdc
sdf
search
util
verilog
${TCL_HEADER_DIR}
${CUDD_INCLUDE}
)
###########################################################
# Library
###########################################################
# compatibility with configure
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${STA_HOME}/app)
add_library(OpenSTA ${STA_SOURCE})
target_include_directories(OpenSTA PUBLIC ${STA_INCLUDE_DIRS})
target_compile_features(OpenSTA
PUBLIC cxx_auto_type
)
###########################################################
# Executable
###########################################################
# compatibility with configure
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${STA_HOME}/app)
# Note executable and lib name cannot be the same because
# on osx something is case insensitive. Using STA for the
# lib name results in "No rule to make target ../depend.
add_executable(sta app/Main.cc)
target_link_libraries(sta
OpenSTA
${TCL_LIB}
${CUDD_LIB}
)
if (ZLIB_FOUND)
target_link_libraries(sta ${ZLIB_LIBRARIES})
endif()
message(STATUS "STA executable: ${STA_HOME}/app/sta")
# Compiler specific options.
if (CMAKE_CXX_COMPILER_ID MATCHES AppleClang|Clang|GNU)
set(STA_COMPILE_OPTIONS -Wall -Wcast-qual -Wunused-parameter -Wredundant-decls -Wno-deprecated-register)
endif()
# g++ still needs -pthreads when using std::thread
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(STA_COMPILE_OPTIONS -Wall -Wcast-qual -Wunused-parameter -Wredundant-decls -Wno-deprecated-register)
target_link_libraries(sta -pthread)
endif()
target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS})
target_compile_options(sta PUBLIC ${STA_COMPILE_OPTIONS})
message(STATUS "Compiler options: ${STA_COMPILE_OPTIONS}")
################################################################
# Install
# cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>
# executable
install(TARGETS sta DESTINATION bin)
# library
install(TARGETS OpenSTA DESTINATION lib)
# include
install(FILES ${STA_HEADERS} DESTINATION include)
################################################################
add_custom_target(tags etags -o TAGS ${STA_SOURCE} ${STA_HEADERS} ${STA_TCL_FILES} ${SWIG_TCL_FILES}
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_SOURCE} ${STA_HEADERS} ${STA_TCL_FILES} ${SWIG_TCL_FILES}
)
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.
//