Skip to content

Commit

Permalink
cmake, write_path_spice
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Jan 4, 2019
1 parent 735a868 commit 9e5aac3
Show file tree
Hide file tree
Showing 27 changed files with 1,384 additions and 297 deletions.
132 changes: 70 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ set(STA_SOURCE
search/VisitPathEnds.cc
search/VisitPathGroupVertices.cc
search/WorstSlack.cc
search/WriteSpice.cc
search/WritePathSpice.cc

util/Condition.cc
util/Debug.cc
Expand Down Expand Up @@ -346,7 +346,7 @@ set(STA_HEADERS
search/VisitPathEnds.hh
search/VisitPathGroupVertices.hh
search/WorstSlack.hh
search/WriteSpice.hh
search/WritePathSpice.hh

util/Condition.hh
util/Debug.hh
Expand Down Expand Up @@ -514,91 +514,88 @@ get_filename_component(TCL_HEADER_DIR "${TCL_HEADER}" PATH)

################################################################

# TCL files included as part of the executable are shoved into TclInitVar.cc.
# These files are encoded and shipped as part of the executable
# so that they do not have to be installed on the client host.
add_custom_command(OUTPUT ${STA_HOME}/app/TclInitVar.cc
COMMAND etc/TclEncode.tcl app/TclInitVar.cc tcl_inits ${STA_TCL_FILES}
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_TCL_FILES} etc/TclEncode.tcl
)

find_package(FLEX)
find_package(BISON)

# Verilog scan/parse.
bison_target(VerilogParser verilog/VerilogParse.yy ${STA_HOME}/verilog/VerilogParse.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogParse.hh
COMPILE_FLAGS --name-prefix=VerilogParse_
)
# LibertyExpr scan/parse.
bison_target(LibertyExprParser liberty/LibertyExprParse.yy ${STA_HOME}/liberty/LibertyExprParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprParse.hh
COMPILE_FLAGS --name-prefix=LibertyExprParse_
)

# flex seems to ignore -o<file>
add_custom_command(OUTPUT ${STA_HOME}/verilog/VerilogLex.cc ${STA_HOME}/verilog/VerilogLex.hh
COMMAND ${FLEX_EXECUTABLE} --prefix=VerilogLex_ --header-file=${STA_HOME}/verilog/VerilogLex.hh ${STA_HOME}/verilog/VerilogLex.ll
COMMAND mv lex.yy.c ${STA_HOME}/verilog/VerilogLex.cc
flex_target(LibertyExprLex liberty/LibertyExprLex.ll ${STA_HOME}/liberty/LibertyExprLex.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprLex.hh
COMPILE_FLAGS --prefix=LibertyExprLex_
)

add_flex_bison_dependency(LibertyExprLex LibertyExprParser)

# Liberty scan/parse.
bison_target(LibertyParser liberty/LibertyParse.yy ${STA_HOME}/liberty/LibertyParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyParse.hh
COMPILE_FLAGS --name-prefix=LibertyParse_
)

# flex seems to ignore -o<file>
add_custom_command(OUTPUT ${STA_HOME}/liberty/LibertyLex.cc ${STA_HOME}/liberty/LibertyLex.hh
COMMAND ${FLEX_EXECUTABLE} --prefix=LibertyLex_ --header-file=${STA_HOME}/liberty/LibertyLex.hh ${STA_HOME}/liberty/LibertyLex.ll
COMMAND mv lex.yy.c ${STA_HOME}/liberty/LibertyLex.cc
)

# LibertyExpr scan/parse.
bison_target(LibertyExprParser liberty/LibertyExprParse.yy ${STA_HOME}/liberty/LibertyExprParse.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyExprParse.hh
COMPILE_FLAGS --name-prefix=LibertyExprParse_
)

# flex seems to ignore -o<file>
add_custom_command(OUTPUT ${STA_HOME}/liberty/LibertyExprLex.cc ${STA_HOME}/liberty/LibertyExprLex.hh
COMMAND ${FLEX_EXECUTABLE} --prefix=LibertyExprLex_ --header-file=${STA_HOME}/liberty/LibertyExprLex.hh ${STA_HOME}/liberty/LibertyExprLex.ll
COMMAND mv lex.yy.c ${STA_HOME}/liberty/LibertyExprLex.cc
)

# Sdf scan/parse.
bison_target(SdfParser sdf/SdfParse.yy ${STA_HOME}/sdf/SdfParse.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfParse.hh
COMPILE_FLAGS --name-prefix=SdfParse_
)
flex_target(LibertyLex liberty/LibertyLex.ll ${STA_HOME}/liberty/LibertyLex.cc
DEFINES_FILE ${STA_HOME}/liberty/LibertyLex.hh
COMPILE_FLAGS --prefix=LibertyLex_
)

# flex seems to ignore -o<file>
add_custom_command(OUTPUT ${STA_HOME}/sdf/SdfLex.cc ${STA_HOME}/sdf/SdfLex.hh
COMMAND ${FLEX_EXECUTABLE} --prefix=SdfLex_ --header-file=${STA_HOME}/sdf/SdfLex.hh ${STA_HOME}/sdf/SdfLex.ll
COMMAND mv lex.yy.c ${STA_HOME}/sdf/SdfLex.cc
)
add_flex_bison_dependency(LibertyLex LibertyParser)

# Spef scan/parse.
bison_target(SpefParser parasitics/SpefParse.yy ${STA_HOME}/parasitics/SpefParse.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpefParse.hh
COMPILE_FLAGS --name-prefix=SpefParse_
)
DEFINES_FILE ${STA_HOME}/parasitics/SpefParse.hh
COMPILE_FLAGS --name-prefix=SpefParse_
)

# flex seems to ignore -o<file>
add_custom_command(OUTPUT ${STA_HOME}/parasitics/SpefLex.cc ${STA_HOME}/parasitics/SpefLex.hh
COMMAND ${FLEX_EXECUTABLE} --prefix=SpefLex_ --header-file=${STA_HOME}/parasitics/SpefLex.hh ${STA_HOME}/parasitics/SpefLex.ll
COMMAND mv lex.yy.c ${STA_HOME}/parasitics/SpefLex.cc
)
flex_target(SpefLex parasitics/SpefLex.ll ${STA_HOME}/parasitics/SpefLex.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpefLex.hh
COMPILE_FLAGS --prefix=SpefLex_
)

add_flex_bison_dependency(SpefLex SpefParser)

# Spf scan/parse.
bison_target(SpfParser parasitics/SpfParse.yy ${STA_HOME}/parasitics/SpfParse.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpfParse.hh
COMPILE_FLAGS --name-prefix=SpfParse_
DEFINES_FILE ${STA_HOME}/parasitics/SpfParse.hh
COMPILE_FLAGS --name-prefix=SpfParse_
)

flex_target(SpfLex parasitics/SpfLex.ll ${STA_HOME}/parasitics/SpfLex.cc
DEFINES_FILE ${STA_HOME}/parasitics/SpfLex.hh
COMPILE_FLAGS --prefix=SpfLex_
)

add_flex_bison_dependency(SpfLex SpfParser)

# Verilog scan/parse.
bison_target(VerilogParser verilog/VerilogParse.yy ${STA_HOME}/verilog/VerilogParse.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogParse.hh
COMPILE_FLAGS --name-prefix=VerilogParse_
)

# flex seems to ignore -o<file>
add_custom_command(OUTPUT ${STA_HOME}/parasitics/SpfLex.cc ${STA_HOME}/parasitics/SpfLex.hh
COMMAND ${FLEX_EXECUTABLE} --prefix=SpfLex_ --header-file=${STA_HOME}/parasitics/SpfLex.hh ${STA_HOME}/parasitics/SpfLex.ll
COMMAND mv lex.yy.c ${STA_HOME}/parasitics/SpfLex.cc
flex_target(VerilogLex verilog/VerilogLex.ll ${STA_HOME}/verilog/VerilogLex.cc
DEFINES_FILE ${STA_HOME}/verilog/VerilogLex.hh
COMPILE_FLAGS --prefix=VerilogLex_
)

add_flex_bison_dependency(VerilogLex VerilogParser)

# Sdf scan/parse.
bison_target(SdfParser sdf/SdfParse.yy ${STA_HOME}/sdf/SdfParse.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfParse.hh
COMPILE_FLAGS --name-prefix=SdfParse_
)

flex_target(SdfLex sdf/SdfLex.ll ${STA_HOME}/sdf/SdfLex.cc
DEFINES_FILE ${STA_HOME}/sdf/SdfLex.hh
COMPILE_FLAGS --prefix=SdfLex_
)

add_flex_bison_dependency(SdfLex SdfParser)


################################################################

include(FindSWIG)
Expand All @@ -612,6 +609,17 @@ add_custom_command(OUTPUT ${STA_HOME}/app/StaApp_wrap.cc

################################################################

# TCL files included as part of the executable are shoved into TclInitVar.cc.
# These files are encoded and shipped as part of the executable
# so that they do not have to be installed on the client host.
add_custom_command(OUTPUT ${STA_HOME}/app/TclInitVar.cc
COMMAND etc/TclEncode.tcl app/TclInitVar.cc tcl_inits ${STA_TCL_FILES}
WORKING_DIRECTORY ${STA_HOME}
DEPENDS ${STA_TCL_FILES} etc/TclEncode.tcl
)

################################################################

set(STA_INCLUDE_DIRS
app
dcalc
Expand Down
76 changes: 43 additions & 33 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Building from a dist tarfile does not require the GNU Autotools, Bison
or Flex to be installed and is the recommended method unless you are a
developer.

Builds are also supported with cmake described later in this file.
Autotools based builds are currently supported for compatibility but
are deprecated.

Building from a tarfile
-----------------------

Expand Down Expand Up @@ -65,6 +69,10 @@ handling. It is available here:
https://www.davidkebo.com/source/cudd_versions/cudd-3.0.0.tar.gz
https://sourceforge.net/projects/cudd-mirror/

Note that the file hierarchy of the CUDD installation changed with
version 3.0. This build only supports the 3.0 layout but only small
changes to configure.ac are required to support older versions.

The Zlib library is an optional. If the configure script finds libz,
OpenSTA can read Verilog, SDF, SPF, and SPEF files compressed with
gzip.
Expand Down Expand Up @@ -108,6 +116,41 @@ it.
./configure [options...]
make

Building with Cmake
-------------------

Building with cmake requires bison and flex.

git clone https://xp-dev.com/git/opensta
cd opensta
mkdir build
cd build
cmake ../
make

The resulting executable is app/sta for compatibility with configure.
The library without main is app/libSTA.a.

Optional cmake variables passed as -D<var>=<value> arguments to cmake.

MAKE_BUILD_TYPE DEBUG|RELEASE
TCL_LIB - path to tcl library
TCL_HEADER - path to tcl.h
TCL_INIT - path to init.tcl
CMAKE_INSTALL_PREFIX

If TCL_LIB is specified the cmake script will attempt to locate
the header and init files from its path.

Default install directory is /usr/local.
To install in a different directory with cmake use:

cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>

or use the DESTDIR variable with make.

make DESTDIR=<prefix_path> install

Building on Windoz
------------------
The Win32 API does not natively support the pthreads API. The
Expand Down Expand Up @@ -148,36 +191,3 @@ form:
All commands in one .tcl file (usually run.tcl) for small cases
No calls to "exit"
No shell scripts to envoke the sta.

----------------------------------------------------------------
Building with Cmake

git clone https://xp-dev.com/git/opensta
cd opensta
mkdir build
cd build
cmake ../
make

The resulting executable is app/sta for compatibility with configure.
The library without main is app/libSTA.a.

Optional cmake variables passed as -D<var>=<value> arguments to cmake.

MAKE_BUILD_TYPE DEBUG|RELEASE
TCL_LIB - path to tcl library
TCL_HEADER - path to tcl.h
TCL_INIT - path to init.tcl
CMAKE_INSTALL_PREFIX

If TCL_LIB is specified the cmake script will attempt to locate
the header and init files from its path.

Default install directory is /usr/local.
To install in a different directory with cmake use:

cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>

or use the DESTDIR variable with make.

make DESTDIR=<prefix_path> install
3 changes: 3 additions & 0 deletions app/StaMain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ staTclAppInit(Tcl_Interp *interp)
int argc = sta_argc;
char **argv = sta_argv;

// source init.tcl
Tcl_Init(interp);

// Define swig commands.
sta_swig_init(interp);

Expand Down
3 changes: 2 additions & 1 deletion doc/BugLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Release 2.0 Patches
2018/11/08 corners > 2 causes internal error
2018/11/09 Verilog ignore attributes (* blah *)
2018/12/24 all_fanout from input port
2018/12/25 liberty pg_types
2018/12/25 liberty pg_types
2019/01/03 liberty 2D bus names
Binary file modified doc/OpenSTA.odt
Binary file not shown.
Binary file modified doc/OpenSTA.pdf
Binary file not shown.
13 changes: 11 additions & 2 deletions liberty/Liberty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -778,9 +778,18 @@ LibertyLibrary::addSupplyVoltage(const char *supply_name,
}

float
LibertyLibrary::supplyVoltage(const char *supply_name)
LibertyLibrary::supplyVoltage(const char *supply_name) const
{
return supply_voltage_map_[supply_name];
float voltage;
bool exists;
supply_voltage_map_.findKey(supply_name, voltage, exists);
return voltage;
}

bool
LibertyLibrary::supplyExists(const char *supply_name) const
{
return supply_voltage_map_.hasKey(supply_name);
}

////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion liberty/Liberty.hh
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ public:
void addOcvDerate(OcvDerate *derate);
void addSupplyVoltage(const char *suppy_name,
float voltage);
float supplyVoltage(const char *suppy_name);
bool supplyExists(const char *suppy_name) const;
float supplyVoltage(const char *suppy_name) const;

// Make scaled cell. Call LibertyCell::addScaledCell after it is complete.
LibertyCell *makeScaledCell(const char *name,
Expand Down
2 changes: 0 additions & 2 deletions liberty/LibertyExprLex.ll
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ libertyExprFlushBuffer()
%}

/* %option debug */
%option prefix="LibertyExprLex_"
%option outfile="lex.yy.c"
%option noyywrap
%option nounput
%option never-interactive
Expand Down
4 changes: 2 additions & 2 deletions liberty/LibertyLex.ll
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ libertyParseFlushBuffer()
%}

/* %option debug */
%option prefix="LibertyLex_"
%option outfile="lex.yy.c"
%option noyywrap
%option nounput
%option never-interactive
Expand All @@ -63,6 +61,7 @@ BUS_SUB {BUS_LEFT}{DIGIT}+{BUS_RIGHT}
BUS_RANGE {BUS_LEFT}{DIGIT}+:{DIGIT}+{BUS_RIGHT}
PIN_NAME ({ALPHA}|_)({ALPHA}|{DIGIT}|_)*
BUS_NAME {PIN_NAME}({BUS_SUB}|{BUS_RANGE})
BUS_NAME2 {PIN_NAME}{BUS_SUB}({BUS_SUB}|{BUS_RANGE})
MIXED_NAME {BUS_NAME}_{PIN_NAME}
HNAME ({PIN_NAME}|{BUS_NAME}|{MIXED_NAME})([\/.]({PIN_NAME}|{BUS_NAME}|{MIXED_NAME}))+
/* ocv_table_template(2D_ocv_template) */
Expand Down Expand Up @@ -97,6 +96,7 @@ EOL \r?\n

{PIN_NAME}{TOKEN_END} |
{BUS_NAME}{TOKEN_END} |
{BUS_NAME2}{TOKEN_END} |
{MIXED_NAME}{TOKEN_END} |
{HNAME}{TOKEN_END} |
{BUS_STYLE}{TOKEN_END} |
Expand Down
1 change: 0 additions & 1 deletion liberty/LibertyParse.yy
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ int LibertyParse_error(const char *msg);
sta::LibertyStmt *stmt;
}


%token <number> FLOAT
%token <string> STRING KEYWORD

Expand Down
6 changes: 6 additions & 0 deletions liberty/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ libliberty_la_SOURCES = \

LibertyExprLex.ll: LibertyExprParse.hh

LibertyExprLex.cc: LibertyExprLex.ll
$(LEX) $(LFLAGS) -o LibertyExprLex.cc --prefix=LibertyExprLex_ --header-file=LibertyExprLex.hh LibertyExprLex.ll

LibertyLex.cc: LibertyLex.ll
$(LEX) $(LFLAGS) -o LibertyLex.cc --prefix=LibertyLex_ --header-file=LibertyLex.hh LibertyLex.ll

LibertyLex.ll: LibertyParse.hh

# Rules to support automake pre 1.12 that name header .h instead of .hh
Expand Down
Loading

0 comments on commit 9e5aac3

Please sign in to comment.