├── .clang-format ├── .dockerignore ├── .gitignore ├── Brewfile ├── CMakeLists.txt ├── Dockerfile.centos7 ├── Dockerfile.ubuntu22.04 ├── Jenkinsfile ├── LICENSE ├── README.md ├── app ├── Main.cc ├── StaApp.i └── StaMain.cc ├── cmake ├── FindCUDD.cmake ├── FindTCL.cmake ├── GetGitRevisionDescription.cmake └── GetGitRevisionDescription.cmake.in ├── dcalc ├── ArcDcalcWaveforms.cc ├── ArcDcalcWaveforms.hh ├── ArcDelayCalc.cc ├── Arnoldi.hh ├── Arnoldi.txt ├── ArnoldiDelayCalc.cc ├── ArnoldiDelayCalc.hh ├── ArnoldiReduce.cc ├── ArnoldiReduce.hh ├── CcsCeffDelayCalc.cc ├── CcsCeffDelayCalc.hh ├── DcalcAnalysisPt.cc ├── DelayCalc.cc ├── DelayCalc.i ├── DelayCalc.tcl ├── DelayCalcBase.cc ├── DelayCalcBase.hh ├── DmpCeff.cc ├── DmpCeff.hh ├── DmpDelayCalc.cc ├── DmpDelayCalc.hh ├── FindRoot.cc ├── FindRoot.hh ├── GraphDelayCalc.cc ├── LumpedCapDelayCalc.cc ├── LumpedCapDelayCalc.hh ├── NetCaps.cc ├── NetCaps.hh ├── ParallelDelayCalc.cc ├── ParallelDelayCalc.hh ├── PrimaDelayCalc.cc ├── PrimaDelayCalc.hh ├── UnitDelayCalc.cc └── UnitDelayCalc.hh ├── doc ├── ApiChanges.txt ├── CLA.txt ├── ChangeLog.txt ├── CodingGuidelines.txt ├── OpenSTA.odt ├── OpenSTA.pdf └── StaApi.txt ├── etc ├── FindMessages.tcl └── TclEncode.tcl ├── examples ├── delay_calc.tcl ├── example1.dspef ├── example1.sdf ├── example1.v ├── gcd_rtl.v ├── gcd_sky130hd.saif.gz ├── gcd_sky130hd.sdc ├── gcd_sky130hd.spef ├── gcd_sky130hd.v ├── gcd_sky130hd.vcd.gz ├── gcd_tb.v ├── min_max_delays.tcl ├── multi_corner.tcl ├── nangate45_fast.lib.gz ├── nangate45_slow.lib.gz ├── nangate45_typ.lib.gz ├── power.tcl ├── power_vcd.tcl ├── sdf_delays.tcl ├── sky130_hd.v ├── sky130_hd_primitives.v ├── sky130hd_tt.lib.gz └── spef_parasitics.tcl ├── graph ├── Delay.cc ├── DelayFloat.cc ├── DelayNormal1.cc ├── DelayNormal2.cc ├── Graph.cc ├── Graph.i ├── Graph.tcl └── GraphCmp.cc ├── include └── sta │ ├── ArcDelayCalc.hh │ ├── Bdd.hh │ ├── Bfs.hh │ ├── CircuitSim.hh │ ├── ClkNetwork.hh │ ├── Clock.hh │ ├── ClockGatingCheck.hh │ ├── ClockGroups.hh │ ├── ClockInsertion.hh │ ├── ClockLatency.hh │ ├── ConcreteLibrary.hh │ ├── ConcreteNetwork.hh │ ├── Corner.hh │ ├── CycleAccting.hh │ ├── DataCheck.hh │ ├── DcalcAnalysisPt.hh │ ├── Debug.hh │ ├── Delay.hh │ ├── DelayCalc.hh │ ├── DelayFloat.hh │ ├── DelayNormal1.hh │ ├── DelayNormal2.hh │ ├── DeratingFactors.hh │ ├── DisabledPorts.hh │ ├── DispatchQueue.hh │ ├── EnumNameMap.hh │ ├── EquivCells.hh │ ├── Error.hh │ ├── ExceptionPath.hh │ ├── FuncExpr.hh │ ├── Fuzzy.hh │ ├── Graph.hh │ ├── GraphClass.hh │ ├── GraphCmp.hh │ ├── GraphDelayCalc.hh │ ├── Hash.hh │ ├── HpinDrvrLoad.hh │ ├── InputDrive.hh │ ├── InternalPower.hh │ ├── Iterator.hh │ ├── LeakagePower.hh │ ├── Liberty.hh │ ├── LibertyClass.hh │ ├── LibertyWriter.hh │ ├── LinearModel.hh │ ├── Machine.hh │ ├── MakeConcreteNetwork.hh │ ├── MakeConcreteParasitics.hh │ ├── Map.hh │ ├── MinMax.hh │ ├── MinMaxValues.hh │ ├── Mutex.hh │ ├── Network.hh │ ├── NetworkClass.hh │ ├── NetworkCmp.hh │ ├── ObjectId.hh │ ├── ObjectTable.hh │ ├── Parasitics.hh │ ├── ParasiticsClass.hh │ ├── ParseBus.hh │ ├── Path.hh │ ├── PathAnalysisPt.hh │ ├── PathEnd.hh │ ├── PathExpanded.hh │ ├── PathGroup.hh │ ├── PatternMatch.hh │ ├── PinPair.hh │ ├── PortDelay.hh │ ├── PortDirection.hh │ ├── PortExtCap.hh │ ├── PowerClass.hh │ ├── Property.hh │ ├── Report.hh │ ├── ReportStd.hh │ ├── ReportTcl.hh │ ├── RiseFallMinMax.hh │ ├── RiseFallValues.hh │ ├── Sdc.hh │ ├── SdcClass.hh │ ├── SdcCmdComment.hh │ ├── SdcNetwork.hh │ ├── Search.hh │ ├── SearchClass.hh │ ├── SearchPred.hh │ ├── Sequential.hh │ ├── Set.hh │ ├── Sta.hh │ ├── StaMain.hh │ ├── StaState.hh │ ├── Stats.hh │ ├── StringSeq.hh │ ├── StringSet.hh │ ├── StringUtil.hh │ ├── TableModel.hh │ ├── TclTypeHelpers.hh │ ├── TimingArc.hh │ ├── TimingModel.hh │ ├── TimingRole.hh │ ├── TokenParser.hh │ ├── Transition.hh │ ├── Units.hh │ ├── UnorderedMap.hh │ ├── UnorderedSet.hh │ ├── Variables.hh │ ├── Vector.hh │ ├── VerilogNamespace.hh │ ├── VerilogReader.hh │ ├── VerilogWriter.hh │ ├── VertexId.hh │ ├── VertexVisitor.hh │ ├── VisitPathEnds.hh │ ├── Wireload.hh │ ├── WriteSdc.hh │ └── Zlib.hh ├── jenkins ├── build.sh ├── install.sh └── test.sh ├── liberty ├── EquivCells.cc ├── FuncExpr.cc ├── InternalPower.cc ├── LeakagePower.cc ├── LibExprLex.ll ├── LibExprParse.yy ├── LibExprReader.cc ├── LibExprReader.hh ├── LibExprReaderPvt.hh ├── LibExprScanner.hh ├── Liberty.cc ├── Liberty.i ├── Liberty.tcl ├── LibertyBuilder.cc ├── LibertyBuilder.hh ├── LibertyExt.cc ├── LibertyLex.ll ├── LibertyParse.yy ├── LibertyParser.cc ├── LibertyParser.hh ├── LibertyReader.cc ├── LibertyReader.hh ├── LibertyReaderPvt.hh ├── LibertyScanner.hh ├── LibertyWriter.cc ├── LinearModel.cc ├── Sequential.cc ├── TableModel.cc ├── TimingArc.cc ├── TimingModel.cc ├── TimingRole.cc ├── Units.cc └── Wireload.cc ├── network ├── ConcreteLibrary.cc ├── ConcreteNetwork.cc ├── HpinDrvrLoad.cc ├── Link.tcl ├── Network.cc ├── Network.i ├── Network.tcl ├── NetworkCmp.cc ├── NetworkEdit.i ├── NetworkEdit.tcl ├── ParseBus.cc ├── PortDirection.cc ├── SdcNetwork.cc └── VerilogNamespace.cc ├── parasitics ├── ConcreteParasitics.cc ├── ConcreteParasitics.hh ├── ConcreteParasiticsPvt.hh ├── EstimateParasitics.cc ├── EstimateParasitics.hh ├── Parasitics.cc ├── Parasitics.i ├── Parasitics.tcl ├── ReduceParasitics.cc ├── ReduceParasitics.hh ├── ReportParasiticAnnotation.cc ├── ReportParasiticAnnotation.hh ├── SpefLex.ll ├── SpefNamespace.cc ├── SpefNamespace.hh ├── SpefParse.yy ├── SpefReader.cc ├── SpefReader.hh ├── SpefReaderPvt.hh └── SpefScanner.hh ├── power ├── Power.cc ├── Power.hh ├── Power.i ├── Power.tcl ├── SaifLex.ll ├── SaifParse.yy ├── SaifReader.cc ├── SaifReader.hh ├── SaifReaderPvt.hh ├── SaifScanner.hh ├── VcdParse.cc ├── VcdParse.hh ├── VcdReader.cc └── VcdReader.hh ├── sdc ├── Clock.cc ├── ClockGatingCheck.cc ├── ClockGroups.cc ├── ClockInsertion.cc ├── ClockLatency.cc ├── CycleAccting.cc ├── DataCheck.cc ├── DeratingFactors.cc ├── DisabledPorts.cc ├── ExceptionPath.cc ├── InputDrive.cc ├── PinPair.cc ├── PortDelay.cc ├── PortExtCap.cc ├── Sdc.cc ├── Sdc.i ├── Sdc.tcl ├── SdcCmdComment.cc ├── SdcGraph.cc ├── Variables.cc ├── WriteSdc.cc └── WriteSdcPvt.hh ├── sdf ├── ReportAnnotation.cc ├── ReportAnnotation.hh ├── Sdf.i ├── Sdf.tcl ├── SdfLex.ll ├── SdfParse.yy ├── SdfReader.cc ├── SdfReader.hh ├── SdfReaderPvt.hh ├── SdfScanner.hh ├── SdfWriter.cc └── SdfWriter.hh ├── search ├── Bdd.cc ├── Bfs.cc ├── CheckCapacitanceLimits.cc ├── CheckCapacitanceLimits.hh ├── CheckFanoutLimits.cc ├── CheckFanoutLimits.hh ├── CheckMaxSkews.cc ├── CheckMaxSkews.hh ├── CheckMinPeriods.cc ├── CheckMinPeriods.hh ├── CheckMinPulseWidths.cc ├── CheckMinPulseWidths.hh ├── CheckSlewLimits.cc ├── CheckSlewLimits.hh ├── CheckTiming.cc ├── CheckTiming.hh ├── ClkDelays.hh ├── ClkInfo.cc ├── ClkInfo.hh ├── ClkLatency.cc ├── ClkLatency.hh ├── ClkNetwork.cc ├── ClkSkew.cc ├── ClkSkew.hh ├── Corner.cc ├── Crpr.cc ├── Crpr.hh ├── FindRegister.cc ├── FindRegister.hh ├── GatedClk.cc ├── GatedClk.hh ├── Genclks.cc ├── Genclks.hh ├── Latches.cc ├── Latches.hh ├── Levelize.cc ├── Levelize.hh ├── MakeTimingModel.cc ├── MakeTimingModel.hh ├── MakeTimingModelPvt.hh ├── Path.cc ├── PathAnalysisPt.cc ├── PathEnd.cc ├── PathEnum.cc ├── PathEnum.hh ├── PathExpanded.cc ├── PathGroup.cc ├── Property.cc ├── Property.i ├── ReportPath.cc ├── ReportPath.hh ├── Search.cc ├── Search.i ├── Search.tcl ├── SearchPred.cc ├── Sim.cc ├── Sim.hh ├── Sta.cc ├── StaState.cc ├── Tag.cc ├── Tag.hh ├── TagGroup.cc ├── TagGroup.hh ├── VertexVisitor.cc ├── VisitPathEnds.cc ├── VisitPathGroupVertices.cc ├── VisitPathGroupVertices.hh ├── WorstSlack.cc └── WorstSlack.hh ├── spice ├── WritePathSpice.cc ├── WritePathSpice.hh ├── WriteSpice.cc ├── WriteSpice.hh ├── WriteSpice.i ├── WriteSpice.tcl ├── Xyce.cc └── Xyce.hh ├── tcl ├── CmdArgs.tcl ├── CmdUtil.tcl ├── Exception.i ├── Init.tcl ├── Property.tcl ├── Splash.tcl ├── Sta.tcl ├── StaTclTypes.i ├── TclTypeHelpers.cc ├── Util.tcl └── Variables.tcl ├── test ├── asap7_ccsn.lib.gz ├── asap7_invbuf.lib.gz ├── asap7_seq.lib.gz ├── asap7_simple.lib.gz ├── asap7_small.lib.gz ├── delay_calc.ok ├── get_filter.ok ├── get_filter.tcl ├── get_is_memory.ok ├── get_is_memory.tcl ├── get_is_memory.v ├── get_lib_pins_of_objects.ok ├── get_lib_pins_of_objects.tcl ├── get_noargs.ok ├── get_noargs.tcl ├── get_objrefs.ok ├── get_objrefs.tcl ├── gf180mcu_sram.lib.gz ├── liberty_arcs_one2one_1.lib ├── liberty_arcs_one2one_1.ok ├── liberty_arcs_one2one_1.tcl ├── liberty_arcs_one2one_1.v ├── liberty_arcs_one2one_2.lib ├── liberty_arcs_one2one_2.ok ├── liberty_arcs_one2one_2.tcl ├── liberty_arcs_one2one_2.v ├── liberty_ccsn.ok ├── liberty_ccsn.tcl ├── liberty_latch3.lib ├── liberty_latch3.ok ├── liberty_latch3.tcl ├── min_max_delays.ok ├── multi_corner.ok ├── path_group_names.ok ├── path_group_names.tcl ├── power.ok ├── power_vcd.ok ├── prima3.ok ├── prima3.tcl ├── reg1_asap7.spef ├── reg1_asap7.v ├── regression ├── regression.tcl ├── regression_vars.tcl ├── report_checks_src_attr.ok ├── report_checks_src_attr.tcl ├── report_json1.ok ├── report_json1.tcl ├── report_json2.ok ├── report_json2.tcl ├── save_ok ├── sdf_delays.ok ├── spef_parasitics.ok ├── suppress_msg.ok ├── suppress_msg.tcl ├── valgrind.suppress ├── verilog_attribute.ok ├── verilog_attribute.tcl └── verilog_attribute.v ├── util ├── Debug.cc ├── DispatchQueue.cc ├── Error.cc ├── FlexDisableRegister.hh ├── Fuzzy.cc ├── Hash.cc ├── Machine.cc ├── MachineApple.cc ├── MachineLinux.cc ├── MachineUnknown.cc ├── MachineWin32.cc ├── MinMax.cc ├── PatternMatch.cc ├── Report.cc ├── ReportStd.cc ├── ReportTcl.cc ├── RiseFallMinMax.cc ├── RiseFallValues.cc ├── StaConfig.hh.cmake ├── Stats.cc ├── StringSeq.cc ├── StringSet.cc ├── StringUtil.cc ├── TokenParser.cc ├── Transition.cc ├── Util.i └── gzstream.hh └── verilog ├── Verilog.i ├── Verilog.tcl ├── VerilogLex.ll ├── VerilogParse.yy ├── VerilogReader.cc ├── VerilogReader.hh ├── VerilogReaderPvt.hh ├── VerilogScanner.hh └── VerilogWriter.cc /.clang-format: -------------------------------------------------------------------------------- 1 | # This is "close" to correct but has a number of bugs that prevent 2 | # using it on the source tree. 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | AccessModifierOffset: -2 6 | AlignOperands: false 7 | AllowAllArgumentsOnNextLine: false 8 | AllowAllConstructorInitializersOnNextLine: false 9 | AllowAllParametersOfDeclarationOnNextLine: false 10 | AllowShortIfStatementsOnASingleLine: Never 11 | AllowShortLoopsOnASingleLine: false 12 | AlwaysBreakAfterReturnType: TopLevel 13 | BinPackArguments: false 14 | # fails 15 | BinPackParameters: false 16 | BraceWrapping: 17 | AfterClass: true 18 | AfterStruct: true 19 | AfterFunction: true 20 | BeforeElse: true 21 | BreakBeforeBraces: Custom 22 | # fails if all initializers fit on one line 23 | BreakConstructorInitializers: AfterColon 24 | ColumnLimit: 0 25 | # fails 26 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 27 | ConstructorInitializerIndentWidth: 2 28 | IncludeBlocks: Preserve 29 | PointerAlignment: Right 30 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | Dockerfile 3 | README 4 | INSTALL 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rej 2 | *.orig 3 | TAGS 4 | *~ 5 | \#*# 6 | .#* 7 | .~lock.*\.*# 8 | .DS_Store 9 | .vscode 10 | .idea 11 | Makefile 12 | gmon.out 13 | 14 | cmake-build-debug 15 | build 16 | pvt 17 | 18 | # iverilog turd 19 | examples/gcd_tb 20 | 21 | doc/._Sta.docx 22 | 23 | test/results 24 | # ngspice turd 25 | test/b3v3_1check.log 26 | 27 | doc/messages.txt 28 | 29 | # clangd turds 30 | .cache/ 31 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew "bison" 2 | brew "cmake" 3 | brew "eigen" 4 | brew "flex" 5 | brew "swig" 6 | brew "tcl-tk@8" 7 | 8 | tap "mht208/formal" 9 | brew "mht208/formal/cudd" 10 | -------------------------------------------------------------------------------- /Dockerfile.ubuntu22.04: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | LABEL author="James Cherry" 3 | LABEL maintainer="James Cherry " 4 | 5 | # Install basics 6 | ARG DEBIAN_FRONTEND=noninteractive 7 | RUN apt-get update && \ 8 | apt-get install -y \ 9 | wget \ 10 | cmake \ 11 | gcc \ 12 | tcl-dev \ 13 | tcl-tclreadline \ 14 | libeigen3-dev \ 15 | swig \ 16 | bison \ 17 | flex \ 18 | automake \ 19 | autotools-dev 20 | 21 | # Download CUDD 22 | RUN wget https://raw.githubusercontent.com/davidkebo/cudd/main/cudd_versions/cudd-3.0.0.tar.gz && \ 23 | tar -xvf cudd-3.0.0.tar.gz && \ 24 | rm cudd-3.0.0.tar.gz 25 | 26 | # Build CUDD 27 | RUN cd cudd-3.0.0 && \ 28 | mkdir ../cudd && \ 29 | ./configure && \ 30 | make -j`nproc` 31 | 32 | # Copy files and install OpenSTA 33 | RUN mkdir OpenSTA 34 | COPY . OpenSTA 35 | RUN cd OpenSTA && \ 36 | rm -rf build && \ 37 | mkdir build && \ 38 | cd build && \ 39 | cmake -DCUDD_DIR=../cudd-3.0.0 .. && \ 40 | make -j`nproc` 41 | 42 | # Run sta on entry 43 | ENTRYPOINT ["OpenSTA/build/sta"] 44 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | stages { 4 | stage('Build') { 5 | steps { 6 | sh './jenkins/build.sh' 7 | } 8 | } 9 | stage('Test') { 10 | steps { 11 | sh './jenkins/test.sh' 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/StaApp.i: -------------------------------------------------------------------------------- 1 | %module sta 2 | 3 | // OpenSTA, Static Timing Analyzer 4 | // Copyright (c) 2025, Parallax Software, Inc. 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | // 19 | // The origin of this software must not be misrepresented; you must not 20 | // claim that you wrote the original software. 21 | // 22 | // Altered source versions must be plainly marked as such, and must not be 23 | // misrepresented as being the original software. 24 | // 25 | // This notice may not be removed or altered from any source distribution. 26 | 27 | %include "tcl/Exception.i" 28 | %include "tcl/StaTclTypes.i" 29 | %include "dcalc/DelayCalc.i" 30 | %include "graph/Graph.i" 31 | %include "liberty/Liberty.i" 32 | %include "network/Network.i" 33 | %include "network/NetworkEdit.i" 34 | %include "parasitics/Parasitics.i" 35 | %include "power/Power.i" 36 | %include "sdc/Sdc.i" 37 | %include "sdf/Sdf.i" 38 | %include "search/Search.i" 39 | %include "search/Property.i" 40 | %include "util/Util.i" 41 | %include "spice/WriteSpice.i" 42 | %include "verilog/Verilog.i" 43 | -------------------------------------------------------------------------------- /cmake/FindCUDD.cmake: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # Locate CUDD bdd package. 4 | # 5 | ################################################################ 6 | find_library(CUDD_LIB 7 | NAME cudd 8 | PATHS ${CUDD_DIR} 9 | PATH_SUFFIXES lib lib/cudd cudd/.libs 10 | ) 11 | if (CUDD_LIB) 12 | message(STATUS "CUDD library: ${CUDD_LIB}") 13 | get_filename_component(CUDD_LIB_DIR "${CUDD_LIB}" PATH) 14 | get_filename_component(CUDD_LIB_PARENT1 "${CUDD_LIB_DIR}" PATH) 15 | find_file(CUDD_HEADER cudd.h 16 | PATHS ${CUDD_LIB_PARENT1} ${CUDD_LIB_PARENT1}/include ${CUDD_LIB_PARENT1}/include/cudd) 17 | if (CUDD_HEADER) 18 | get_filename_component(CUDD_INCLUDE "${CUDD_HEADER}" PATH) 19 | message(STATUS "CUDD header: ${CUDD_HEADER}") 20 | else() 21 | message(STATUS "CUDD header: not found") 22 | endif() 23 | else() 24 | message(STATUS "CUDD library: not found") 25 | endif() 26 | -------------------------------------------------------------------------------- /cmake/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | 18 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 19 | 20 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 21 | if(HEAD_CONTENTS MATCHES "ref") 22 | # named branch 23 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 24 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | else() 27 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 28 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 29 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 30 | set(HEAD_HASH "${CMAKE_MATCH_1}") 31 | endif() 32 | endif() 33 | else() 34 | # detached HEAD 35 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 36 | endif() 37 | 38 | if(NOT HEAD_HASH) 39 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 40 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 41 | endif() 42 | -------------------------------------------------------------------------------- /dcalc/ArcDcalcWaveforms.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "MinMax.hh" 28 | #include "TableModel.hh" 29 | #include "NetworkClass.hh" 30 | 31 | namespace sta { 32 | 33 | class StaState; 34 | class Corner; 35 | class DcalcAnalysisPt; 36 | class ArcDcalcArg; 37 | 38 | // Abstract class for delay calculation waveforms for ploting. 39 | class ArcDcalcWaveforms 40 | { 41 | public: 42 | // Record waveform for drvr/load pin. 43 | virtual void watchPin(const Pin *pin) = 0; 44 | virtual void clearWatchPins() = 0; 45 | virtual PinSeq watchPins() const = 0; 46 | virtual Waveform watchWaveform(const Pin *pin) = 0; 47 | 48 | protected: 49 | Waveform inputWaveform(ArcDcalcArg &dcalc_arg, 50 | const DcalcAnalysisPt *dcalc_ap, 51 | const StaState *sta); 52 | }; 53 | 54 | } // namespace 55 | 56 | -------------------------------------------------------------------------------- /dcalc/ArnoldiDelayCalc.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class ArcDelayCalc; 30 | class StaState; 31 | 32 | ArcDelayCalc * 33 | makeArnoldiDelayCalc(StaState *sta); 34 | 35 | } // namespace 36 | -------------------------------------------------------------------------------- /dcalc/DcalcAnalysisPt.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "StringUtil.hh" 26 | #include "DcalcAnalysisPt.hh" 27 | #include "Corner.hh" 28 | 29 | namespace sta { 30 | 31 | DcalcAnalysisPt::DcalcAnalysisPt(Corner *corner, 32 | DcalcAPIndex index, 33 | const OperatingConditions *op_cond, 34 | const MinMax *min_max, 35 | const MinMax *check_clk_slew_min_max) : 36 | corner_(corner), 37 | index_(index), 38 | op_cond_(op_cond), 39 | min_max_(min_max), 40 | check_clk_slew_min_max_(check_clk_slew_min_max) 41 | { 42 | } 43 | 44 | void 45 | DcalcAnalysisPt::setOperatingConditions(const OperatingConditions *op_cond) 46 | { 47 | op_cond_ = op_cond; 48 | } 49 | 50 | ParasiticAnalysisPt * 51 | DcalcAnalysisPt::parasiticAnalysisPt() const 52 | { 53 | return corner_->findParasiticAnalysisPt(min_max_); 54 | } 55 | 56 | void 57 | DcalcAnalysisPt::setCheckClkSlewIndex(DcalcAPIndex index) 58 | { 59 | check_clk_slew_index_ = index; 60 | } 61 | 62 | int 63 | DcalcAnalysisPt::libertyIndex() const 64 | { 65 | return corner_->libertyIndex(min_max_); 66 | } 67 | 68 | } // namespace 69 | -------------------------------------------------------------------------------- /dcalc/DmpDelayCalc.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class ArcDelayCalc; 30 | class StaState; 31 | 32 | ArcDelayCalc * 33 | makeDmpCeffElmoreDelayCalc(StaState *sta); 34 | ArcDelayCalc * 35 | makeDmpCeffTwoPoleDelayCalc(StaState *sta); 36 | 37 | } // namespace 38 | -------------------------------------------------------------------------------- /dcalc/FindRoot.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace sta { 30 | 31 | typedef const std::function FindRootFunc; 35 | 36 | double 37 | findRoot(FindRootFunc func, 38 | double x1, 39 | double x2, 40 | double x_tol, 41 | int max_iter, 42 | // Return value. 43 | bool &fail); 44 | 45 | double 46 | findRoot(FindRootFunc func, 47 | double x1, 48 | double y1, 49 | double x2, 50 | double y2, 51 | double x_tol, 52 | int max_iter, 53 | // Return value. 54 | bool &fail); 55 | 56 | } // namespace 57 | -------------------------------------------------------------------------------- /dcalc/NetCaps.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "NetCaps.hh" 26 | 27 | namespace sta { 28 | 29 | NetCaps::NetCaps() 30 | { 31 | } 32 | 33 | NetCaps::NetCaps(float pin_cap, 34 | float wire_cap, 35 | float fanout, 36 | bool has_net_load) : 37 | pin_cap_(pin_cap), 38 | wire_cap_(wire_cap), 39 | fanout_(fanout), 40 | has_net_load_(has_net_load) 41 | { 42 | } 43 | 44 | void 45 | NetCaps::init(float pin_cap, 46 | float wire_cap, 47 | float fanout, 48 | bool has_net_load) 49 | { 50 | pin_cap_ = pin_cap; 51 | wire_cap_ = wire_cap; 52 | fanout_ = fanout; 53 | has_net_load_ = has_net_load; 54 | } 55 | 56 | } // namespace 57 | -------------------------------------------------------------------------------- /dcalc/NetCaps.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | // Constraints::pinNetCap return values. 30 | class NetCaps 31 | { 32 | public: 33 | NetCaps(); 34 | NetCaps(float pin_cap, 35 | float wire_cap, 36 | float fanout, 37 | bool has_net_load); 38 | void init(float pin_cap, 39 | float wire_cap, 40 | float fanout, 41 | bool has_net_load); 42 | float pinCap() const { return pin_cap_; } 43 | float wireCap() const{ return wire_cap_; } 44 | float fanout() const{ return fanout_; } 45 | bool hasNetLoad() const { return has_net_load_; } 46 | 47 | private: 48 | float pin_cap_; 49 | float wire_cap_; 50 | float fanout_; 51 | bool has_net_load_; 52 | }; 53 | 54 | } // namespace 55 | -------------------------------------------------------------------------------- /dcalc/ParallelDelayCalc.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | #include 29 | 30 | #include "DelayCalcBase.hh" 31 | 32 | namespace sta { 33 | 34 | // Delay calculation for parallel gates using parallel drive resistance. 35 | class ParallelDelayCalc : public DelayCalcBase 36 | { 37 | public: 38 | ParallelDelayCalc(StaState *sta); 39 | ArcDcalcResultSeq gateDelays(ArcDcalcArgSeq &dcalc_args, 40 | const LoadPinIndexMap &load_pin_index_map, 41 | const DcalcAnalysisPt *dcalc_ap) override; 42 | protected: 43 | ArcDcalcResultSeq gateDelaysParallel(ArcDcalcArgSeq &dcalc_args, 44 | const LoadPinIndexMap &load_pin_index_map, 45 | const DcalcAnalysisPt *dcalc_ap); 46 | }; 47 | 48 | } // namespace 49 | -------------------------------------------------------------------------------- /doc/OpenSTA.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/doc/OpenSTA.odt -------------------------------------------------------------------------------- /doc/OpenSTA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/doc/OpenSTA.pdf -------------------------------------------------------------------------------- /examples/delay_calc.tcl: -------------------------------------------------------------------------------- 1 | # delay calc example 2 | read_liberty nangate45_slow.lib.gz 3 | read_verilog example1.v 4 | link_design top 5 | create_clock -name clk -period 10 {clk1 clk2 clk3} 6 | set_input_delay -clock clk 0 {in1 in2} 7 | report_checks 8 | -------------------------------------------------------------------------------- /examples/example1.dspef: -------------------------------------------------------------------------------- 1 | *SPEF "IEEE 1481-1998" 2 | *DESIGN "reg1" 3 | *DATE "Fri Nov 20 13:23:00 2002" 4 | *VENDOR "Parallax Software, Inc" 5 | *PROGRAM "Handjob" 6 | *VERSION "1.0.1c" 7 | *DESIGN_FLOW "MISSING_NETS" 8 | *DIVIDER / 9 | *DELIMITER : 10 | *BUS_DELIMITER [ ] 11 | *T_UNIT 1.0 PS 12 | *C_UNIT 1.0 PF 13 | *R_UNIT 1.0 OHM 14 | *L_UNIT 1.0 HENRY 15 | 16 | *POWER_NETS VDD 17 | *GROUND_NETS VSS 18 | 19 | *PORTS 20 | in1 I 21 | in2 I 22 | clk1 I 23 | clk2 I 24 | clk3 I 25 | out O 26 | 27 | *D_NET in1 0.275 28 | *CONN 29 | *P in1 I 30 | *I r1:D I *L .0036 31 | *CAP 32 | 1 in1 .243 33 | 2 r1:D .032 34 | *RES 35 | 3 in1 r1:D 40 36 | *END 37 | 38 | *D_NET in2 0.275 39 | *CONN 40 | *P in2 I 41 | *I r2:D I *L .0036 42 | *CAP 43 | 1 in2 .243 44 | 2 r2:D .032 45 | *RES 46 | 3 in2 r2:D 40 47 | *END 48 | 49 | *D_NET clk1 0.275 50 | *CONN 51 | *P clk1 I 52 | *I r1:CK I *L .0036 53 | *CAP 54 | 1 clk1 .243 55 | 2 r1:CK .032 56 | *RES 57 | 3 clk1 r1:CK 40 58 | *END 59 | 60 | *D_NET clk2 0.275 61 | *CONN 62 | *P clk2 I 63 | *I r2:CK I *L .0036 64 | *CAP 65 | 1 clk2 .243 66 | 2 r2:CK .032 67 | *RES 68 | 3 clk2 r2:CK 40 69 | *END 70 | 71 | *D_NET clk3 0.275 72 | *CONN 73 | *P clk3 I 74 | *I r3:CK I *L .0036 75 | *CAP 76 | 1 clk3 .243 77 | 2 r3:CK .032 78 | *RES 79 | 3 clk3 r3:CK 40 80 | *END 81 | 82 | *D_NET r1q 0.275 83 | *CONN 84 | *I r1:Q O 85 | *I u2:A1 I *L .0086 86 | *CAP 87 | 1 r1:Q .243 88 | 2 u2:A1 .032 89 | *RES 90 | 3 r1:Q u2:A1 40 91 | *END 92 | 93 | *D_NET r2q 0.275 94 | *CONN 95 | *I r2:Q O 96 | *I u1:A I *L .0086 97 | *CAP 98 | 1 r2:Q .243 99 | 2 u1:A .032 100 | *RES 101 | 3 r2:Q u1:A 40 102 | *END 103 | 104 | *D_NET u1z 0.275 105 | *CONN 106 | *I u1:Z O 107 | *I u2:A2 I *L .0086 108 | *CAP 109 | 1 u1:Z .243 110 | 2 u2:A2 .032 111 | *RES 112 | 3 u1:Z u2:A2 40 113 | *END 114 | 115 | *D_NET u2z 0.275 116 | *CONN 117 | *I u2:ZN O 118 | *I r3:D I *L .0086 119 | *CAP 120 | 1 u2:ZN .243 121 | 2 r3:D .032 122 | *RES 123 | 3 u2:ZN r3:D 40 124 | *END 125 | 126 | *D_NET out 0.275 127 | *CONN 128 | *I r3:Q O 129 | *P out O 130 | *CAP 131 | 1 r3:Q .243 132 | 2 out .032 133 | *RES 134 | 3 r3:Q out 40 135 | *END 136 | -------------------------------------------------------------------------------- /examples/example1.v: -------------------------------------------------------------------------------- 1 | module top (in1, in2, clk1, clk2, clk3, out); 2 | input in1, in2, clk1, clk2, clk3; 3 | output out; 4 | wire r1q, r2q, u1z, u2z; 5 | 6 | DFF_X1 r1 (.D(in1), .CK(clk1), .Q(r1q)); 7 | DFF_X1 r2 (.D(in2), .CK(clk2), .Q(r2q)); 8 | BUF_X1 u1 (.A(r2q), .Z(u1z)); 9 | AND2_X1 u2 (.A1(r1q), .A2(u1z), .ZN(u2z)); 10 | DFF_X1 r3 (.D(u2z), .CK(clk3), .Q(out)); 11 | endmodule // top 12 | -------------------------------------------------------------------------------- /examples/gcd_sky130hd.saif.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/examples/gcd_sky130hd.saif.gz -------------------------------------------------------------------------------- /examples/gcd_sky130hd.sdc: -------------------------------------------------------------------------------- 1 | set period 5 2 | create_clock -period $period [get_ports clk] 3 | 4 | set clk_period_factor .2 5 | set delay [expr $period * $clk_period_factor] 6 | set_input_delay $delay -clock clk {req_val reset resp_rdy req_msg[*]} 7 | set_output_delay $delay -clock clk [all_outputs] 8 | 9 | set_input_transition .1 [all_inputs] 10 | -------------------------------------------------------------------------------- /examples/gcd_sky130hd.vcd.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/examples/gcd_sky130hd.vcd.gz -------------------------------------------------------------------------------- /examples/gcd_tb.v: -------------------------------------------------------------------------------- 1 | `define FUNCTIONAL 2 | `define UNIT_DELAY #1 3 | `include "sky130_hd_primitives.v" 4 | `include "sky130_hd.v" 5 | `include "gcd_sky130hd.v" 6 | 7 | `timescale 1 ns / 1 ps 8 | 9 | module gcd_tb(); 10 | parameter clk_period = 5.0; 11 | parameter clk_period2 = clk_period / 2.0; 12 | 13 | reg clk; 14 | reg [15:0] a; 15 | reg [15:0] b; 16 | wire [31:0] req_msg; 17 | reg req_val; 18 | reg resp_rdy; 19 | reg reset; 20 | 21 | wire req_rdy; 22 | wire [15:0] resp_msg; 23 | wire resp_val; 24 | 25 | // gcd inputs share the same bus port (stoopid) 26 | assign req_msg[15:0] = a; 27 | assign req_msg[31:16] = b; 28 | gcd gcd1(.clk(clk), .req_msg(req_msg), .req_rdy(req_rdy), .req_val(req_val), 29 | .reset(reset), .resp_msg(resp_msg), .resp_rdy(resp_rdy), .resp_val(resp_val)); 30 | 31 | initial begin 32 | clk = 0; 33 | a = 0; 34 | b = 0; 35 | req_val = 0; 36 | resp_rdy = 0; 37 | end 38 | 39 | always 40 | #clk_period2 clk = ~clk; 41 | 42 | initial begin 43 | reset = 1; 44 | #clk_period reset = 0; 45 | 46 | #clk_period a = 5; b = 10; req_val = 1; 47 | #clk_period req_val = 0; 48 | #clk_period 49 | #clk_period 50 | #clk_period 51 | #clk_period resp_rdy = 1; 52 | #clk_period resp_rdy = 0; 53 | #clk_period 54 | 55 | #clk_period a = 15; b = 150; req_val = 1; 56 | #clk_period req_val = 0; 57 | #clk_period 58 | #clk_period 59 | #clk_period 60 | #clk_period 61 | #clk_period 62 | #clk_period 63 | #clk_period 64 | #clk_period 65 | #clk_period 66 | #clk_period 67 | #clk_period 68 | #clk_period resp_rdy = 1; 69 | #clk_period resp_rdy = 0; 70 | #clk_period 71 | 72 | $finish; 73 | end 74 | 75 | initial 76 | begin 77 | $dumpfile("gcd_sky130hd.vcd"); 78 | $dumpvars(0, gcd_tb); 79 | end 80 | 81 | endmodule 82 | -------------------------------------------------------------------------------- /examples/min_max_delays.tcl: -------------------------------------------------------------------------------- 1 | # min/max delay calc example 2 | read_liberty -max nangate45_slow.lib.gz 3 | read_liberty -min nangate45_fast.lib.gz 4 | read_verilog example1.v 5 | link_design top 6 | create_clock -name clk -period 10 {clk1 clk2 clk3} 7 | set_input_delay -clock clk 0 {in1 in2} 8 | report_checks -path_delay min_max 9 | -------------------------------------------------------------------------------- /examples/multi_corner.tcl: -------------------------------------------------------------------------------- 1 | # 3 corners with +/- 10% derating example 2 | define_corners ss tt ff 3 | read_liberty -corner ss nangate45_slow.lib.gz 4 | read_liberty -corner tt nangate45_typ.lib.gz 5 | read_liberty -corner ff nangate45_fast.lib.gz 6 | read_verilog example1.v 7 | link_design top 8 | set_timing_derate -early 0.9 9 | set_timing_derate -late 1.1 10 | create_clock -name clk -period 10 {clk1 clk2 clk3} 11 | set_input_delay -clock clk 0 {in1 in2} 12 | # report all corners 13 | report_checks -path_delay min_max 14 | # report typical corner 15 | report_checks -corner tt 16 | -------------------------------------------------------------------------------- /examples/nangate45_fast.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/examples/nangate45_fast.lib.gz -------------------------------------------------------------------------------- /examples/nangate45_slow.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/examples/nangate45_slow.lib.gz -------------------------------------------------------------------------------- /examples/nangate45_typ.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/examples/nangate45_typ.lib.gz -------------------------------------------------------------------------------- /examples/power.tcl: -------------------------------------------------------------------------------- 1 | # report_power gcd 2 | read_liberty sky130hd_tt.lib.gz 3 | read_verilog gcd_sky130hd.v 4 | link_design gcd 5 | 6 | read_sdc gcd_sky130hd.sdc 7 | set_propagated_clock clk 8 | read_spef gcd_sky130hd.spef 9 | set_power_activity -input -activity .1 10 | set_power_activity -input_port reset -activity 0 11 | report_power 12 | -------------------------------------------------------------------------------- /examples/power_vcd.tcl: -------------------------------------------------------------------------------- 1 | # read_vcd_activities gcd 2 | read_liberty sky130hd_tt.lib.gz 3 | read_verilog gcd_sky130hd.v 4 | link_design gcd 5 | read_sdc gcd_sky130hd.sdc 6 | read_spef gcd_sky130hd.spef 7 | # Generate vcd file 8 | # iverilog -o gcd_tb gcd_tb.v 9 | # vvp gcd_tb 10 | read_vcd -scope gcd_tb/gcd1 gcd_sky130hd.vcd.gz 11 | report_activity_annotation 12 | report_power 13 | -------------------------------------------------------------------------------- /examples/sdf_delays.tcl: -------------------------------------------------------------------------------- 1 | # sdf example 2 | read_liberty nangate45_slow.lib.gz 3 | read_verilog example1.v 4 | link_design top 5 | read_sdf example1.sdf 6 | create_clock -name clk -period 10 {clk1 clk2 clk3} 7 | set_input_delay -clock clk 0 {in1 in2} 8 | report_checks 9 | -------------------------------------------------------------------------------- /examples/sky130hd_tt.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/examples/sky130hd_tt.lib.gz -------------------------------------------------------------------------------- /examples/spef_parasitics.tcl: -------------------------------------------------------------------------------- 1 | # delay calc with spef parasitics 2 | read_liberty nangate45_slow.lib.gz 3 | read_verilog example1.v 4 | link_design top 5 | read_spef example1.dspef 6 | create_clock -name clk -period 10 {clk1 clk2 clk3} 7 | set_input_delay -clock clk 0 {in1 in2} 8 | report_checks 9 | -------------------------------------------------------------------------------- /graph/Delay.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "Machine.hh" 26 | #include "StringUtil.hh" 27 | #include "Units.hh" 28 | #include "StaState.hh" 29 | #include "Delay.hh" 30 | 31 | namespace sta { 32 | 33 | const char * 34 | delayAsString(const Delay &delay, 35 | const StaState *sta) 36 | { 37 | return delayAsString(delay, sta, sta->units()->timeUnit()->digits()); 38 | } 39 | 40 | } // namespace 41 | -------------------------------------------------------------------------------- /include/sta/Bdd.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | #include "StaState.hh" 30 | #include "LibertyClass.hh" 31 | 32 | struct DdNode; 33 | struct DdManager; 34 | 35 | namespace sta { 36 | 37 | typedef std::map BddPortVarMap; 38 | typedef std::map BddVarIdxPortMap; 39 | 40 | class Bdd : public StaState 41 | { 42 | public: 43 | Bdd(const StaState *sta); 44 | ~Bdd(); 45 | DdNode *funcBdd(const FuncExpr *expr); 46 | DdNode *findNode(const LibertyPort *port); 47 | const LibertyPort *nodePort(DdNode *node); 48 | DdNode *ensureNode(const LibertyPort *port); 49 | const LibertyPort *varIndexPort(int var_index); 50 | BddPortVarMap &portVarMap() { return bdd_port_var_map_; } 51 | 52 | void clearVarMap(); 53 | DdManager *cuddMgr() const { return cudd_mgr_; } 54 | 55 | private: 56 | DdManager *cudd_mgr_; 57 | BddPortVarMap bdd_port_var_map_; 58 | BddVarIdxPortMap bdd_var_idx_port_map_; 59 | }; 60 | 61 | } // namespace 62 | -------------------------------------------------------------------------------- /include/sta/CircuitSim.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | enum class CircuitSim { hspice, ngspice, xyce }; 30 | 31 | } // namespace 32 | -------------------------------------------------------------------------------- /include/sta/ClockGatingCheck.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "SdcClass.hh" 28 | #include "RiseFallMinMax.hh" 29 | 30 | namespace sta { 31 | 32 | class ClockGatingCheck 33 | { 34 | public: 35 | ClockGatingCheck(); 36 | RiseFallMinMax *margins() { return &margins_; } 37 | void setActiveValue(LogicValue value); 38 | LogicValue activeValue() const { return active_value_; } 39 | 40 | private: 41 | RiseFallMinMax margins_; 42 | LogicValue active_value_; 43 | }; 44 | 45 | } // namespace 46 | -------------------------------------------------------------------------------- /include/sta/ClockGroups.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "SdcCmdComment.hh" 28 | #include "SdcClass.hh" 29 | 30 | namespace sta { 31 | 32 | class ClockGroups : public SdcCmdComment 33 | { 34 | public: 35 | ClockGroups(const char *name, 36 | bool logically_exclusive, 37 | bool physically_exclusive, 38 | bool asynchronous, 39 | bool allow_paths, 40 | const char *comment); 41 | ~ClockGroups(); 42 | void makeClockGroup(ClockSet *clks); 43 | const char *name() const { return name_; } 44 | ClockGroupSet *groups() { return &groups_; } 45 | bool logicallyExclusive() const { return logically_exclusive_; } 46 | bool physicallyExclusive() const { return physically_exclusive_; } 47 | bool asynchronous() const { return asynchronous_; } 48 | bool allowPaths() const { return allow_paths_; } 49 | void removeClock(Clock *clk); 50 | 51 | private: 52 | const char *name_; 53 | bool logically_exclusive_; 54 | bool physically_exclusive_; 55 | bool asynchronous_; 56 | bool allow_paths_; 57 | ClockGroupSet groups_; 58 | }; 59 | 60 | } // namespace 61 | -------------------------------------------------------------------------------- /include/sta/ClockLatency.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "MinMax.hh" 28 | #include "NetworkClass.hh" 29 | #include "Transition.hh" 30 | #include "SdcClass.hh" 31 | #include "RiseFallMinMax.hh" 32 | 33 | namespace sta { 34 | 35 | class ClockLatency 36 | { 37 | public: 38 | ClockLatency(const Clock *clk, 39 | const Pin *pin); 40 | const Clock *clock() const { return clk_; } 41 | const Pin *pin() const { return pin_; } 42 | float delay(const RiseFall *rf, 43 | const MinMax *min_max); 44 | void delay(const RiseFall *rf, 45 | const MinMax *min_max, 46 | // Return values. 47 | float &latency, 48 | bool &exists); 49 | RiseFallMinMax *delays(); 50 | void setDelay(const RiseFall *rf, 51 | const MinMax *min_max, 52 | float delay); 53 | void setDelay(const RiseFallBoth *rf, 54 | const MinMaxAll *min_max, 55 | float delay); 56 | void setDelays(RiseFallMinMax *delays); 57 | 58 | private: 59 | const Clock *clk_; 60 | const Pin *pin_; 61 | RiseFallMinMax delays_; 62 | }; 63 | 64 | } // namespace 65 | -------------------------------------------------------------------------------- /include/sta/Delay.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "StaConfig.hh" 28 | 29 | #if (SSTA == 1) 30 | // Delays are Normal PDFs. 31 | #include "DelayNormal1.hh" 32 | #elif (SSTA == 2) 33 | // Delays are Normal PDFs with early/late sigma. 34 | #include "DelayNormal2.hh" 35 | #else 36 | // Delays are floats. 37 | #include "DelayFloat.hh" 38 | #endif 39 | 40 | namespace sta { 41 | 42 | typedef Delay ArcDelay; 43 | typedef Delay Slew; 44 | typedef Delay Arrival; 45 | typedef Delay Required; 46 | typedef Delay Slack; 47 | 48 | } // namespace 49 | -------------------------------------------------------------------------------- /include/sta/DelayCalc.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "StringSeq.hh" 28 | 29 | namespace sta { 30 | 31 | class ArcDelayCalc; 32 | class StaState; 33 | 34 | typedef ArcDelayCalc *(*MakeArcDelayCalc)(StaState *sta); 35 | 36 | // Register builtin delay calculators. 37 | void 38 | registerDelayCalcs(); 39 | // Register a delay calculator for the set_delay_calc command. 40 | void 41 | registerDelayCalc(const char *name, 42 | MakeArcDelayCalc maker); 43 | bool 44 | isDelayCalcName(const char *name); 45 | StringSeq 46 | delayCalcNames(); 47 | void 48 | deleteDelayCalcs(); 49 | 50 | // Make a registered delay calculator by name. 51 | ArcDelayCalc * 52 | makeDelayCalc(const char *name, 53 | StaState *sta); 54 | 55 | } // namespace 56 | -------------------------------------------------------------------------------- /include/sta/DispatchQueue.hh: -------------------------------------------------------------------------------- 1 | // Author Phillip Johnston 2 | // Licensed under CC0 1.0 Universal 3 | // https://github.com/embeddedartistry/embedded-resources/blob/master/examples/cpp/dispatch.cpp 4 | // https://embeddedartistry.com/blog/2017/2/1/dispatch-queues?rq=dispatch 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace sta { 18 | 19 | class DispatchQueue 20 | { 21 | typedef std::function fp_t; 22 | 23 | public: 24 | DispatchQueue(size_t thread_cnt); 25 | ~DispatchQueue(); 26 | void setThreadCount(size_t thread_count); 27 | // Dispatch and copy. 28 | void dispatch(const fp_t& op); 29 | // Dispatch and move. 30 | void dispatch(fp_t&& op); 31 | void finishTasks(); 32 | 33 | // Deleted operations 34 | DispatchQueue(const DispatchQueue& rhs) = delete; 35 | DispatchQueue& operator=(const DispatchQueue& rhs) = delete; 36 | DispatchQueue(DispatchQueue&& rhs) = delete; 37 | DispatchQueue& operator=(DispatchQueue&& rhs) = delete; 38 | 39 | private: 40 | void dispatch_thread_handler(size_t i); 41 | void terminateThreads(); 42 | 43 | std::mutex lock_; 44 | std::vector threads_; 45 | std::queue q_; 46 | std::condition_variable cv_; 47 | std::atomic pending_task_count_; 48 | bool quit_ = false; 49 | }; 50 | 51 | } // namespace 52 | -------------------------------------------------------------------------------- /include/sta/Fuzzy.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | // "Fuzzy" floating point comparisons that allow some tolerance. 30 | 31 | bool 32 | fuzzyEqual(float v1, 33 | float v2); 34 | bool 35 | fuzzyZero(float v); 36 | bool 37 | fuzzyLess(float v1, 38 | float v2); 39 | bool 40 | fuzzyLessEqual(float v1, 41 | float v2); 42 | bool 43 | fuzzyGreater(float v1, 44 | float v2); 45 | bool 46 | fuzzyGreaterEqual(float v1, 47 | float v2); 48 | bool 49 | fuzzyInf(float value); 50 | 51 | } // namespace 52 | -------------------------------------------------------------------------------- /include/sta/GraphCmp.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "NetworkClass.hh" 28 | #include "NetworkCmp.hh" 29 | #include "GraphClass.hh" 30 | 31 | namespace sta { 32 | 33 | class VertexNameLess 34 | { 35 | public: 36 | explicit VertexNameLess(Network *network); 37 | bool operator()(const Vertex *vertex1, 38 | const Vertex *vertex2); 39 | 40 | private: 41 | Network *network_; 42 | }; 43 | 44 | class EdgeLess 45 | { 46 | public: 47 | EdgeLess(const Network *network, 48 | Graph *&graph); 49 | bool operator()(const Edge *edge1, 50 | const Edge *edge2) const; 51 | 52 | private: 53 | const PinPathNameLess pin_less_; 54 | Graph *&graph_; 55 | }; 56 | 57 | void 58 | sortEdges(EdgeSeq *edges, 59 | Network *network, 60 | Graph *graph); 61 | 62 | } // namespace 63 | -------------------------------------------------------------------------------- /include/sta/Hash.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | #include 29 | 30 | namespace sta { 31 | 32 | const size_t hash_init_value = 5381; 33 | 34 | // Dan Bernstein, comp.lang.c. 35 | inline size_t 36 | hashSum(size_t hash, 37 | size_t add) 38 | { 39 | // hash * 31 ^ add. 40 | return ((hash << 5) + hash) ^ add; 41 | } 42 | 43 | inline void 44 | hashIncr(size_t &hash, 45 | size_t add) 46 | { 47 | // hash * 31 ^ add. 48 | hash = ((hash << 5) + hash) ^ add; 49 | } 50 | 51 | inline size_t 52 | nextMersenne(size_t n) 53 | { 54 | return (n + 1) * 2 - 1; 55 | } 56 | 57 | // Sadly necessary until c++ std::hash works for char *. 58 | size_t 59 | hashString(const char *str); 60 | 61 | // Pointer hashing is strongly discouraged because it causes results to change 62 | // from run to run. Use Network::id functions instead. 63 | #if __WORDSIZE == 64 64 | #define hashPtr(ptr) (reinterpret_cast(ptr) >> 3) 65 | #else 66 | #define hashPtr(ptr) (reinterpret_cast(ptr) >> 2) 67 | #endif 68 | 69 | } // namespace 70 | -------------------------------------------------------------------------------- /include/sta/Iterator.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | // Java style container iterator. 30 | // Iterator iter(container); 31 | // while (iter.hasNext()) { 32 | // Object *obj = iter.next(); 33 | // } 34 | template 35 | class Iterator 36 | { 37 | public: 38 | virtual ~Iterator() {} 39 | virtual bool hasNext() = 0; 40 | virtual OBJ next() = 0; 41 | }; 42 | 43 | } // namespace 44 | -------------------------------------------------------------------------------- /include/sta/LeakagePower.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "LibertyClass.hh" 28 | 29 | namespace sta { 30 | 31 | class LeakagePowerAttrs; 32 | 33 | class LeakagePowerAttrs 34 | { 35 | public: 36 | LeakagePowerAttrs(); 37 | FuncExpr *when() const { return when_; } 38 | FuncExpr *&whenRef() { return when_; } 39 | float power() { return power_; } 40 | void setPower(float power); 41 | 42 | protected: 43 | FuncExpr *when_; 44 | float power_; 45 | }; 46 | 47 | class LeakagePower 48 | { 49 | public: 50 | LeakagePower(LibertyCell *cell, 51 | LeakagePowerAttrs *attrs); 52 | ~LeakagePower(); 53 | LibertyCell *libertyCell() const { return cell_; } 54 | FuncExpr *when() const { return when_; } 55 | float power() { return power_; } 56 | 57 | protected: 58 | LibertyCell *cell_; 59 | FuncExpr *when_; 60 | float power_; 61 | }; 62 | 63 | } // namespace 64 | -------------------------------------------------------------------------------- /include/sta/LibertyWriter.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "LibertyClass.hh" 28 | 29 | namespace sta { 30 | 31 | class StaState; 32 | 33 | void 34 | writeLiberty(LibertyLibrary *lib, 35 | const char *filename, 36 | StaState *sta); 37 | 38 | } // namespace 39 | -------------------------------------------------------------------------------- /include/sta/MakeConcreteNetwork.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class NetworkReader; 30 | 31 | NetworkReader * 32 | makeConcreteNetwork(); 33 | 34 | } // namespace 35 | -------------------------------------------------------------------------------- /include/sta/MakeConcreteParasitics.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | Parasitics * 30 | makeConcreteParasitics(StaState *sta); 31 | 32 | } // namespace 33 | -------------------------------------------------------------------------------- /include/sta/Mutex.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace sta { 30 | 31 | // Hide a bit of the std verbosity. 32 | typedef std::lock_guard LockGuard; 33 | 34 | } // namespace 35 | -------------------------------------------------------------------------------- /include/sta/ObjectId.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace sta { 30 | 31 | // ObjectId is block index and object index within the block. 32 | typedef uint32_t ObjectId; 33 | // Block index. 34 | typedef uint32_t BlockIdx; 35 | // Object index within a block. 36 | typedef uint32_t ObjectIdx; 37 | 38 | static constexpr int object_id_bits = sizeof(ObjectId) * 8; 39 | static constexpr BlockIdx block_idx_null = 0; 40 | static constexpr ObjectId object_id_null = 0; 41 | static constexpr ObjectIdx object_idx_null = 0; 42 | 43 | } // Namespace 44 | -------------------------------------------------------------------------------- /include/sta/ParasiticsClass.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Parasitics; 30 | class Parasitic; 31 | class ParasiticNode; 32 | class ParasiticAnalysisPt; 33 | class ParasiticResistor; 34 | class ParasiticCapacitor; 35 | 36 | } // namespace 37 | -------------------------------------------------------------------------------- /include/sta/PinPair.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "Hash.hh" 28 | #include "Set.hh" 29 | #include "NetworkClass.hh" 30 | 31 | namespace sta { 32 | 33 | typedef std::pair PinPair; 34 | 35 | class PinPairLess 36 | { 37 | public: 38 | PinPairLess(const Network *network); 39 | bool operator()(const PinPair &pair1, 40 | const PinPair &pair2) const; 41 | 42 | private: 43 | const Network *network_; 44 | }; 45 | 46 | 47 | class PinPairSet : public Set 48 | { 49 | public: 50 | PinPairSet(const Network *network); 51 | }; 52 | 53 | class PinPairHash 54 | { 55 | public: 56 | PinPairHash(const Network *network); 57 | size_t operator()(const PinPair &pair) const; 58 | 59 | private: 60 | const Network *network_; 61 | }; 62 | 63 | class PinPairEqual 64 | { 65 | public: 66 | bool operator()(const PinPair &pair1, 67 | const PinPair &pair2) const; 68 | }; 69 | 70 | } // namespace 71 | -------------------------------------------------------------------------------- /include/sta/ReportStd.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Report; 30 | 31 | // Make output streams that talk to stdout and stderr. 32 | // This is useful for applications that do not link tcl. 33 | Report * 34 | makeReportStd(); 35 | 36 | } // namespace 37 | -------------------------------------------------------------------------------- /include/sta/RiseFallValues.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "Transition.hh" 28 | 29 | namespace sta { 30 | 31 | // Rise/fall group of two values. 32 | class RiseFallValues 33 | { 34 | public: 35 | RiseFallValues(); 36 | explicit RiseFallValues(float init_value); 37 | float value(const RiseFall *rf) const; 38 | void value(const RiseFall *rf, 39 | float &value, bool &exists) const; 40 | bool hasValue(const RiseFall *rf) const; 41 | void setValue(const RiseFallBoth *rf, float value); 42 | void setValue(const RiseFall *rf, float value); 43 | void setValue(float value); 44 | void setValues(RiseFallValues *values); 45 | void clear(); 46 | 47 | private: 48 | float values_[RiseFall::index_count]; 49 | bool exists_[RiseFall::index_count]; 50 | }; 51 | 52 | } // namespace 53 | -------------------------------------------------------------------------------- /include/sta/SdcCmdComment.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class SdcCmdComment 30 | { 31 | public: 32 | SdcCmdComment(); 33 | SdcCmdComment(const char *comment); 34 | const char *comment() { return comment_; } 35 | void setComment(const char *comment); 36 | 37 | protected: 38 | // Destructor is protected to prevent deletion of a derived 39 | // class with a pointer to this base class. 40 | ~SdcCmdComment(); 41 | 42 | char *comment_; 43 | }; 44 | 45 | } // namespace 46 | -------------------------------------------------------------------------------- /include/sta/Stats.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include // size_t 28 | 29 | namespace sta { 30 | 31 | class Debug; 32 | class Report; 33 | 34 | // Show run time and memory statistics if the "stats" debug flag is on. 35 | class Stats 36 | { 37 | public: 38 | explicit Stats(Debug *debug, 39 | Report *report); 40 | void report(const char *step); 41 | 42 | private: 43 | double elapsed_begin_; 44 | double user_begin_; 45 | double system_begin_; 46 | size_t memory_begin_; 47 | Debug *debug_; 48 | Report *report_; 49 | }; 50 | 51 | } // namespace 52 | -------------------------------------------------------------------------------- /include/sta/StringSeq.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "StringUtil.hh" 28 | #include "Vector.hh" 29 | 30 | namespace sta { 31 | 32 | typedef Vector StringSeq; 33 | 34 | void 35 | deleteContents(StringSeq *strings); 36 | 37 | } // namespace 38 | -------------------------------------------------------------------------------- /include/sta/StringSet.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | #pragma once 25 | 26 | #include 27 | 28 | #include "StringUtil.hh" 29 | #include "Set.hh" 30 | 31 | namespace sta { 32 | 33 | typedef Set StringSet; 34 | typedef std::set StdStringSet; 35 | 36 | void 37 | deleteContents(StringSet *strings); 38 | 39 | } // namespace 40 | -------------------------------------------------------------------------------- /include/sta/TclTypeHelpers.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "ArcDelayCalc.hh" 26 | #include "StringSet.hh" 27 | #include "StringSeq.hh" 28 | 29 | #include 30 | 31 | namespace sta { 32 | 33 | #if TCL_MAJOR_VERSION < 9 34 | typedef int Tcl_Size; 35 | #endif 36 | 37 | StringSet * 38 | tclListSetConstChar(Tcl_Obj *const source, 39 | Tcl_Interp *interp); 40 | 41 | StringSeq * 42 | tclListSeqConstChar(Tcl_Obj *const source, 43 | Tcl_Interp *interp); 44 | 45 | StdStringSet * 46 | tclListSetStdString(Tcl_Obj *const source, 47 | Tcl_Interp *interp); 48 | 49 | void 50 | tclArgError(Tcl_Interp *interp, 51 | int id, 52 | const char *msg, 53 | const char *arg); 54 | 55 | void 56 | objectListNext(const char *list, 57 | const char *type, 58 | // Return values. 59 | bool &type_match, 60 | const char *&next); 61 | 62 | Tcl_Obj * 63 | tclArcDcalcArg(ArcDcalcArg &gate, 64 | Tcl_Interp *interp); 65 | 66 | ArcDcalcArg 67 | arcDcalcArgTcl(Tcl_Obj *obj, 68 | Tcl_Interp *interp); 69 | 70 | } // namespace 71 | -------------------------------------------------------------------------------- /include/sta/TokenParser.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | // Iterate over the tokens in str separated by character sep. 30 | // Similar in functionality to strtok, but does not leave the string 31 | // side-effected. This is preferable to using strtok because it leaves 32 | // string terminators where the separators were. 33 | // Using STL string functions to parse tokens is messy and extremely slow 34 | // on the RogueWave/Solaris implementation, apparently because of mutexes 35 | // on temporary strings. 36 | class TokenParser 37 | { 38 | public: 39 | TokenParser(const char *str, 40 | const char *delimiters); 41 | bool hasNext(); 42 | char *next(); 43 | 44 | private: 45 | const char *delimiters_; 46 | char *token_; 47 | char *token_end_; 48 | char token_delimiter_; 49 | bool first_; 50 | }; 51 | 52 | } // namespace 53 | -------------------------------------------------------------------------------- /include/sta/VerilogNamespace.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace sta { 30 | 31 | std::string 32 | cellVerilogName(const char *sta_name); 33 | std::string 34 | instanceVerilogName(const char *sta_name); 35 | std::string 36 | netVerilogName(const char *sta_name); 37 | std::string 38 | portVerilogName(const char *sta_name); 39 | 40 | std::string 41 | moduleVerilogToSta(const std::string *sta_name); 42 | std::string 43 | instanceVerilogToSta(const std::string *sta_name); 44 | std::string 45 | netVerilogToSta(const std::string *sta_name); 46 | std::string 47 | portVerilogToSta(const std::string *sta_name); 48 | 49 | } // namespace 50 | -------------------------------------------------------------------------------- /include/sta/VerilogWriter.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "NetworkClass.hh" 28 | 29 | namespace sta { 30 | 31 | void 32 | writeVerilog(const char *filename, 33 | bool sort, 34 | bool include_pwr_gnd, 35 | CellSeq *remove_cells, 36 | Network *network); 37 | 38 | } // namespace 39 | -------------------------------------------------------------------------------- /include/sta/VertexId.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "ObjectId.hh" 28 | 29 | // VertexId typedef for Networks to get/set on pins. 30 | 31 | namespace sta { 32 | 33 | typedef ObjectId VertexId; 34 | 35 | static constexpr VertexId vertex_id_null = object_id_null; 36 | 37 | } // namespace 38 | -------------------------------------------------------------------------------- /include/sta/VertexVisitor.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "NetworkClass.hh" 28 | #include "GraphClass.hh" 29 | 30 | namespace sta { 31 | 32 | // Abstract base class for visiting a vertex. 33 | class VertexVisitor 34 | { 35 | public: 36 | VertexVisitor() {} 37 | virtual ~VertexVisitor() {} 38 | virtual VertexVisitor *copy() const = 0; 39 | virtual void visit(Vertex *vertex) = 0; 40 | void operator()(Vertex *vertex) { visit(vertex); } 41 | virtual void levelFinished() {} 42 | }; 43 | 44 | // Collect visited pins into a PinSet. 45 | class VertexPinCollector : public VertexVisitor 46 | { 47 | public: 48 | VertexPinCollector(PinSet &pins); 49 | const PinSet &pins() const { return pins_; } 50 | void visit(Vertex *vertex); 51 | virtual VertexVisitor *copy() const; 52 | 53 | protected: 54 | PinSet &pins_; 55 | }; 56 | 57 | } // namespace 58 | -------------------------------------------------------------------------------- /include/sta/WriteSdc.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "NetworkClass.hh" 28 | #include "SdcClass.hh" 29 | 30 | namespace sta { 31 | 32 | // Write SDC to a file. 33 | // Allow SDC to apply to an instance to support write_context. 34 | void 35 | writeSdc(Instance *instance, 36 | const char *filename, 37 | const char *creator, 38 | // Map hierarchical pins and instances to leaf pins and instances. 39 | bool map_hpins, 40 | // Replace non-sdc get functions with OpenSTA equivalents. 41 | bool native, 42 | int digits, 43 | bool gzip, 44 | bool no_timestamp, 45 | Sdc *sdc); 46 | 47 | } // namespace 48 | -------------------------------------------------------------------------------- /include/sta/Zlib.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | // The zlib package is optional. 28 | // Define stdio based macros if it is missing. 29 | 30 | #include "StaConfig.hh" // ZLIB 31 | 32 | #ifdef ZLIB_FOUND 33 | 34 | #include 35 | #include "util/gzstream.hh" 36 | 37 | #else // ZLIB_FOUND 38 | 39 | #include 40 | #include 41 | 42 | #define gzFile FILE* 43 | #define gzopen fopen 44 | #define gzclose fclose 45 | #define gzgets(stream,s,size) fgets(s,size,stream) 46 | #define gzprintf fprintf 47 | #define Z_NULL nullptr 48 | 49 | namespace gzstream { 50 | typedef std::ifstream igzstream; 51 | } 52 | 53 | #endif // ZLIB_FOUND 54 | -------------------------------------------------------------------------------- /jenkins/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | set -e 4 | cmake -B build . 5 | cmake --build build -j 8 6 | -------------------------------------------------------------------------------- /jenkins/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | set -e 4 | mkdir -p /OpenSTA/build 5 | cd /OpenSTA/build 6 | cmake .. 7 | make -j 4 8 | -------------------------------------------------------------------------------- /jenkins/test.sh: -------------------------------------------------------------------------------- 1 | docker run -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/OpenSTA openroad/opensta bash -c "/OpenSTA/test/regression" 2 | -------------------------------------------------------------------------------- /liberty/LeakagePower.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "LeakagePower.hh" 26 | 27 | #include "FuncExpr.hh" 28 | #include "TableModel.hh" 29 | #include "Liberty.hh" 30 | 31 | namespace sta { 32 | 33 | LeakagePowerAttrs::LeakagePowerAttrs() : 34 | when_(nullptr), 35 | power_(0.0) 36 | { 37 | } 38 | 39 | void 40 | LeakagePowerAttrs::setPower(float power) 41 | { 42 | power_ = power; 43 | } 44 | 45 | //////////////////////////////////////////////////////////////// 46 | 47 | LeakagePower::LeakagePower(LibertyCell *cell, 48 | LeakagePowerAttrs *attrs) : 49 | cell_(cell), 50 | when_(attrs->when()), 51 | power_(attrs->power()) 52 | { 53 | cell->addLeakagePower(this); 54 | } 55 | 56 | LeakagePower::~LeakagePower() 57 | { 58 | if (when_) 59 | when_->deleteSubexprs(); 60 | } 61 | 62 | } // namespace 63 | -------------------------------------------------------------------------------- /liberty/LibExprReader.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Report; 30 | class FuncExpr; 31 | class LibertyCell; 32 | 33 | FuncExpr * 34 | parseFuncExpr(const char *func, 35 | LibertyCell *cell, 36 | const char *error_msg, 37 | Report *report); 38 | 39 | } // namespace 40 | -------------------------------------------------------------------------------- /liberty/LibExprReaderPvt.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Report; 30 | class LibertyCell; 31 | class FuncExpr; 32 | class LibExprScanner; 33 | 34 | class LibExprReader 35 | { 36 | public: 37 | LibExprReader(const char *func, 38 | LibertyCell *cell, 39 | const char *error_msg, 40 | Report *report); 41 | FuncExpr *makeFuncExprPort(const char *port_name); 42 | FuncExpr *makeFuncExprOr(FuncExpr *arg1, 43 | FuncExpr *arg2); 44 | FuncExpr *makeFuncExprAnd(FuncExpr *arg1, 45 | FuncExpr *arg2); 46 | FuncExpr *makeFuncExprXor(FuncExpr *arg1, 47 | FuncExpr *arg2); 48 | FuncExpr *makeFuncExprNot(FuncExpr *arg); 49 | void setResult(FuncExpr *result); 50 | FuncExpr *result() { return result_; } 51 | void parseError(const char *msg); 52 | size_t copyInput(char *buf, 53 | size_t max_size); 54 | Report *report() const { return report_; } 55 | 56 | private: 57 | const char *func_; 58 | LibertyCell *cell_; 59 | const char *error_msg_; 60 | Report *report_; 61 | FuncExpr *result_; 62 | }; 63 | 64 | } // namespace 65 | -------------------------------------------------------------------------------- /liberty/LibExprScanner.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | #include "LibExprParse.hh" 30 | 31 | #ifndef __FLEX_LEXER_H 32 | #undef yyFlexLexer 33 | #define yyFlexLexer LibExprFlexLexer 34 | #include 35 | #endif 36 | 37 | namespace sta { 38 | 39 | class Report; 40 | class LibExprParse; 41 | 42 | class LibExprScanner : public LibExprFlexLexer 43 | { 44 | public: 45 | LibExprScanner(std::istringstream &stream); 46 | virtual ~LibExprScanner() {} 47 | 48 | virtual int lex(LibExprParse::semantic_type *const yylval); 49 | // YY_DECL defined in LibertyLex.ll 50 | // Method body created by flex in LibertyLex.cc 51 | 52 | // Get rid of override virtual function warning. 53 | using FlexLexer::yylex; 54 | 55 | private: 56 | Report *report_; 57 | std::string token_; 58 | }; 59 | 60 | } // namespace 61 | -------------------------------------------------------------------------------- /liberty/Liberty.tcl: -------------------------------------------------------------------------------- 1 | # OpenSTA, Static Timing Analyzer 2 | # Copyright (c) 2025, Parallax Software, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | # The origin of this software must not be misrepresented; you must not 18 | # claim that you wrote the original software. 19 | # 20 | # Altered source versions must be plainly marked as such, and must not be 21 | # misrepresented as being the original software. 22 | # 23 | # This notice may not be removed or altered from any source distribution. 24 | 25 | # Liberty commands. 26 | 27 | namespace eval sta { 28 | 29 | define_cmd_args "read_liberty" \ 30 | {[-corner corner] [-min] [-max] [-infer_latches] filename} 31 | 32 | proc_redirect read_liberty { 33 | parse_key_args "read_liberty" args keys {-corner} \ 34 | flags {-min -max -infer_latches} 35 | check_argc_eq1 "read_liberty" $args 36 | 37 | set filename [file nativename [lindex $args 0]] 38 | set corner [parse_corner keys] 39 | set min_max [parse_min_max_all_flags flags] 40 | set infer_latches [info exists flags(-infer_latches)] 41 | read_liberty_cmd $filename $corner $min_max $infer_latches 42 | } 43 | 44 | # for regression testing 45 | proc write_liberty { args } { 46 | check_argc_eq2 "write_liberty" $args 47 | 48 | set library [get_liberty_error "library" [lindex $args 0]] 49 | set filename [file nativename [lindex $args 1]] 50 | write_liberty_cmd $library $filename 51 | } 52 | 53 | # sta namespace end 54 | } 55 | -------------------------------------------------------------------------------- /liberty/LibertyReader.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Network; 30 | class LibertyLibrary; 31 | 32 | LibertyLibrary * 33 | readLibertyFile(const char *filename, 34 | bool infer_latches, 35 | Network *network); 36 | 37 | } // namespace 38 | -------------------------------------------------------------------------------- /liberty/TimingModel.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "TimingModel.hh" 26 | 27 | namespace sta { 28 | 29 | GateTimingModel::GateTimingModel(LibertyCell *cell) : 30 | TimingModel(cell) 31 | { 32 | } 33 | 34 | CheckTimingModel::CheckTimingModel(LibertyCell *cell) : 35 | TimingModel(cell) 36 | { 37 | } 38 | 39 | } // namespace 40 | -------------------------------------------------------------------------------- /network/Link.tcl: -------------------------------------------------------------------------------- 1 | # OpenSTA, Static Timing Analyzer 2 | # Copyright (c) 2025, Parallax Software, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | # The origin of this software must not be misrepresented; you must not 18 | # claim that you wrote the original software. 19 | # 20 | # Altered source versions must be plainly marked as such, and must not be 21 | # misrepresented as being the original software. 22 | # 23 | # This notice may not be removed or altered from any source distribution. 24 | 25 | # Network commands. 26 | 27 | namespace eval sta { 28 | 29 | define_cmd_args "link_design" {[-no_black_boxes]\ 30 | [top_cell_name]} 31 | 32 | proc_redirect link_design { 33 | variable current_design_name 34 | 35 | parse_key_args "link_design" args keys {} flags {-no_black_boxes} 36 | check_argc_eq0or1 "link_design" $args 37 | if { $args == "" } { 38 | set top_cell_name "" 39 | } else { 40 | set top_cell_name [lindex $args 0] 41 | } 42 | if { $top_cell_name == "" } { 43 | if { $current_design_name == "" } { 44 | sta_error 220 "missing top_cell_name argument and no current_design." 45 | return 0 46 | } else { 47 | set top_cell_name $current_design_name 48 | } 49 | } 50 | set make_black_boxes 1 51 | if { [info exists flags(-no_black_boxes)] } { 52 | set make_black_boxes 0 53 | } 54 | link_design_cmd $top_cell_name $make_black_boxes 55 | } 56 | 57 | # sta namespace end 58 | } 59 | -------------------------------------------------------------------------------- /parasitics/ReduceParasitics.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "NetworkClass.hh" 28 | #include "SdcClass.hh" 29 | 30 | namespace sta { 31 | 32 | class Corner; 33 | class Parasitic; 34 | class ParasiticAnalysisPt; 35 | class StaState; 36 | 37 | // Reduce parasitic network to pi elmore model for drvr_pin. 38 | Parasitic * 39 | reduceToPiElmore(const Parasitic *parasitic_network, 40 | const Pin *drvr_pin, 41 | const RiseFall *rf, 42 | float coupling_cap_factor, 43 | const Corner *corner, 44 | const MinMax *min_max, 45 | const ParasiticAnalysisPt *ap, 46 | StaState *sta); 47 | 48 | // Reduce parasitic network to pi and 2nd order pole/residue models 49 | // for drvr_pin. 50 | Parasitic * 51 | reduceToPiPoleResidue2(const Parasitic *parasitic_network, 52 | const Pin *drvr_pin, 53 | const RiseFall *rf, 54 | float coupling_cap_factor, 55 | const Corner *corner, 56 | const MinMax *min_max, 57 | const ParasiticAnalysisPt *ap, 58 | StaState *sta); 59 | 60 | } // namespace 61 | -------------------------------------------------------------------------------- /parasitics/ReportParasiticAnnotation.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class StaState; 30 | class Corner; 31 | 32 | void 33 | reportParasiticAnnotation(bool report_unannotated, 34 | const Corner *corner, 35 | StaState *sta); 36 | 37 | } // namespace 38 | -------------------------------------------------------------------------------- /parasitics/SpefNamespace.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | // Translate from spf/spef namespace to sta namespace. 30 | // Caller owns the result string. 31 | char * 32 | spefToSta(const char *token, char spef_divider, 33 | char path_escape, char path_divider); 34 | // Translate from sta namespace to spf/spef namespace. 35 | // Caller owns the result string. 36 | char * 37 | staToSpef(const char *token, char spef_divider, 38 | char path_divider, char path_escape); 39 | 40 | 41 | } // namespace 42 | -------------------------------------------------------------------------------- /parasitics/SpefReader.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "Zlib.hh" 28 | #include "MinMax.hh" 29 | #include "ParasiticsClass.hh" 30 | 31 | namespace sta { 32 | 33 | class ParasiticAnalysisPt; 34 | class Instance; 35 | class Corner; 36 | class OperatingConditions; 37 | class StaState; 38 | 39 | // Read a file single value parasitics into analysis point ap. 40 | // In a Spef file with triplet values the first value is used. 41 | // Constraint min/max cnst_min_max and operating condition op_cond 42 | // are used for parasitic network reduction. 43 | // Return true if successful. 44 | bool 45 | readSpefFile(const char *filename, 46 | Instance *instance, 47 | ParasiticAnalysisPt *ap, 48 | bool pin_cap_included, 49 | bool keep_coupling_caps, 50 | float coupling_cap_factor, 51 | bool reduce, 52 | const Corner *corner, 53 | const MinMaxAll *min_max, 54 | StaState *sta); 55 | 56 | } // namespace 57 | -------------------------------------------------------------------------------- /parasitics/SpefScanner.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "SpefLocation.hh" 28 | #include "SpefParse.hh" 29 | 30 | #ifndef __FLEX_LEXER_H 31 | #undef yyFlexLexer 32 | #define yyFlexLexer SpefFlexLexer 33 | #include 34 | #endif 35 | 36 | namespace sta { 37 | 38 | class Report; 39 | 40 | class SpefScanner : public SpefFlexLexer 41 | { 42 | public: 43 | SpefScanner(std::istream *stream, 44 | const std::string &filename, 45 | SpefReader *reader, 46 | Report *report); 47 | virtual ~SpefScanner() {} 48 | 49 | virtual int lex(SpefParse::semantic_type *const yylval, 50 | SpefParse::location_type *yylloc); 51 | // YY_DECL defined in SpefLex.ll 52 | // Method body created by flex in SpefLex.cc 53 | 54 | void error(const char *msg); 55 | int line() const { return yylineno; } 56 | 57 | // Get rid of override virtual function warning. 58 | using FlexLexer::yylex; 59 | 60 | private: 61 | std::string filename_; 62 | SpefReader *reader_; 63 | Report *report_; 64 | std::string token_; 65 | }; 66 | 67 | } // namespace 68 | -------------------------------------------------------------------------------- /power/SaifReader.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Sta; 30 | 31 | bool 32 | readSaif(const char *filename, 33 | const char *scope, 34 | Sta *sta); 35 | 36 | } // namespace 37 | -------------------------------------------------------------------------------- /power/SaifScanner.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "SaifLocation.hh" 28 | #include "SaifParse.hh" 29 | 30 | #ifndef __FLEX_LEXER_H 31 | #undef yyFlexLexer 32 | #define yyFlexLexer SaifFlexLexer 33 | #include 34 | #endif 35 | 36 | namespace sta { 37 | 38 | class Report; 39 | 40 | class SaifScanner : public SaifFlexLexer 41 | { 42 | public: 43 | SaifScanner(std::istream *stream, 44 | const std::string &filename, 45 | SaifReader *reader, 46 | Report *report); 47 | virtual ~SaifScanner() {} 48 | 49 | virtual int lex(SaifParse::semantic_type *const yylval, 50 | SaifParse::location_type *yylloc); 51 | // YY_DECL defined in SaifLex.ll 52 | // Method body created by flex in SaifLex.cc 53 | 54 | void error(const char *msg); 55 | 56 | // Get rid of override virtual function warning. 57 | using FlexLexer::yylex; 58 | 59 | private: 60 | std::string filename_; 61 | SaifReader *reader_; 62 | Report *report_; 63 | std::string token_; 64 | }; 65 | 66 | } // namespace 67 | -------------------------------------------------------------------------------- /power/VcdReader.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class Sta; 30 | 31 | void 32 | readVcdActivities(const char *filename, 33 | const char *scope, 34 | Sta *sta); 35 | 36 | } // namespace 37 | -------------------------------------------------------------------------------- /sdc/ClockGatingCheck.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "ClockGatingCheck.hh" 26 | 27 | namespace sta { 28 | 29 | ClockGatingCheck::ClockGatingCheck() : 30 | active_value_(LogicValue::unknown) 31 | { 32 | } 33 | 34 | void 35 | ClockGatingCheck::setActiveValue(LogicValue value) 36 | { 37 | active_value_ = value; 38 | } 39 | 40 | } // namespace 41 | -------------------------------------------------------------------------------- /sdc/ClockGroups.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "ClockGroups.hh" 26 | 27 | #include "StringUtil.hh" 28 | 29 | namespace sta { 30 | 31 | ClockGroups::ClockGroups(const char *name, 32 | bool logically_exclusive, 33 | bool physically_exclusive, 34 | bool asynchronous, 35 | bool allow_paths, 36 | const char *comment) : 37 | SdcCmdComment(comment), 38 | name_(stringCopy(name)), 39 | logically_exclusive_(logically_exclusive), 40 | physically_exclusive_(physically_exclusive), 41 | asynchronous_(asynchronous), 42 | allow_paths_(allow_paths) 43 | { 44 | } 45 | 46 | ClockGroups::~ClockGroups() 47 | { 48 | stringDelete(name_); 49 | groups_.deleteContentsClear(); 50 | } 51 | 52 | void 53 | ClockGroups::makeClockGroup(ClockSet *clks) 54 | { 55 | groups_.insert(clks); 56 | } 57 | 58 | void 59 | ClockGroups::removeClock(Clock *clk) 60 | { 61 | for (auto itr = groups_.cbegin(); itr != groups_.cend(); ) { 62 | ClockGroup *group = *itr; 63 | group->erase(clk); 64 | if (group->empty()) { 65 | itr = groups_.erase(itr); 66 | delete group; 67 | } 68 | else 69 | itr++; 70 | } 71 | } 72 | 73 | } // namespace 74 | -------------------------------------------------------------------------------- /sdc/SdcCmdComment.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "StringUtil.hh" 26 | #include "SdcCmdComment.hh" 27 | 28 | namespace sta { 29 | 30 | SdcCmdComment::SdcCmdComment() : 31 | comment_(nullptr) 32 | { 33 | } 34 | 35 | SdcCmdComment::SdcCmdComment(const char *comment) 36 | { 37 | comment_ = nullptr; 38 | if (comment && comment[0] != '\0') 39 | comment_ = stringCopy(comment); 40 | } 41 | 42 | SdcCmdComment::~SdcCmdComment() 43 | { 44 | stringDelete(comment_); 45 | } 46 | void 47 | SdcCmdComment::setComment(const char *comment) 48 | { 49 | if (comment_) 50 | stringDelete(comment_); 51 | comment_ = nullptr; 52 | if (comment && comment[0] != '\0') 53 | comment_ = stringCopy(comment); 54 | } 55 | 56 | } // namespace 57 | -------------------------------------------------------------------------------- /sdf/ReportAnnotation.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class StaState; 30 | 31 | void 32 | reportAnnotatedDelay(bool report_cells, 33 | bool report_nets, 34 | bool report_in_ports, 35 | bool report_out_ports, 36 | int max_lines, 37 | bool list_annotated, 38 | bool list_unannotated, 39 | bool report_constant_arcs, 40 | StaState *sta); 41 | void 42 | reportAnnotatedCheck(bool report_setup, 43 | bool report_hold, 44 | bool report_recovery, 45 | bool report_removal, 46 | bool report_nochange, 47 | bool report_width, 48 | bool report_period, 49 | bool report_max_skew, 50 | int max_lines, 51 | bool list_annotated, 52 | bool list_unannotated, 53 | bool report_constant_arcs, 54 | StaState *sta); 55 | 56 | } // namespace 57 | -------------------------------------------------------------------------------- /sdf/SdfScanner.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "SdfLocation.hh" 28 | #include "SdfParse.hh" 29 | 30 | #ifndef __FLEX_LEXER_H 31 | #undef yyFlexLexer 32 | #define yyFlexLexer SdfFlexLexer 33 | #include 34 | #endif 35 | 36 | namespace sta { 37 | 38 | class Report; 39 | 40 | class SdfScanner : public SdfFlexLexer 41 | { 42 | public: 43 | SdfScanner(std::istream *stream, 44 | const std::string &filename, 45 | SdfReader *reader, 46 | Report *report); 47 | virtual ~SdfScanner() {} 48 | 49 | virtual int lex(SdfParse::semantic_type *const yylval, 50 | SdfParse::location_type *yylloc); 51 | // YY_DECL defined in SdfLex.ll 52 | // Method body created by flex in SdfLex.cc 53 | 54 | void error(const char *msg); 55 | 56 | // Get rid of override virtual function warning. 57 | using FlexLexer::yylex; 58 | 59 | private: 60 | std::string filename_; 61 | SdfReader *reader_; 62 | Report *report_; 63 | std::string token_; 64 | }; 65 | 66 | } // namespace 67 | -------------------------------------------------------------------------------- /sdf/SdfWriter.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class StaState; 30 | class Corner; 31 | 32 | void 33 | writeSdf(const char *filename, 34 | const Corner *corner, 35 | char divider, 36 | bool include_typ, 37 | int digits, 38 | bool gzip, 39 | bool no_timestamp, 40 | bool no_version, 41 | StaState *sta); 42 | 43 | } // namespace 44 | -------------------------------------------------------------------------------- /search/FindRegister.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "LibertyClass.hh" 28 | #include "NetworkClass.hh" 29 | #include "SdcClass.hh" 30 | #include "StaState.hh" 31 | 32 | namespace sta { 33 | 34 | InstanceSet 35 | findRegInstances(ClockSet *clks, const RiseFallBoth *clk_rf, 36 | bool edge_triggered, bool latches, StaState *sta); 37 | PinSet 38 | findRegDataPins(ClockSet *clks, const RiseFallBoth *clk_rf, 39 | bool edge_triggered, bool latches, StaState *sta); 40 | PinSet 41 | findRegClkPins(ClockSet *clks, const RiseFallBoth *clk_rf, 42 | bool edge_triggered, bool latches, StaState *sta); 43 | PinSet 44 | findRegAsyncPins(ClockSet *clks, const RiseFallBoth *clk_rf, 45 | bool edge_triggered, bool latches, StaState *sta); 46 | PinSet 47 | findRegOutputPins(ClockSet *clks, const RiseFallBoth *clk_rf, 48 | bool edge_triggered, bool latches, StaState *sta); 49 | 50 | void 51 | initPathSenseThru(); 52 | 53 | } // namespace 54 | -------------------------------------------------------------------------------- /search/GatedClk.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "SdcClass.hh" 28 | #include "GraphClass.hh" 29 | #include "SearchClass.hh" 30 | #include "StaState.hh" 31 | 32 | namespace sta { 33 | 34 | typedef Set FuncExprSet; 35 | 36 | class GatedClk : public StaState 37 | { 38 | public: 39 | GatedClk(const StaState *sta); 40 | 41 | bool isGatedClkEnable(Vertex *vertex) const; 42 | void isGatedClkEnable(Vertex *enable_vertex, 43 | bool &is_gated_clk_enable, 44 | const Pin *&clk_pin, 45 | LogicValue &logic_active_value) const; 46 | void gatedClkEnables(Vertex *clk_vertex, 47 | // Return value. 48 | PinSet &enable_pins); 49 | const RiseFall *gatedClkActiveTrans(LogicValue active_value, 50 | const MinMax *min_max) const; 51 | 52 | protected: 53 | void isClkGatingFunc(FuncExpr *func, 54 | LibertyPort *enable_port, 55 | LibertyPort *clk_port, 56 | bool &is_clk_gate, 57 | LogicValue &logic_value) const; 58 | void functionClkOperands(FuncExpr *root_expr, 59 | FuncExpr *curr_expr, 60 | FuncExprSet &funcs) const; 61 | }; 62 | 63 | } // namespace 64 | -------------------------------------------------------------------------------- /search/MakeTimingModel.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class LibertyLibrary; 30 | class Corner; 31 | class Sta; 32 | 33 | LibertyLibrary * 34 | makeTimingModel(const char *lib_name, 35 | const char *cell_name, 36 | const char *filename, 37 | const Corner *corner, 38 | Sta *sta); 39 | 40 | } // namespace 41 | -------------------------------------------------------------------------------- /search/PathAnalysisPt.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "PathAnalysisPt.hh" 26 | 27 | #include "StringUtil.hh" 28 | #include "Corner.hh" 29 | #include "Search.hh" 30 | 31 | namespace sta { 32 | 33 | PathAnalysisPt::PathAnalysisPt(Corner *corner, 34 | PathAPIndex index, 35 | const MinMax *path_min_max, 36 | DcalcAnalysisPt *dcalc_ap) : 37 | corner_(corner), 38 | index_(index), 39 | path_min_max_(path_min_max), 40 | tgt_clk_ap_(nullptr), 41 | dcalc_ap_(dcalc_ap) 42 | { 43 | } 44 | 45 | std::string 46 | PathAnalysisPt::to_string() const 47 | { 48 | std::string name = corner_->name(); 49 | name += '/'; 50 | name += path_min_max_->to_string(); 51 | return name; 52 | } 53 | 54 | void 55 | PathAnalysisPt::setTgtClkAnalysisPt(PathAnalysisPt *path_ap) 56 | { 57 | tgt_clk_ap_ = path_ap; 58 | } 59 | 60 | PathAnalysisPt * 61 | PathAnalysisPt::insertionAnalysisPt(const EarlyLate *early_late) const 62 | { 63 | return insertion_aps_[early_late->index()]; 64 | } 65 | 66 | void 67 | PathAnalysisPt::setInsertionAnalysisPt(const EarlyLate *early_late, 68 | PathAnalysisPt *ap) 69 | { 70 | insertion_aps_[early_late->index()] = ap; 71 | } 72 | 73 | } // namespace 74 | -------------------------------------------------------------------------------- /search/VertexVisitor.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "VertexVisitor.hh" 26 | 27 | #include "Error.hh" 28 | #include "Graph.hh" 29 | 30 | namespace sta { 31 | 32 | VertexPinCollector::VertexPinCollector(PinSet &pins) : 33 | pins_(pins) 34 | { 35 | } 36 | 37 | VertexVisitor * 38 | VertexPinCollector::copy() const 39 | { 40 | criticalError(266, "VertexPinCollector::copy not supported."); 41 | return nullptr; 42 | } 43 | 44 | void 45 | VertexPinCollector::visit(Vertex *vertex) 46 | { 47 | pins_.insert(vertex->pin()); 48 | } 49 | 50 | } // namespace 51 | -------------------------------------------------------------------------------- /search/VisitPathGroupVertices.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | namespace sta { 28 | 29 | class PathGroup; 30 | class VertexVisitor; 31 | class StaState; 32 | 33 | // Visit the fanin vertices for the path group. 34 | // Vertices in the clock network are NOT visited. 35 | void 36 | visitPathGroupVertices(PathGroup *path_group, 37 | VertexVisitor *visitor, 38 | StaState *sta); 39 | 40 | } // namespace 41 | -------------------------------------------------------------------------------- /spice/WritePathSpice.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "StringSet.hh" 28 | #include "CircuitSim.hh" 29 | 30 | namespace sta { 31 | 32 | class Path; 33 | class StaState; 34 | 35 | // Write a spice deck for path. 36 | // Throws FileNotReadable, FileNotWritable, SubcktEndsMissing 37 | void 38 | writePathSpice(Path *path, 39 | // Spice file written for path. 40 | const char *spice_filename, 41 | // Subckts used by path included in spice file. 42 | const char *subckt_filename, 43 | // File of all cell spice subckt definitions. 44 | const char *lib_subckt_filename, 45 | // Device model file included in spice file. 46 | const char *model_filename, 47 | const char *power_name, 48 | const char *gnd_name, 49 | CircuitSim ckt_sim, 50 | StaState *sta); 51 | 52 | } // namespace 53 | -------------------------------------------------------------------------------- /spice/WriteSpice.i: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | %module write_gate_spice 26 | 27 | %{ 28 | 29 | #include "spice/WritePathSpice.hh" 30 | 31 | %} 32 | 33 | %inline %{ 34 | 35 | void 36 | write_path_spice_cmd(Path *path, 37 | const char *spice_filename, 38 | const char *subckt_filename, 39 | const char *lib_subckt_filename, 40 | const char *model_filename, 41 | const char *power_name, 42 | const char *gnd_name, 43 | CircuitSim ckt_sim) 44 | { 45 | Sta *sta = Sta::sta(); 46 | sta->writePathSpice(path, spice_filename, subckt_filename, 47 | lib_subckt_filename, model_filename, 48 | power_name, gnd_name, ckt_sim); 49 | } 50 | 51 | %} // inline 52 | -------------------------------------------------------------------------------- /spice/Xyce.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include 28 | #include 29 | 30 | #include "TableModel.hh" 31 | 32 | namespace sta { 33 | 34 | typedef std::vector StdStringSeq; 35 | typedef std::vector WaveformSeq; 36 | 37 | void 38 | readXyceCsv(const char *csv_filename, 39 | // Return values. 40 | StdStringSeq &titles, 41 | WaveformSeq &waveforms); 42 | 43 | } // namespace 44 | -------------------------------------------------------------------------------- /tcl/Exception.i: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | %exception { 26 | try { $function } 27 | catch (std::bad_alloc &) { 28 | fprintf(stderr, "Error: out of memory.\n"); 29 | exit(1); 30 | } 31 | catch (ExceptionMsg &excp) { 32 | if (!excp.suppressed()) { 33 | Tcl_ResetResult(interp); 34 | Tcl_AppendResult(interp, "Error: ", excp.what(), nullptr); 35 | } 36 | return TCL_ERROR; 37 | } 38 | catch (std::exception &excp) { 39 | Tcl_ResetResult(interp); 40 | Tcl_AppendResult(interp, "Error: ", excp.what(), nullptr); 41 | return TCL_ERROR; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tcl/Init.tcl: -------------------------------------------------------------------------------- 1 | # OpenSTA, Static Timing Analyzer 2 | # Copyright (c) 2025, Parallax Software, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | # The origin of this software must not be misrepresented; you must not 18 | # claim that you wrote the original software. 19 | # 20 | # Altered source versions must be plainly marked as such, and must not be 21 | # misrepresented as being the original software. 22 | # 23 | # This notice may not be removed or altered from any source distribution. 24 | 25 | proc init_sta_cmds {} { 26 | global auto_index 27 | 28 | # Import exported commands from sta namespace to global namespace. 29 | namespace import sta::* 30 | 31 | if { [info exists tclreadline::version] } { 32 | history 33 | history event 34 | eval $auto_index(::tclreadline::ScriptCompleter) 35 | ::tclreadline::readline builtincompleter true 36 | ::tclreadline::readline customcompleter ::tclreadline::ScriptCompleter 37 | proc ::tclreadline::prompt1 {} { return {% } } 38 | proc ::tclreadline::prompt2 {} { return {> } } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/asap7_ccsn.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/asap7_ccsn.lib.gz -------------------------------------------------------------------------------- /test/asap7_invbuf.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/asap7_invbuf.lib.gz -------------------------------------------------------------------------------- /test/asap7_seq.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/asap7_seq.lib.gz -------------------------------------------------------------------------------- /test/asap7_simple.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/asap7_simple.lib.gz -------------------------------------------------------------------------------- /test/asap7_small.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/asap7_small.lib.gz -------------------------------------------------------------------------------- /test/delay_calc.ok: -------------------------------------------------------------------------------- 1 | Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) 2 | Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) 3 | Path Group: clk 4 | Path Type: max 5 | 6 | Delay Time Description 7 | --------------------------------------------------------- 8 | 0.00 0.00 clock clk (rise edge) 9 | 0.00 0.00 clock network delay (ideal) 10 | 0.00 0.00 ^ r2/CK (DFF_X1) 11 | 0.23 0.23 v r2/Q (DFF_X1) 12 | 0.08 0.31 v u1/Z (BUF_X1) 13 | 0.10 0.41 v u2/ZN (AND2_X1) 14 | 0.00 0.41 v r3/D (DFF_X1) 15 | 0.41 data arrival time 16 | 17 | 10.00 10.00 clock clk (rise edge) 18 | 0.00 10.00 clock network delay (ideal) 19 | 0.00 10.00 clock reconvergence pessimism 20 | 10.00 ^ r3/CK (DFF_X1) 21 | -0.16 9.84 library setup time 22 | 9.84 data required time 23 | --------------------------------------------------------- 24 | 9.84 data required time 25 | -0.41 data arrival time 26 | --------------------------------------------------------- 27 | 9.43 slack (MET) 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/get_filter.ok: -------------------------------------------------------------------------------- 1 | [get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *] 2 | u1 3 | [get_clocks -filter is_virtual==0 *] 4 | clk 5 | [get_clocks -filter is_virtual==1 *] 6 | vclk 7 | [get_clocks -filter is_virtual *] 8 | vclk 9 | [get_clocks -filter is_virtual&&is_generated *] 10 | [get_clocks -filter is_virtual&&is_generated==0 *] 11 | vclk 12 | [get_clocks -filter is_virtual||is_generated *] 13 | vclk 14 | [get_clocks -filter is_virtual==0||is_generated *] 15 | clk 16 | [get_lib_cells -filter is_buffer==1 *] 17 | asap7_small/BUFx2_ASAP7_75t_R 18 | [get_lib_cells -filter is_inverter==0 *] 19 | asap7_small/AND2x2_ASAP7_75t_R 20 | asap7_small/BUFx2_ASAP7_75t_R 21 | asap7_small/DFFHQx4_ASAP7_75t_R 22 | [get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*] 23 | A 24 | [get_lib_pins -filter direction==output BUFx2_ASAP7_75t_R/*] 25 | Y 26 | [get_libs -filter name==asap7_small *] 27 | asap7_small 28 | [get_nets -filter name=~*q *] 29 | r1q 30 | r2q 31 | [get_pins -filter direction==input *] 32 | r1/CLK 33 | r1/D 34 | r2/CLK 35 | r2/D 36 | r3/CLK 37 | r3/D 38 | u1/A 39 | u2/A 40 | u2/B 41 | [get_pins -filter direction==output *] 42 | r1/Q 43 | r2/Q 44 | r3/Q 45 | u1/Y 46 | u2/Y 47 | [get_ports -filter direction==input *] 48 | clk1 49 | clk2 50 | clk3 51 | in1 52 | in2 53 | [get_ports -filter direction==output *] 54 | out 55 | -------------------------------------------------------------------------------- /test/get_is_memory.ok: -------------------------------------------------------------------------------- 1 | [get_cells -filter is_memory] 2 | sram_inst 3 | [get_lib_cells -filter is_memory] 4 | gf180mcu_fd_ip_sram__sram128x8m8wm1__ff_125C_1v98/gf180mcu_fd_ip_sram__sram128x8m8wm1 5 | -------------------------------------------------------------------------------- /test/get_is_memory.tcl: -------------------------------------------------------------------------------- 1 | # Tests whether the is_memory attribute works for cells and libcells 2 | read_liberty gf180mcu_sram.lib.gz 3 | read_liberty asap7_small.lib.gz 4 | read_verilog get_is_memory.v 5 | link get_is_memory 6 | 7 | # Test that the is_memory attribute is set correctly for cells 8 | puts {[get_cells -filter is_memory]} 9 | report_object_full_names [get_cells -filter is_memory] 10 | puts {[get_lib_cells -filter is_memory]} 11 | report_object_full_names [get_lib_cells -filter is_memory] 12 | -------------------------------------------------------------------------------- /test/get_is_memory.v: -------------------------------------------------------------------------------- 1 | module get_is_memory ( 2 | input CLK, 3 | input CEN, 4 | input GWEN, 5 | input [7:0] WEN, 6 | input [6:0] A, 7 | input [7:0] D, 8 | output [7:0] Q 9 | ); 10 | 11 | wire CEN_buf; 12 | wire GWEN_reg; 13 | 14 | BUFx2_ASAP7_75t_R buf_inst ( 15 | .A(CEN), 16 | .Y(CEN_buf) 17 | ); 18 | 19 | DFFHQx4_ASAP7_75t_R dff_inst ( 20 | .CLK(CLK), 21 | .D(GWEN), 22 | .Q(GWEN_reg) 23 | ); 24 | 25 | gf180mcu_fd_ip_sram__sram128x8m8wm1 sram_inst ( 26 | .CLK(CLK), 27 | .CEN(CEN_buf), 28 | .GWEN(GWEN_reg), 29 | .WEN(WEN), 30 | .A(A), 31 | .D(D), 32 | .Q(Q) 33 | ); 34 | 35 | endmodule 36 | -------------------------------------------------------------------------------- /test/get_lib_pins_of_objects.ok: -------------------------------------------------------------------------------- 1 | [get_lib_pins -of_objects [get_lib_cells asap7_small/AND2x2_ASAP7_75t_R]] 2 | A 3 | B 4 | Y 5 | [get_lib_pins -of_objects [get_lib_cells *]] 6 | A 7 | A 8 | B 9 | CLK 10 | D 11 | IQ 12 | IQN 13 | Q 14 | Y 15 | Y 16 | -------------------------------------------------------------------------------- /test/get_lib_pins_of_objects.tcl: -------------------------------------------------------------------------------- 1 | # Tests whether get_lib_pins -of_objects command works correctly 2 | 3 | # Read in design and libraries 4 | read_liberty asap7_small.lib.gz 5 | read_verilog reg1_asap7.v 6 | link_design top 7 | 8 | # Get the pins of the library cells 9 | puts {[get_lib_pins -of_objects [get_lib_cells asap7_small/AND2x2_ASAP7_75t_R]]} 10 | report_object_full_names [get_lib_pins -of_objects [get_lib_cells asap7_small/AND2x2_ASAP7_75t_R]] 11 | puts {[get_lib_pins -of_objects [get_lib_cells *]]} 12 | report_object_full_names [get_lib_pins -of_objects [get_lib_cells *]] 13 | -------------------------------------------------------------------------------- /test/get_noargs.ok: -------------------------------------------------------------------------------- 1 | [get_cells] 2 | r1 3 | r2 4 | r3 5 | u1 6 | u2 7 | [get_clocks] 8 | clk 9 | vclk 10 | [get_lib_cells] 11 | asap7_small/AND2x2_ASAP7_75t_R 12 | asap7_small/BUFx2_ASAP7_75t_R 13 | asap7_small/DFFHQx4_ASAP7_75t_R 14 | [get_lib_pins] 15 | A 16 | A 17 | B 18 | CLK 19 | D 20 | IQ 21 | IQN 22 | Q 23 | Y 24 | Y 25 | [get_libs] 26 | asap7_small 27 | [get_nets] 28 | clk1 29 | clk2 30 | clk3 31 | in1 32 | in2 33 | out 34 | r1q 35 | r2q 36 | u1z 37 | u2z 38 | [get_pins] 39 | r1/CLK 40 | r1/D 41 | r1/IQ 42 | r1/IQN 43 | r1/Q 44 | r2/CLK 45 | r2/D 46 | r2/IQ 47 | r2/IQN 48 | r2/Q 49 | r3/CLK 50 | r3/D 51 | r3/IQ 52 | r3/IQN 53 | r3/Q 54 | u1/A 55 | u1/Y 56 | u2/A 57 | u2/B 58 | u2/Y 59 | [get_ports] 60 | clk1 61 | clk2 62 | clk3 63 | in1 64 | in2 65 | out 66 | -------------------------------------------------------------------------------- /test/get_noargs.tcl: -------------------------------------------------------------------------------- 1 | # get_* with no arguments 2 | 3 | # Read in design and libraries 4 | read_liberty asap7_small.lib.gz 5 | read_verilog reg1_asap7.v 6 | link_design top 7 | create_clock -name clk -period 500 {clk1 clk2 clk3} 8 | create_clock -name vclk -period 1000 9 | 10 | # Test each SDC get_* command with no arguments 11 | puts {[get_cells]} 12 | report_object_full_names [get_cells] 13 | puts {[get_clocks]} 14 | report_object_full_names [get_clocks] 15 | puts {[get_lib_cells]} 16 | report_object_full_names [get_lib_cells] 17 | puts {[get_lib_pins]} 18 | report_object_full_names [get_lib_pins] 19 | puts {[get_libs]} 20 | report_object_full_names [get_libs] 21 | puts {[get_nets]} 22 | report_object_full_names [get_nets] 23 | puts {[get_pins]} 24 | report_object_full_names [get_pins] 25 | puts {[get_ports]} 26 | report_object_full_names [get_ports] 27 | -------------------------------------------------------------------------------- /test/get_objrefs.ok: -------------------------------------------------------------------------------- 1 | [get_cells [all_registers -cells]] 2 | r1 3 | r2 4 | r3 5 | [get_clocks [all_clocks]] 6 | clk 7 | vclk 8 | [get_lib_cells [get_lib_cells]] 9 | asap7_small/AND2x2_ASAP7_75t_R 10 | asap7_small/BUFx2_ASAP7_75t_R 11 | asap7_small/DFFHQx4_ASAP7_75t_R 12 | [get_lib_pins [get_lib_pins]] 13 | A 14 | A 15 | B 16 | CLK 17 | D 18 | IQ 19 | IQN 20 | Q 21 | Y 22 | Y 23 | [get_libs [get_libs]] 24 | asap7_small 25 | [get_nets [get_nets]] 26 | clk1 27 | clk2 28 | clk3 29 | in1 30 | in2 31 | out 32 | r1q 33 | r2q 34 | u1z 35 | u2z 36 | [get_pins [all_registers -data_pins]] 37 | r1/D 38 | r2/D 39 | r3/D 40 | [get_ports [all_inputs]] 41 | clk1 42 | clk2 43 | clk3 44 | in1 45 | in2 46 | -------------------------------------------------------------------------------- /test/get_objrefs.tcl: -------------------------------------------------------------------------------- 1 | # get_* on object references 2 | 3 | # Read in design and libraries 4 | read_liberty asap7_small.lib.gz 5 | read_verilog reg1_asap7.v 6 | link_design top 7 | create_clock -name clk -period 500 {clk1 clk2 clk3} 8 | create_clock -name vclk -period 1000 9 | 10 | # Test that set_driving_cell works with an object reference 11 | set_driving_cell [all_inputs] -lib_cell [lindex [get_lib_cells] 0] 12 | 13 | # Test each SDC get_* command on object references 14 | puts {[get_cells [all_registers -cells]]} 15 | report_object_full_names [get_cells [all_registers -cells]] 16 | puts {[get_clocks [all_clocks]]} 17 | report_object_full_names [get_clocks [all_clocks]] 18 | puts {[get_lib_cells [get_lib_cells]]} 19 | report_object_full_names [get_lib_cells [get_lib_cells]] 20 | puts {[get_lib_pins [get_lib_pins]]} 21 | report_object_full_names [get_lib_pins [get_lib_pins]] 22 | puts {[get_libs [get_libs]]} 23 | report_object_full_names [get_libs [get_libs]] 24 | puts {[get_nets [get_nets]]} 25 | report_object_full_names [get_nets [get_nets]] 26 | puts {[get_pins [all_registers -data_pins]]} 27 | report_object_full_names [get_pins [all_registers -data_pins]] 28 | puts {[get_ports [all_inputs]]} 29 | report_object_full_names [get_ports [all_inputs]] 30 | -------------------------------------------------------------------------------- /test/gf180mcu_sram.lib.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/gf180mcu_sram.lib.gz -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_1.lib: -------------------------------------------------------------------------------- 1 | library (liberty_arcs_one2one_1) { 2 | delay_model : "table_lookup"; 3 | simulation : false; 4 | capacitive_load_unit (1,pF); 5 | leakage_power_unit : "1pW"; 6 | current_unit : "1A"; 7 | pulling_resistance_unit : "1kohm"; 8 | time_unit : "1ns"; 9 | voltage_unit : "1v"; 10 | library_features : "report_delay_calculation"; 11 | input_threshold_pct_rise : 50; 12 | input_threshold_pct_fall : 50; 13 | output_threshold_pct_rise : 50; 14 | output_threshold_pct_fall : 50; 15 | slew_lower_threshold_pct_rise : 30; 16 | slew_lower_threshold_pct_fall : 30; 17 | slew_upper_threshold_pct_rise : 70; 18 | slew_upper_threshold_pct_fall : 70; 19 | slew_derate_from_library : 1.0; 20 | nom_process : 1.0; 21 | nom_temperature : 85.0; 22 | nom_voltage : 0.75; 23 | type (bus8) { 24 | base_type : "array"; 25 | data_type : "bit"; 26 | bit_width : 8; 27 | bit_from : 7; 28 | bit_to : 0; 29 | } 30 | type (bus4) { 31 | base_type : "array"; 32 | data_type : "bit"; 33 | bit_width : 4; 34 | bit_from : 3; 35 | bit_to : 0; 36 | } 37 | 38 | cell (inv_8_to_4) { 39 | bus (A) { 40 | capacitance : 1; 41 | bus_type : "bus8"; 42 | direction : "input"; 43 | } 44 | bus (Y) { 45 | function : "!A"; 46 | bus_type : "bus4"; 47 | direction : "output"; 48 | timing () { 49 | related_pin : "A"; 50 | timing_sense : "negative_unate"; 51 | cell_rise (scalar) { 52 | values ("1"); 53 | } 54 | cell_fall (scalar) { 55 | values ("1"); 56 | } 57 | rise_transition (scalar) { 58 | values ("1"); 59 | } 60 | fall_transition (scalar) { 61 | values ("1"); 62 | } 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_1.ok: -------------------------------------------------------------------------------- 1 | Warning: liberty_arcs_one2one_1.lib line 48, timing port A and related port Y are different sizes. 2 | report_edges -from partial_wide_inv_cell/A[0] 3 | A[0] -> Y[0] combinational 4 | ^ -> v 1.00:1.00 5 | v -> ^ 1.00:1.00 6 | report_edges -from partial_wide_inv_cell/A[1] 7 | A[1] -> Y[1] combinational 8 | ^ -> v 1.00:1.00 9 | v -> ^ 1.00:1.00 10 | report_edges -from partial_wide_inv_cell/A[2] 11 | A[2] -> Y[2] combinational 12 | ^ -> v 1.00:1.00 13 | v -> ^ 1.00:1.00 14 | report_edges -from partial_wide_inv_cell/A[3] 15 | A[3] -> Y[3] combinational 16 | ^ -> v 1.00:1.00 17 | v -> ^ 1.00:1.00 18 | report_edges -from partial_wide_inv_cell/A[4] 19 | report_edges -from partial_wide_inv_cell/A[5] 20 | report_edges -from partial_wide_inv_cell/A[6] 21 | report_edges -from partial_wide_inv_cell/A[7] 22 | -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_1.tcl: -------------------------------------------------------------------------------- 1 | # Test one-to-one functionality with mismatched widths where A width (8) is larger than Y width (4) 2 | read_liberty liberty_arcs_one2one_1.lib 3 | read_verilog liberty_arcs_one2one_1.v 4 | link_design liberty_arcs_one2one_1 5 | create_clock -name clk -period 0 6 | set_input_delay -clock clk 0 [all_inputs] 7 | set_output_delay -clock clk 0 [all_outputs] 8 | for {set i 0} {$i < 8} {incr i} { 9 | puts "report_edges -from partial_wide_inv_cell/A[$i]" 10 | report_edges -from partial_wide_inv_cell/A[$i] 11 | } 12 | -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_1.v: -------------------------------------------------------------------------------- 1 | // Liberty file test: one-to-one mapping with mismatched bit widths 2 | // Should generate warning but still create timing arcs between bits with same index 3 | module liberty_arcs_one2one_1 ( 4 | input wire [7:0] a, 5 | output wire [3:0] y 6 | ); 7 | 8 | inv_8_to_4 partial_wide_inv_cell ( 9 | .A(a), 10 | .Y(y) 11 | ); 12 | 13 | endmodule -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_2.lib: -------------------------------------------------------------------------------- 1 | library (liberty_arcs_one2one_2) { 2 | delay_model : "table_lookup"; 3 | simulation : false; 4 | capacitive_load_unit (1,pF); 5 | leakage_power_unit : "1pW"; 6 | current_unit : "1A"; 7 | pulling_resistance_unit : "1kohm"; 8 | time_unit : "1ns"; 9 | voltage_unit : "1v"; 10 | library_features : "report_delay_calculation"; 11 | input_threshold_pct_rise : 50; 12 | input_threshold_pct_fall : 50; 13 | output_threshold_pct_rise : 50; 14 | output_threshold_pct_fall : 50; 15 | slew_lower_threshold_pct_rise : 30; 16 | slew_lower_threshold_pct_fall : 30; 17 | slew_upper_threshold_pct_rise : 70; 18 | slew_upper_threshold_pct_fall : 70; 19 | slew_derate_from_library : 1.0; 20 | nom_process : 1.0; 21 | nom_temperature : 85.0; 22 | nom_voltage : 0.75; 23 | type (bus8) { 24 | base_type : "array"; 25 | data_type : "bit"; 26 | bit_width : 8; 27 | bit_from : 7; 28 | bit_to : 0; 29 | } 30 | type (bus4) { 31 | base_type : "array"; 32 | data_type : "bit"; 33 | bit_width : 4; 34 | bit_from : 3; 35 | bit_to : 0; 36 | } 37 | 38 | cell (inv_4_to_8) { 39 | bus (A) { 40 | capacitance : 1; 41 | bus_type : "bus4"; 42 | direction : "input"; 43 | } 44 | bus (Y) { 45 | function : "!A"; 46 | bus_type : "bus8"; 47 | direction : "output"; 48 | timing () { 49 | related_pin : "A"; 50 | timing_sense : "negative_unate"; 51 | cell_rise (scalar) { 52 | values ("1"); 53 | } 54 | cell_fall (scalar) { 55 | values ("1"); 56 | } 57 | rise_transition (scalar) { 58 | values ("1"); 59 | } 60 | fall_transition (scalar) { 61 | values ("1"); 62 | } 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_2.ok: -------------------------------------------------------------------------------- 1 | Warning: liberty_arcs_one2one_2.lib line 48, timing port A and related port Y are different sizes. 2 | report_edges -to partial_wide_inv_cell/Y[0] 3 | A[0] -> Y[0] combinational 4 | ^ -> v 1.00:1.00 5 | v -> ^ 1.00:1.00 6 | report_edges -to partial_wide_inv_cell/Y[1] 7 | A[1] -> Y[1] combinational 8 | ^ -> v 1.00:1.00 9 | v -> ^ 1.00:1.00 10 | report_edges -to partial_wide_inv_cell/Y[2] 11 | A[2] -> Y[2] combinational 12 | ^ -> v 1.00:1.00 13 | v -> ^ 1.00:1.00 14 | report_edges -to partial_wide_inv_cell/Y[3] 15 | A[3] -> Y[3] combinational 16 | ^ -> v 1.00:1.00 17 | v -> ^ 1.00:1.00 18 | report_edges -to partial_wide_inv_cell/Y[4] 19 | report_edges -to partial_wide_inv_cell/Y[5] 20 | report_edges -to partial_wide_inv_cell/Y[6] 21 | report_edges -to partial_wide_inv_cell/Y[7] 22 | -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_2.tcl: -------------------------------------------------------------------------------- 1 | # Test one-to-one functionality with mismatched widths where Y width (8) is larger than A width (4) 2 | read_liberty liberty_arcs_one2one_2.lib 3 | read_verilog liberty_arcs_one2one_2.v 4 | link_design liberty_arcs_one2one_2 5 | create_clock -name clk -period 0 6 | set_input_delay -clock clk 0 [all_inputs] 7 | set_output_delay -clock clk 0 [all_outputs] 8 | for {set i 0} {$i < 8} {incr i} { 9 | puts "report_edges -to partial_wide_inv_cell/Y[$i]" 10 | report_edges -to partial_wide_inv_cell/Y[$i] 11 | } 12 | -------------------------------------------------------------------------------- /test/liberty_arcs_one2one_2.v: -------------------------------------------------------------------------------- 1 | // Liberty file test: one-to-one mapping with mismatched bit widths 2 | // Should generate warning but still create timing arcs between bits with same index 3 | module liberty_arcs_one2one_2 ( 4 | input wire [3:0] a, 5 | output wire [7:0] y 6 | ); 7 | 8 | inv_4_to_8 partial_wide_inv_cell ( 9 | .A(a), 10 | .Y(y) 11 | ); 12 | 13 | endmodule -------------------------------------------------------------------------------- /test/liberty_ccsn.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/liberty_ccsn.ok -------------------------------------------------------------------------------- /test/liberty_ccsn.tcl: -------------------------------------------------------------------------------- 1 | # read ccsn library and ensure no unnecessary warnings 2 | read_liberty asap7_ccsn.lib.gz 3 | -------------------------------------------------------------------------------- /test/liberty_latch3.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxsw/OpenSTA/343b93b6336962b2dbcc5b7c7500c01df0367696/test/liberty_latch3.ok -------------------------------------------------------------------------------- /test/liberty_latch3.tcl: -------------------------------------------------------------------------------- 1 | # Read Liberty latch group with data inputs as first parameter 2 | read_liberty liberty_latch3.lib 3 | -------------------------------------------------------------------------------- /test/min_max_delays.ok: -------------------------------------------------------------------------------- 1 | Startpoint: in1 (input port clocked by clk) 2 | Endpoint: r1 (rising edge-triggered flip-flop clocked by clk) 3 | Path Group: clk 4 | Path Type: min 5 | 6 | Delay Time Description 7 | --------------------------------------------------------- 8 | 0.00 0.00 clock clk (rise edge) 9 | 0.00 0.00 clock network delay (ideal) 10 | 0.00 0.00 v input external delay 11 | 0.00 0.00 v in1 (in) 12 | 0.00 0.00 v r1/D (DFF_X1) 13 | 0.00 data arrival time 14 | 15 | 0.00 0.00 clock clk (rise edge) 16 | 0.00 0.00 clock network delay (ideal) 17 | 0.00 0.00 clock reconvergence pessimism 18 | 0.00 ^ r1/CK (DFF_X1) 19 | 0.00 0.00 library hold time 20 | 0.00 data required time 21 | --------------------------------------------------------- 22 | 0.00 data required time 23 | -0.00 data arrival time 24 | --------------------------------------------------------- 25 | 0.00 slack (VIOLATED) 26 | 27 | 28 | Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) 29 | Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) 30 | Path Group: clk 31 | Path Type: max 32 | 33 | Delay Time Description 34 | --------------------------------------------------------- 35 | 0.00 0.00 clock clk (rise edge) 36 | 0.00 0.00 clock network delay (ideal) 37 | 0.00 0.00 ^ r2/CK (DFF_X1) 38 | 0.23 0.23 v r2/Q (DFF_X1) 39 | 0.08 0.31 v u1/Z (BUF_X1) 40 | 0.10 0.41 v u2/ZN (AND2_X1) 41 | 0.00 0.41 v r3/D (DFF_X1) 42 | 0.41 data arrival time 43 | 44 | 10.00 10.00 clock clk (rise edge) 45 | 0.00 10.00 clock network delay (ideal) 46 | 0.00 10.00 clock reconvergence pessimism 47 | 10.00 ^ r3/CK (DFF_X1) 48 | -0.16 9.84 library setup time 49 | 9.84 data required time 50 | --------------------------------------------------------- 51 | 9.84 data required time 52 | -0.41 data arrival time 53 | --------------------------------------------------------- 54 | 9.43 slack (MET) 55 | 56 | 57 | -------------------------------------------------------------------------------- /test/path_group_names.ok: -------------------------------------------------------------------------------- 1 | Initial path groups: 2 | Final path groups: In2Out In2Reg Reg2Out Reg2Reg 3 | -------------------------------------------------------------------------------- /test/path_group_names.tcl: -------------------------------------------------------------------------------- 1 | # path_group_names 2 | 3 | read_liberty asap7_small.lib.gz 4 | read_verilog reg1_asap7.v 5 | link_design top 6 | create_clock -name clk -period 500 {clk1 clk2 clk3} 7 | set_input_delay -clock clk 0 [all_inputs -no_clocks] 8 | set_output_delay -clock clk 0 [all_outputs] 9 | puts "Initial path groups: [sta::path_group_names]" 10 | group_path -name In2Reg -from [all_inputs] -to [all_registers -data_pins] 11 | group_path -name In2Out -from [all_inputs] -to [all_outputs] 12 | group_path -name Reg2Out -from [all_registers -clock_pins] -to [all_outputs] 13 | group_path -name Reg2Reg -from [all_registers -clock_pins] -to [all_registers -data_pins] 14 | puts "Final path groups: [sta::path_group_names]" 15 | -------------------------------------------------------------------------------- /test/power.ok: -------------------------------------------------------------------------------- 1 | Warning: gcd_sky130hd.v line 527, module sky130_fd_sc_hd__tapvpwrvgnd_1 not found. Creating black box for TAP_11. 2 | Group Internal Switching Leakage Total 3 | Power Power Power Power (Watts) 4 | ---------------------------------------------------------------- 5 | Sequential 3.07e-04 4.76e-05 2.96e-10 3.54e-04 40.0% 6 | Combinational 1.59e-04 2.05e-04 6.86e-10 3.64e-04 41.1% 7 | Clock 4.68e-05 1.20e-04 2.30e-11 1.67e-04 18.9% 8 | Macro 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.0% 9 | Pad 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.0% 10 | ---------------------------------------------------------------- 11 | Total 5.12e-04 3.73e-04 1.00e-09 8.85e-04 100.0% 12 | 57.8% 42.2% 0.0% 13 | -------------------------------------------------------------------------------- /test/power_vcd.ok: -------------------------------------------------------------------------------- 1 | Warning: gcd_sky130hd.v line 527, module sky130_fd_sc_hd__tapvpwrvgnd_1 not found. Creating black box for TAP_11. 2 | Annotated 937 pin activities. 3 | vcd 937 4 | unannotated 0 5 | Group Internal Switching Leakage Total 6 | Power Power Power Power (Watts) 7 | ---------------------------------------------------------------- 8 | Sequential 3.05e-04 3.85e-05 2.92e-10 3.44e-04 44.6% 9 | Combinational 9.90e-05 1.59e-04 6.76e-10 2.58e-04 33.5% 10 | Clock 4.82e-05 1.20e-04 2.30e-11 1.69e-04 21.9% 11 | Macro 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.0% 12 | Pad 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.0% 13 | ---------------------------------------------------------------- 14 | Total 4.53e-04 3.18e-04 9.91e-10 7.71e-04 100.0% 15 | 58.7% 41.3% 0.0% 16 | -------------------------------------------------------------------------------- /test/prima3.ok: -------------------------------------------------------------------------------- 1 | Warning: asap7_simple.lib.gz line 71029, timing group from output port. 2 | Warning: asap7_simple.lib.gz line 71505, timing group from output port. 3 | Warning: asap7_simple.lib.gz line 71981, timing group from output port. 4 | Warning: asap7_simple.lib.gz line 72457, timing group from output port. 5 | Warning: asap7_simple.lib.gz line 72933, timing group from output port. 6 | Warning: asap7_simple.lib.gz line 73409, timing group from output port. 7 | Warning: asap7_simple.lib.gz line 73885, timing group from output port. 8 | Warning: asap7_simple.lib.gz line 81795, timing group from output port. 9 | Warning: asap7_simple.lib.gz line 82271, timing group from output port. 10 | Warning: asap7_simple.lib.gz line 82747, timing group from output port. 11 | Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) 12 | Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) 13 | Path Group: clk 14 | Path Type: max 15 | 16 | Slew Delay Time Description 17 | ---------------------------------------------------------------- 18 | 0.00 0.00 0.00 clock clk (rise edge) 19 | 0.00 0.00 clock source latency 20 | 10.00 0.00 0.00 ^ clk2 (in) 21 | 48.15 12.04 12.04 ^ r2/CLK (DFFHQx4_ASAP7_75t_R) 22 | 38.97 90.82 102.86 ^ r2/Q (DFFHQx4_ASAP7_75t_R) 23 | 59.28 16.50 119.36 ^ u1/A (BUFx2_ASAP7_75t_R) 24 | 70.25 51.69 171.05 ^ u1/Y (BUFx2_ASAP7_75t_R) 25 | 83.74 18.32 189.37 ^ u2/B (AND2x2_ASAP7_75t_R) 26 | 72.19 60.76 250.13 ^ u2/Y (AND2x2_ASAP7_75t_R) 27 | 85.61 18.34 268.46 ^ r3/D (DFFHQx4_ASAP7_75t_R) 28 | 268.46 data arrival time 29 | 30 | 0.00 500.00 500.00 clock clk (rise edge) 31 | 0.00 500.00 clock source latency 32 | 10.00 0.00 500.00 ^ clk3 (in) 33 | 47.52 11.84 511.84 ^ r3/CLK (DFFHQx4_ASAP7_75t_R) 34 | 0.00 511.84 clock reconvergence pessimism 35 | -14.89 496.95 library setup time 36 | 496.95 data required time 37 | ---------------------------------------------------------------- 38 | 496.95 data required time 39 | -268.46 data arrival time 40 | ---------------------------------------------------------------- 41 | 228.48 slack (MET) 42 | 43 | 44 | -------------------------------------------------------------------------------- /test/prima3.tcl: -------------------------------------------------------------------------------- 1 | # prima reg1 asap7 2 | read_liberty asap7_invbuf.lib.gz 3 | read_liberty asap7_seq.lib.gz 4 | read_liberty asap7_simple.lib.gz 5 | read_verilog reg1_asap7.v 6 | link_design top 7 | create_clock -name clk -period 500 {clk1 clk2 clk3} 8 | set_input_delay -clock clk 1 {in1 in2} 9 | set_input_transition 10 {in1 in2 clk1 clk2 clk3} 10 | set_propagated_clock {clk1 clk2 clk3} 11 | read_spef reg1_asap7.spef 12 | sta::set_delay_calculator prima 13 | report_checks -fields {input_pins slew} -format full_clock 14 | -------------------------------------------------------------------------------- /test/reg1_asap7.spef: -------------------------------------------------------------------------------- 1 | *SPEF "IEEE 1481-1998" 2 | *DESIGN "reg1" 3 | *DATE "Fri Nov 20 13:23:00 2002" 4 | *VENDOR "Parallax Software, Inc" 5 | *PROGRAM "Handjob" 6 | *VERSION "1.0.1c" 7 | *DESIGN_FLOW "MISSING_NETS" 8 | *DIVIDER / 9 | *DELIMITER : 10 | *BUS_DELIMITER [ ] 11 | *T_UNIT 1.0 PS 12 | *C_UNIT 1.0 FF 13 | *R_UNIT 1.0 KOHM 14 | *L_UNIT 1.0 UH 15 | 16 | *POWER_NETS VDD 17 | *GROUND_NETS VSS 18 | 19 | *PORTS 20 | in1 I 21 | in2 I 22 | clk1 I 23 | clk2 I 24 | clk3 I 25 | out O 26 | 27 | *D_NET in1 13.4 28 | *CONN 29 | *P in1 I 30 | *I r1:D I *L .0036 31 | *CAP 32 | 1 in1 6.7 33 | 2 r1:D 6.7 34 | *RES 35 | 3 in1 r1:D 2.42 36 | *END 37 | 38 | *D_NET in2 13.4 39 | *CONN 40 | *P in2 I 41 | *I r2:D I *L .0036 42 | *CAP 43 | 1 in2 6.7 44 | 2 r2:D 6.7 45 | *RES 46 | 3 in2 r2:D 2.42 47 | *END 48 | 49 | *D_NET clk1 13.4 50 | *CONN 51 | *P clk1 I 52 | *I r1:CLK I *L .0036 53 | *CAP 54 | 1 clk1 6.7 55 | 2 r1:CLK 6.7 56 | *RES 57 | 3 clk1 r1:CLK 2.42 58 | *END 59 | 60 | *D_NET clk2 13.4 61 | *CONN 62 | *P clk2 I 63 | *I r2:CLK I *L .0036 64 | *CAP 65 | 1 clk2 6.7 66 | 2 r2:CLK 6.7 67 | *RES 68 | 3 clk2 r2:CLK 2.42 69 | *END 70 | 71 | *D_NET clk3 13.4 72 | *CONN 73 | *P clk3 I 74 | *I r3:CLK I *L .0036 75 | *CAP 76 | 1 clk3 6.7 77 | 2 r3:CLK 6.7 78 | *RES 79 | 3 clk3 r3:CLK 2.42 80 | *END 81 | 82 | *D_NET r1q 13.4 83 | *CONN 84 | *I r1:Q O 85 | *I u2:A I *L .0086 86 | *CAP 87 | 1 r1:Q 6.7 88 | 2 u2:A 6.7 89 | *RES 90 | 3 r1:Q u2:A 2.42 91 | *END 92 | 93 | *D_NET r2q 13.4 94 | *CONN 95 | *I r2:Q O 96 | *I u1:A I *L .0086 97 | *CAP 98 | 1 r2:Q 6.7 99 | 2 u1:A 6.7 100 | *RES 101 | 3 r2:Q u1:A 2.42 102 | *END 103 | 104 | *D_NET u1z 13.4 105 | *CONN 106 | *I u1:Y O 107 | *I u2:B I *L .0086 108 | *CAP 109 | 1 u1:Y 6.7 110 | 2 u2:B 6.7 111 | *RES 112 | 3 u1:Y u2:B 2.42 113 | *END 114 | 115 | *D_NET u2z 13.4 116 | *CONN 117 | *I u2:Y O 118 | *I r3:D I *L .0086 119 | *CAP 120 | 1 u2:Y 6.7 121 | 2 r3:D 6.7 122 | *RES 123 | 3 u2:Y r3:D 2.42 124 | *END 125 | 126 | *D_NET out 13.4 127 | *CONN 128 | *I r3:Q O 129 | *P out O 130 | *CAP 131 | 1 r3:Q 6.7 132 | 2 out 6.7 133 | *RES 134 | 3 r3:Q out 2.42 135 | *END 136 | -------------------------------------------------------------------------------- /test/reg1_asap7.v: -------------------------------------------------------------------------------- 1 | module top (in1, in2, clk1, clk2, clk3, out); 2 | input in1, in2, clk1, clk2, clk3; 3 | output out; 4 | wire r1q, r2q, u1z, u2z; 5 | 6 | DFFHQx4_ASAP7_75t_R r1 (.D(in1), .CLK(clk1), .Q(r1q)); 7 | DFFHQx4_ASAP7_75t_R r2 (.D(in2), .CLK(clk2), .Q(r2q)); 8 | BUFx2_ASAP7_75t_R u1 (.A(r2q), .Y(u1z)); 9 | AND2x2_ASAP7_75t_R u2 (.A(r1q), .B(u1z), .Y(u2z)); 10 | DFFHQx4_ASAP7_75t_R r3 (.D(u2z), .CLK(clk3), .Q(out)); 11 | endmodule // top 12 | -------------------------------------------------------------------------------- /test/regression: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # The next line is executed by /bin/sh, but not Tcl \ 3 | exec tclsh $0 ${1+"$@"} 4 | 5 | # OpenSTA, Static Timing Analyzer 6 | # Copyright (c) 2025, Parallax Software, Inc. 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | # 21 | # The origin of this software must not be misrepresented; you must not 22 | # claim that you wrote the original software. 23 | # 24 | # Altered source versions must be plainly marked as such, and must not be 25 | # misrepresented as being the original software. 26 | # 27 | # This notice may not be removed or altered from any source distribution. 28 | 29 | # Usage: regression help | test1 [test2...] 30 | # where test is all or the name of a tcl script in $STA/test 31 | 32 | # Directory containing tests. 33 | set test_dir [file dirname [file normalize [info script]]] 34 | source [file join $test_dir regression_vars.tcl] 35 | source [file join $test_dir regression.tcl] 36 | 37 | regression_main 38 | 39 | # Local Variables: 40 | # mode:tcl 41 | # End: 42 | -------------------------------------------------------------------------------- /test/report_checks_src_attr.ok: -------------------------------------------------------------------------------- 1 | Startpoint: _1415_ (rising edge-triggered flip-flop clocked by clk) 2 | Endpoint: _1416_[0] (rising edge-triggered flip-flop clocked by clk) 3 | Path Group: clk 4 | Path Type: max 5 | 6 | Cap Slew Delay Time Description Src Attr 7 | --------------------------------------------------------------------------------------------------------------- 8 | 0.00 0.00 0.00 clock clk (rise edge) 9 | 0.00 0.00 clock network delay (ideal) 10 | 0.00 0.00 0.00 ^ _1415_/CLK (sky130_fd_sc_hd__dfrtp_1) synthesis/tests/counter.v:22.3-28.6 11 | 0.00 0.04 0.33 0.33 v _1415_/Q (sky130_fd_sc_hd__dfrtp_1) synthesis/tests/counter.v:22.3-28.6 12 | mid (net) synthesis/tests/counter.v:22.3-28.6 13 | 0.04 0.00 0.33 v _1416_[0]/D (sky130_fd_sc_hd__dfrtp_1) synthesis/tests/counter.v:22.3-28.6 14 | 0.33 data arrival time 15 | 16 | 0.00 10.00 10.00 clock clk (rise edge) 17 | 0.00 10.00 clock network delay (ideal) 18 | 0.00 10.00 clock reconvergence pessimism 19 | 10.00 ^ _1416_[0]/CLK (sky130_fd_sc_hd__dfrtp_1) 20 | -0.12 9.88 library setup time 21 | 9.88 data required time 22 | --------------------------------------------------------------------------------------------------------------- 23 | 9.88 data required time 24 | -0.33 data arrival time 25 | --------------------------------------------------------------------------------------------------------------- 26 | 9.55 slack (MET) 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/report_checks_src_attr.tcl: -------------------------------------------------------------------------------- 1 | # report_checks all fields enabled 2 | read_liberty ../examples/sky130hd_tt.lib.gz 3 | read_verilog verilog_attribute.v 4 | link_design counter 5 | create_clock -name clk -period 10 clk 6 | set_input_delay -clock clk 0 [all_inputs -no_clocks] 7 | report_checks -path_group clk -fields {capacitance slew input_pin net src_attr} 8 | -------------------------------------------------------------------------------- /test/report_json1.ok: -------------------------------------------------------------------------------- 1 | {"checks": [ 2 | { 3 | "type": "check", 4 | "path_group": "clk", 5 | "path_type": "max", 6 | "startpoint": "_1415_/Q", 7 | "endpoint": "_1416_[0]/D", 8 | "source_clock": "clk", 9 | "source_clock_edge": "rise", 10 | "source_path": [ 11 | { 12 | "instance": "", 13 | "cell": "counter", 14 | "verilog_src": "", 15 | "pin": "clk", 16 | "arrival": 0.000e+00, 17 | "capacitance": 3.742e-15, 18 | "slew": 0.000e+00 19 | }, 20 | { 21 | "instance": "_1415_", 22 | "cell": "sky130_fd_sc_hd__dfrtp_1", 23 | "verilog_src": "synthesis/tests/counter.v:22.3-28.6", 24 | "pin": "_1415_/CLK", 25 | "net": "clk", 26 | "arrival": 0.000e+00, 27 | "slew": 0.000e+00 28 | }, 29 | { 30 | "instance": "_1415_", 31 | "cell": "sky130_fd_sc_hd__dfrtp_1", 32 | "verilog_src": "synthesis/tests/counter.v:22.3-28.6", 33 | "pin": "_1415_/Q", 34 | "net": "mid", 35 | "arrival": 3.296e-10, 36 | "capacitance": 1.949e-15, 37 | "slew": 3.612e-11 38 | }, 39 | { 40 | "instance": "_1416_[0]", 41 | "cell": "sky130_fd_sc_hd__dfrtp_1", 42 | "verilog_src": "synthesis/tests/counter.v:22.3-28.6", 43 | "pin": "_1416_[0]/D", 44 | "net": "mid", 45 | "arrival": 3.296e-10, 46 | "slew": 3.612e-11 47 | } 48 | ], 49 | "target_clock": "clk", 50 | "target_clock_edge": "rise", 51 | "target_clock_path": [ 52 | { 53 | "instance": "", 54 | "cell": "counter", 55 | "verilog_src": "", 56 | "pin": "clk", 57 | "arrival": 0.000e+00, 58 | "capacitance": 3.742e-15, 59 | "slew": 0.000e+00 60 | }, 61 | { 62 | "instance": "_1416_[0]", 63 | "cell": "sky130_fd_sc_hd__dfrtp_1", 64 | "verilog_src": "synthesis/tests/counter.v:22.3-28.6", 65 | "pin": "_1416_[0]/CLK", 66 | "net": "clk", 67 | "arrival": 0.000e+00, 68 | "slew": 0.000e+00 69 | } 70 | ], 71 | "data_arrival_time": 3.296e-10, 72 | "crpr": 0.000e+00, 73 | "margin": 1.207e-10, 74 | "required_time": 9.879e-09, 75 | "slack": 9.550e-09 76 | } 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /test/report_json1.tcl: -------------------------------------------------------------------------------- 1 | # report_checks -format json 2 | read_liberty ../examples/sky130hd_tt.lib.gz 3 | read_verilog verilog_attribute.v 4 | link_design counter 5 | create_clock -name clk -period 10 clk 6 | set_input_delay -clock clk 0 [all_inputs -no_clocks] 7 | report_checks -path_group clk -format json 8 | -------------------------------------------------------------------------------- /test/report_json2.ok: -------------------------------------------------------------------------------- 1 | {"checks": [ 2 | ] 3 | } 4 | -------------------------------------------------------------------------------- /test/report_json2.tcl: -------------------------------------------------------------------------------- 1 | # report_checks -format json with no paths 2 | read_liberty ../examples/sky130hd_tt.lib.gz 3 | read_verilog verilog_attribute.v 4 | link_design counter 5 | create_clock -name clk -period 10 6 | report_checks -path_group clk -format json 7 | -------------------------------------------------------------------------------- /test/save_ok: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # The next line is executed by /bin/sh, but not Tcl \ 3 | exec tclsh $0 ${1+"$@"} 4 | 5 | # OpenSTA, Static Timing Analyzer 6 | # Copyright (c) 2025, Parallax Software, Inc. 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | # 21 | # The origin of this software must not be misrepresented; you must not 22 | # claim that you wrote the original software. 23 | # 24 | # Altered source versions must be plainly marked as such, and must not be 25 | # misrepresented as being the original software. 26 | # 27 | # This notice may not be removed or altered from any source distribution. 28 | 29 | # Directory containing tests. 30 | set test_dir [file dirname [info script]] 31 | source [file join $test_dir regression_vars.tcl] 32 | source [file join $test_dir regression.tcl] 33 | 34 | save_ok_main 35 | 36 | # Local Variables: 37 | # mode:tcl 38 | # End: 39 | -------------------------------------------------------------------------------- /test/sdf_delays.ok: -------------------------------------------------------------------------------- 1 | Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) 2 | Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) 3 | Path Group: clk 4 | Path Type: max 5 | 6 | Delay Time Description 7 | --------------------------------------------------------- 8 | 0.00 0.00 clock clk (rise edge) 9 | 0.00 0.00 clock network delay (ideal) 10 | 0.00 0.00 ^ r2/CK (DFF_X1) 11 | 1.10 1.10 v r2/Q (DFF_X1) 12 | 1.10 2.20 v u1/Z (BUF_X1) 13 | 1.10 3.30 v u2/ZN (AND2_X1) 14 | 0.00 3.30 v r3/D (DFF_X1) 15 | 3.30 data arrival time 16 | 17 | 10.00 10.00 clock clk (rise edge) 18 | 0.00 10.00 clock network delay (ideal) 19 | 0.00 10.00 clock reconvergence pessimism 20 | 10.00 ^ r3/CK (DFF_X1) 21 | -0.50 9.50 library setup time 22 | 9.50 data required time 23 | --------------------------------------------------------- 24 | 9.50 data required time 25 | -3.30 data arrival time 26 | --------------------------------------------------------- 27 | 6.20 slack (MET) 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/spef_parasitics.ok: -------------------------------------------------------------------------------- 1 | Startpoint: r2 (rising edge-triggered flip-flop clocked by clk) 2 | Endpoint: r3 (rising edge-triggered flip-flop clocked by clk) 3 | Path Group: clk 4 | Path Type: max 5 | 6 | Delay Time Description 7 | --------------------------------------------------------- 8 | 0.00 0.00 clock clk (rise edge) 9 | 0.00 0.00 clock network delay (ideal) 10 | 0.00 0.00 ^ r2/CK (DFF_X1) 11 | 2.58 2.58 ^ r2/Q (DFF_X1) 12 | 2.58 5.16 ^ u1/Z (BUF_X1) 13 | 2.75 7.91 ^ u2/ZN (AND2_X1) 14 | 0.00 7.92 ^ r3/D (DFF_X1) 15 | 7.92 data arrival time 16 | 17 | 10.00 10.00 clock clk (rise edge) 18 | 0.00 10.00 clock network delay (ideal) 19 | 0.00 10.00 clock reconvergence pessimism 20 | 10.00 ^ r3/CK (DFF_X1) 21 | -0.57 9.43 library setup time 22 | 9.43 data required time 23 | --------------------------------------------------------- 24 | 9.43 data required time 25 | -7.92 data arrival time 26 | --------------------------------------------------------- 27 | 1.52 slack (MET) 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/suppress_msg.ok: -------------------------------------------------------------------------------- 1 | Warning: suppress_msg.tcl line 18, cmd warn 1 2 | caught Error: suppress_msg.tcl line 18, cmd error 1 3 | Warning: cmd warn 2 4 | caught Error: cmd error 2 5 | after error 6 | caught 7 | caught 8 | after error 9 | Warning: suppress_msg.tcl line 51, cmd warn 7 10 | caught Error: suppress_msg.tcl line 51, cmd error 7 11 | Warning: cmd warn 8 12 | caught Error: cmd error 8 13 | -------------------------------------------------------------------------------- /test/suppress_msg.tcl: -------------------------------------------------------------------------------- 1 | # suppress and unsuppress message ids 2 | 3 | # Run sta_warn/sta_error to test TCL side suppression 4 | proc sta_cmd { msg } { 5 | sta::sta_warn 1 "cmd warn $msg" 6 | sta::sta_error 2 "cmd error $msg" 7 | puts "after error" 8 | } 9 | 10 | # Run report_warn/report_error to test C++ side suppression 11 | proc report_cmd { msg } { 12 | sta::report_warn 1 "cmd warn $msg" 13 | sta::report_error 2 "cmd error $msg" 14 | puts "after error" 15 | } 16 | 17 | # Ensure that TCL side messages are displayed as usual 18 | catch { sta_cmd 1 } error 19 | puts "caught $error" 20 | 21 | # Ensure that C++ side messages are displayed as usual 22 | catch { report_cmd 2 } error 23 | puts "caught $error" 24 | 25 | # Suppress messages 26 | suppress_msg 1 2 27 | 28 | # Ensure that TCL side messages are suppressed 29 | catch { sta_cmd 3 } error 30 | puts "caught $error" 31 | 32 | # Ensure that C++ side messages are suppressed 33 | catch { report_cmd 4 } error 34 | puts "caught $error" 35 | 36 | # Continue on error to avoid having to catch 37 | set sta_continue_on_error 1 38 | 39 | # Ensure that TCL side messages are suppressed 40 | # TCL side will make it to "after error" 41 | sta_cmd 5 42 | 43 | # Ensure that C++ side messages are suppressed 44 | # C++ will not make it to "after error" as the whole cmd is cancelled 45 | report_cmd 6 46 | 47 | # Unsuppress messages 48 | unsuppress_msg 1 2 49 | 50 | # Ensure that TCL side messages are displayed as usual 51 | catch { sta_cmd 7 } error 52 | puts "caught $error" 53 | 54 | # Ensure that C++ side messages are displayed as usual 55 | catch { report_cmd 8 } error 56 | puts "caught $error" 57 | -------------------------------------------------------------------------------- /test/verilog_attribute.ok: -------------------------------------------------------------------------------- 1 | top_instance:"counter" attribute "src" = synthesis/tests/counter.v:16.1-32.10 2 | instance: _1415_ attribute "src" = synthesis/tests/counter.v:22.3-28.6 3 | instance: _1415_ attribute "attr1" = test_attr1 4 | instance: _1415_ attribute "attr2" = test_attr2 5 | -------------------------------------------------------------------------------- /test/verilog_attribute.tcl: -------------------------------------------------------------------------------- 1 | # verilog attribute parse/raccess 2 | read_liberty ../examples/sky130hd_tt.lib.gz 3 | read_verilog verilog_attribute.v 4 | link_design counter 5 | create_clock -name clk [get_ports clk] -period 50 6 | 7 | set instance [sta::top_instance] 8 | set cell [$instance cell] 9 | set cell_name [$cell name] 10 | set src_location [$cell get_attribute "src"] 11 | puts "top_instance:\"$cell_name\" attribute \"src\" = $src_location" 12 | 13 | set instance_name "_1415_" 14 | set instance_src_location [[sta::find_instance $instance_name] get_attribute "src"] 15 | set instance_attr1 [[sta::find_instance $instance_name] get_attribute "attr1"] 16 | set instance_attr2 [[sta::find_instance $instance_name] get_attribute "attr2"] 17 | puts "instance: $instance_name attribute \"src\" = $instance_src_location" 18 | puts "instance: $instance_name attribute \"attr1\" = $instance_attr1" 19 | puts "instance: $instance_name attribute \"attr2\" = $instance_attr2" 20 | -------------------------------------------------------------------------------- /test/verilog_attribute.v: -------------------------------------------------------------------------------- 1 | /* Generated by Yosys 0.8+ */ 2 | 3 | (* hdlname = "\\counter" *) 4 | (* top = 1 *) 5 | (* src = "synthesis/tests/counter.v:16.1-32.10" *) 6 | module counter(clk, reset, in, out); 7 | (* src = "synthesis/tests/counter.v:17.14-17.17" *) 8 | input clk; 9 | (* src = "synthesis/tests/counter.v:19.18-19.21" *) 10 | output out; 11 | (* src = "synthesis/tests/counter.v:18.14-18.19" *) 12 | input reset; 13 | input in; 14 | wire mid; 15 | (* bottom_bound = 1'sh0 *) 16 | (* src = "synthesis/tests/counter.v:22.3-28.6", attr1 = "test_attr1", attr2 = "test_attr2" *) 17 | sky130_fd_sc_hd__dfrtp_1 _1415_ ( 18 | .CLK(clk), 19 | .D(in), 20 | .Q(mid), 21 | .RESET_B(reset) 22 | ); 23 | (* src = "synthesis/tests/counter.v:22.3-28.6" *) 24 | sky130_fd_sc_hd__dfrtp_1 \_1416_[0] ( 25 | .CLK(clk), 26 | .D(mid), 27 | .Q(out), 28 | .RESET_B(reset) 29 | ); 30 | endmodule 31 | -------------------------------------------------------------------------------- /util/Error.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "Error.hh" 26 | 27 | #include 28 | #include 29 | 30 | #include "StringUtil.hh" 31 | 32 | namespace sta { 33 | 34 | Exception::Exception() : 35 | std::exception() 36 | { 37 | } 38 | 39 | ExceptionMsg::ExceptionMsg(const char *msg, 40 | const bool suppressed) : 41 | Exception(), 42 | msg_(msg), 43 | suppressed_(suppressed) 44 | { 45 | } 46 | 47 | const char * 48 | ExceptionMsg::what() const noexcept 49 | { 50 | return msg_.c_str(); 51 | } 52 | 53 | ExceptionLine::ExceptionLine(const char *filename, 54 | int line) : 55 | Exception(), 56 | filename_(filename), 57 | line_(line) 58 | { 59 | } 60 | 61 | FileNotReadable::FileNotReadable(const char *filename) : 62 | filename_(filename) 63 | { 64 | } 65 | 66 | const char * 67 | FileNotReadable::what() const noexcept 68 | { 69 | return stringPrintTmp("cannot read file %s.", filename_); 70 | } 71 | 72 | FileNotWritable::FileNotWritable(const char *filename) : 73 | filename_(filename) 74 | { 75 | } 76 | 77 | const char * 78 | FileNotWritable::what() const noexcept 79 | { 80 | return stringPrintTmp("cannot write file %s.", filename_); 81 | } 82 | 83 | } // namespace 84 | -------------------------------------------------------------------------------- /util/FlexDisableRegister.hh: -------------------------------------------------------------------------------- 1 | // centos7 flex 2.5.37 2 | // workaround for flex versions that insert register declarations 3 | #if !(YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 6) && __cplusplus > 199711L 4 | #define register 5 | #endif 6 | 7 | -------------------------------------------------------------------------------- /util/Hash.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "Hash.hh" 26 | 27 | #include 28 | 29 | namespace sta { 30 | 31 | size_t 32 | hashString(const char *str) 33 | { 34 | size_t hash = hash_init_value; 35 | size_t length = strlen(str); 36 | for (size_t i = 0; i < length; i++) 37 | hash = ((hash << 5) + hash) ^ str[i]; 38 | return hash; 39 | } 40 | 41 | } // namespace 42 | -------------------------------------------------------------------------------- /util/Machine.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #if defined(_WIN32) 26 | #include "MachineWin32.cc" 27 | #elif defined(__APPLE__) 28 | #include "MachineApple.cc" 29 | #elif defined(__linux__) 30 | #include "MachineLinux.cc" 31 | #else 32 | #include "MachineUnknown.cc" 33 | #endif 34 | -------------------------------------------------------------------------------- /util/MachineUnknown.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "Machine.hh" 26 | 27 | namespace sta { 28 | 29 | int 30 | processorCount() 31 | { 32 | return 1; 33 | } 34 | 35 | void 36 | initElapsedTime() 37 | { 38 | } 39 | 40 | double 41 | elapsedRunTime() 42 | { 43 | return 0.0; 44 | } 45 | 46 | double 47 | userRunTime() 48 | { 49 | return 0.0; 50 | } 51 | 52 | double 53 | systemRunTime() 54 | { 55 | return 0.0; 56 | } 57 | 58 | size_t 59 | memoryUsage() 60 | { 61 | return 0; 62 | } 63 | 64 | } // namespace 65 | -------------------------------------------------------------------------------- /util/ReportStd.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "ReportStd.hh" 26 | 27 | #include 28 | #include 29 | 30 | #include "Report.hh" 31 | 32 | namespace sta { 33 | 34 | // Output streams that talk to stdout and stderr streams. 35 | class ReportStd : public Report 36 | { 37 | public: 38 | ReportStd(); 39 | 40 | protected: 41 | virtual size_t printConsole(const char *buffer, size_t length); 42 | virtual size_t printErrorConsole(const char *buffer, size_t length); 43 | }; 44 | 45 | Report * 46 | makeReportStd() 47 | { 48 | return new ReportStd; 49 | } 50 | 51 | ReportStd::ReportStd() : 52 | Report() 53 | { 54 | } 55 | 56 | size_t 57 | ReportStd::printConsole(const char *buffer, size_t length) 58 | { 59 | return fwrite(buffer, sizeof(char), length, stdout); 60 | } 61 | 62 | size_t 63 | ReportStd::printErrorConsole(const char *buffer, size_t length) 64 | { 65 | return fwrite(buffer, sizeof(char), length, stderr); 66 | } 67 | 68 | } // namespace 69 | -------------------------------------------------------------------------------- /util/StaConfig.hh.cmake: -------------------------------------------------------------------------------- 1 | #define STA_VERSION "${STA_VERSION}" 2 | 3 | #define STA_GIT_SHA1 "${STA_GIT_SHA1}" 4 | 5 | #cmakedefine ZLIB_FOUND 6 | 7 | #define SSTA ${SSTA} 8 | 9 | #define TCL_READLINE ${TCL_READLINE} 10 | -------------------------------------------------------------------------------- /util/StringSeq.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "StringSeq.hh" 26 | 27 | namespace sta { 28 | 29 | void 30 | deleteContents(StringSeq *strings) 31 | { 32 | StringSeq::Iterator iter(strings); 33 | while (iter.hasNext()) { 34 | const char *string = iter.next(); 35 | stringDelete(string); 36 | } 37 | } 38 | 39 | } // namespace 40 | -------------------------------------------------------------------------------- /util/StringSet.cc: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #include "StringSet.hh" 26 | 27 | namespace sta { 28 | 29 | void 30 | deleteContents(StringSet *strings) 31 | { 32 | StringSet::Iterator iter(strings); 33 | while (iter.hasNext()) { 34 | const char *string = iter.next(); 35 | stringDelete(string); 36 | } 37 | } 38 | 39 | } // namespace 40 | -------------------------------------------------------------------------------- /verilog/Verilog.i: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | %module verilog 26 | 27 | %{ 28 | #include "VerilogWriter.hh" 29 | #include "Sta.hh" 30 | %} 31 | 32 | %inline %{ 33 | 34 | bool 35 | read_verilog_cmd(const char *filename) 36 | { 37 | return Sta::sta()->readVerilog(filename); 38 | } 39 | 40 | void 41 | write_verilog_cmd(const char *filename, 42 | bool sort, 43 | bool include_pwr_gnd, 44 | CellSeq *remove_cells) 45 | { 46 | // This does NOT want the SDC (cmd) network because it wants 47 | // to see the sta internal names. 48 | Network *network = Sta::sta()->network(); 49 | writeVerilog(filename, sort, include_pwr_gnd, remove_cells, network); 50 | delete remove_cells; 51 | } 52 | 53 | %} // inline 54 | -------------------------------------------------------------------------------- /verilog/Verilog.tcl: -------------------------------------------------------------------------------- 1 | # OpenSTA, Static Timing Analyzer 2 | # Copyright (c) 2025, Parallax Software, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | # The origin of this software must not be misrepresented; you must not 18 | # claim that you wrote the original software. 19 | # 20 | # Altered source versions must be plainly marked as such, and must not be 21 | # misrepresented as being the original software. 22 | # 23 | # This notice may not be removed or altered from any source distribution. 24 | 25 | namespace eval sta { 26 | 27 | # Defined by SWIG interface Verilog.i. 28 | define_cmd_args "read_verilog" {filename} 29 | 30 | proc_redirect read_verilog { 31 | read_verilog_cmd [file nativename [lindex $args 0]] 32 | } 33 | 34 | define_cmd_args "write_verilog" {[-sort] [-include_pwr_gnd]\ 35 | [-remove_cells cells] filename} 36 | 37 | proc write_verilog { args } { 38 | parse_key_args "write_verilog" args keys {-remove_cells} \ 39 | flags {-sort -include_pwr_gnd} 40 | 41 | set remove_cells {} 42 | if { [info exists keys(-remove_cells)] } { 43 | set remove_cells [parse_cell_arg $keys(-remove_cells)] 44 | } 45 | set sort [info exists flags(-sort)] 46 | set include_pwr_gnd [info exists flags(-include_pwr_gnd)] 47 | check_argc_eq1 "write_verilog" $args 48 | set filename [file nativename [lindex $args 0]] 49 | write_verilog_cmd $filename $sort $include_pwr_gnd $remove_cells 50 | } 51 | 52 | # sta namespace end 53 | } 54 | -------------------------------------------------------------------------------- /verilog/VerilogScanner.hh: -------------------------------------------------------------------------------- 1 | // OpenSTA, Static Timing Analyzer 2 | // Copyright (c) 2025, Parallax Software, Inc. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // 17 | // The origin of this software must not be misrepresented; you must not 18 | // claim that you wrote the original software. 19 | // 20 | // Altered source versions must be plainly marked as such, and must not be 21 | // misrepresented as being the original software. 22 | // 23 | // This notice may not be removed or altered from any source distribution. 24 | 25 | #pragma once 26 | 27 | #include "VerilogLocation.hh" 28 | #include "VerilogParse.hh" 29 | 30 | #ifndef __FLEX_LEXER_H 31 | #undef yyFlexLexer 32 | #define yyFlexLexer VerilogFlexLexer 33 | #include 34 | #endif 35 | 36 | namespace sta { 37 | 38 | class Report; 39 | 40 | class VerilogScanner : public VerilogFlexLexer 41 | { 42 | public: 43 | VerilogScanner(std::istream *stream, 44 | const char *filename, 45 | Report *report); 46 | virtual ~VerilogScanner() {} 47 | 48 | virtual int lex(VerilogParse::semantic_type *const yylval, 49 | VerilogParse::location_type *yylloc); 50 | // YY_DECL defined in VerilogLex.ll 51 | // Method body created by flex in VerilogLex.cc 52 | 53 | void error(const char *msg); 54 | 55 | // Get rid of override virtual function warning. 56 | using yyFlexLexer::yylex; 57 | 58 | private: 59 | const char *filename_; 60 | Report *report_; 61 | }; 62 | 63 | } // namespace 64 | --------------------------------------------------------------------------------