Building SIS

SIS provides a logic synthesis library libsis.a that is required for Petrify. The following instructions are for SIS 1.3 Unofficial Distribution.

SIS source code needs the following changes to be compatible with modern compilers:

  • Note that restrict is a keyword now and needs to be replaced, e.g. by restrict_var. This effects the following files: espresso/unite.c, sis/espresso/unite.c, sis/minimize/minimize.c
  • In sis/command/filec.c, change line 15 #include <termio.h> to #include <termios.h>.
  • In sis/io/read_kiss.c, edit line 13, changing read_error() to read_error(char *, …).
  • In sis/pld/act_bdd.c, move line 151 static int compare(); to line 144.
  • In sis/pld/act_ite.c move static int compare(); to line 124.
  • In sis/pld/xln_merge.c, move line 299 static sm_row *xln_merge_find_neighbor_of_row1_with_minimum_neighbors(); to line 287.
  • In sis/pld/xln_pert_dec.c, move line 58, static int kernel_value(); to line 50.
  • In sis/Makefile.in change line && $(AR) x ../$$I && $(AR) r ../$@ * \ to && $(AR) x ../$$I && $(AR) r ../$@ *.o \ (this is necessary for OSX build).

While 64-bit SIS can be built with CFLAGS=-m64 or –host=x86_64-w64-mingw32 configure parameter, the produced result is not reliable and often segfaults, especially on Windows and OSX.

for Linux

Build 32-bit SIS for Linux as follows:

./configure CFLAGS=-m32
make

for Windows

Cygwin build is smooth, but it introduces an ugly dependency on cygwin1.dll for compatibility layer. On the other hand, MinGW provides a convenient toolchain for cross-compilation and does not introduce unnecessary dependencies, therefore MinGW will be used to cross-compile for Windows.

  1. Install MinGW-W64 in Ubuntu as follows:
    sudo apt install mingw-w64
    • Use __MINGW32__ macro to distinguish Windows builds.
    • Add -lwinmm to the linker command:
      ifneq ($(findstring mingw32, $(CC)),)
          sis_LDADD = libsis.a -lm -lwinmm
      else
          sis_LDADD = libsis.a -lm
      endif
  2. The primary goal is to build libsis.a library for linking with Petrify without compatibility layer of Cygwin or MSYS2. The following changes and sacrifices had to be made for Windows build:
    • As the terminal API is not supported in Windows, all the SIS interactive functionality is excluded from Windows build.
    • Memory management is switched to malloc instead of default sbrk.
    • Host name is assigned to “unknown” as gethostname function could not be found even when linked with -lws2_32 option.
    • An alternative implementation of signal SIGSTOP in bwd_com.c needs CloseHandle function which however cannot be found at linking. It is commented out which may lead to resource leaks.
    • An alternative implementation of SIGALRM is based on timeSetEvent function that requires -lwinmm at linking.
  3. Build 32-bit SIS for Windows as follows:
    ./configure --host=i686-w64-mingw32
    make

for OSX

  1. Use MacPort to install GCC:
    sudo port install gcc8 +universal
    #sudo port select --list gcc
    sudo port select --set gcc mp-gcc8
      - Install Bison and DOS2Unix: <code shell>
    sudo port install bison
    sudo port install dos2unix
  2. Build 32-bit SIS for OSX as follows:
    ./configure CFLAGS=-m32
    make