User Tools

Site Tools


devel:backend:sis

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.

Note that restrict is keyword now, therefore replace restrict by restrict_var in all the source files.

for Linux

Build SIS for Linux as follows:

  • 32-bit SIS for Linux:
    ./configure CFLAGS=-m32
    make

  • 64-bit SIS for Linux:

    ./configure CFLAGS=-m64
    make

for Windows

Cygwin build is smooth, but it introduces 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 SIS foe Windows:
    • 32-bit SIS for Windows:

      ./configure --host=i686-w64-mingw32
      make

    • 64-bit SIS for Windows:

      ./configure --host=x86_64-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
     
    sudo port install bison
    sudo port install dos2unix

  2. Download and extract the sis source code.
  3. In a terminal, navigate to the extracted sis folder sis-1.3.6.
  4. Run CFLAGS=-m32 CPPFLAGS=-m32 ./configure
  5. Running make at this point will throw several errors. To fix these do the following (remember to save changes after editing):
    • In file sis/espresso/unate.c replace all uses of the variable name restrict with something else, as restrict is a protected word in C++. We suggest replacing with restrict_var.
    • Perform the same changes for espresso/unate.c.
    • Edit file sis/command/filec.c, change line 15 #include <termio.h> to #include <termios.h>.
    • In file sis/io/read_kiss.c, edit line 13, changing read_error() to read_error(char *, …).
    • In file sis/minimize/minimize.c replace all variables named restrict to restrict_var.
    • In file sis/pld/act_bdd.c, move line 151 static int compare(); to outside of this function, such as to line 144.
    • In file sis/pld/act_ite.c move static int compare(); to outside of this function, such as to line 124.
    • In file sis/pld/xln_merge.c, move line 299 static sm_row *xln_merge_find_neighbor_of_row1_with_minimum_neighbors(); outside of this function, to line 287, for example.
    • In file sis/pld/xln_pert_dec.c, move line 58, static int kernel_value(); outside of this function, for example to line 50.
  6. Run make clean.
  7. Running make will now correctly build sis, and produce a file sis/libsis.a needed for petrify.