Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
399 changes: 124 additions & 275 deletions .github/workflows/release.yml

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ jobs:

- name: Install dependencies
run: |
brew install bison
pip3 install --break-system-packages docopt
brew bundle install

- name: Build, check and install
run: |
export PATH="/usr/local/opt/bison/bin:$PATH"
autoconf
eval "$(brew bundle env)"
autoreconf -vfi
./configure --enable-libveriuser
make -j$(nproc) check
sudo make install
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,8 @@ dep
# Silimate added
/build/
*.dSYM
/.venv
/venv
/pfx
__pycache__
/wheelhouse
6 changes: 6 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
brew "flex"
brew "bison"
brew "gperf"
brew "libtool"
brew "autoconf"
brew "bzip2"
11 changes: 8 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ AC_CONFIG_HEADERS([tgt-pcb/pcb_config.h])

AC_CANONICAL_HOST
dnl Checks for programs.

dnl SILIMATE: c23 compile option gets propagated to iverilog-vpi which breaks
dnl on systems as recent as Ubuntu 24.04
ac_cv_prog_cc_c23=no

AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PREREQ([2.62])
Expand Down Expand Up @@ -104,12 +109,12 @@ AS_IF( [test "x$with_m32" = xyes],
[])

CFLAGS="$CTARGETFLAGS $CFLAGS"
# Cygwin does not declare strdup() for C++ 11 by default so use gnu++11
# Cygwin does not declare strdup() for C++ 17 by default so use gnu++11
# to expose the declaration.
decl_cxx_std="-std=c++11"
decl_cxx_std="-std=c++17"
case "${host}" in
*-*-cygwin*)
decl_cxx_std="-std=gnu++11"
decl_cxx_std="-std=gnu++17"
;;
esac
CXXFLAGS="$CTARGETFLAGS $CXXFLAGS $decl_cxx_std"
Expand Down
9 changes: 7 additions & 2 deletions driver/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pdfdir = @docdir@
dllib=@DLLIB@

CC = @CC@
CXX = @CXX@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
Expand All @@ -53,7 +54,7 @@ CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
LDFLAGS = @LDFLAGS@

O = main.o substit.o cflexor.o cfparse.o
O = main.o substit.o cflexor.o cfparse.o driver_portable.o

all: dep iverilog@EXEEXT@ iverilog.man

Expand Down Expand Up @@ -83,7 +84,7 @@ dep:
mkdir dep

iverilog@EXEEXT@: $O
$(CC) $(LDFLAGS) $O -o iverilog@EXEEXT@ @EXTRALIBS@
$(CXX) $(LDFLAGS) $O -o iverilog@EXEEXT@ @EXTRALIBS@

cflexor.c: $(srcdir)/cflexor.lex
$(LEX) -s -t $< > $@
Expand All @@ -92,6 +93,10 @@ cflexor.c: $(srcdir)/cflexor.lex
cfparse%c cfparse%h: $(srcdir)/cfparse%y
$(YACC) --verbose -t -p cf -d -o cfparse.c $<

%.o: %.cc
$(CXX) -std=c++17 $(CPPFLAGS) $(CFLAGS) @DEPENDENCY_FLAG@ -DIVL_LIB='"@libdir@"' -DIVL_INCLUDE_INSTALL_DIR="\"$(realpath $(DESTDIR)/$(includedir))\"" -c $< -o $*.o
mv $*.d dep

%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
mv $*.d dep
Expand Down
51 changes: 51 additions & 0 deletions driver/driver_portable.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2026 Silimate Inc.
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// SILIMATE: This file can find the appropriate prefix for a relocated driver,
// which is needed for wheels.
//
// C++17 with std::filesystem required.
#include <filesystem>
#include <unistd.h>
#include <cstdio>
#include <cstring>

#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif

namespace fs = std::filesystem;

extern "C" void print_runtime_paths_portable(const char *ivl_root) {
auto prefix = fs::canonical(fs::path(ivl_root)).parent_path().parent_path();
auto include_dir = prefix / "include";
if (fs::exists(include_dir)) {
printf("includedir: %s\n", include_dir.c_str());
} else {
printf("includedir: %s\n", IVL_INCLUDE_INSTALL_DIR);
}

// SILIMATE: unlike upstream function, we also print the libdir
auto lib_dir = prefix / "lib";
if (fs::exists(lib_dir)) {
printf("libdir: %s\n", lib_dir.c_str());
} else {
printf("libdir: %s\n", IVL_LIB);
}

}
9 changes: 8 additions & 1 deletion driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ const char HELP[] =
# include <libiberty.h>
#endif
#endif
#ifdef __APPLE__
#include <mach-o/dyld.h> // _NSGetExecutablePath
#endif
#include <fcntl.h>

#ifdef HAVE_GETOPT_H
Expand Down Expand Up @@ -1101,6 +1104,9 @@ static void print_runtime_paths(void) {
printf("includedir: %s\n", IVL_INCLUDE_INSTALL_DIR);
}

// SILIMATE: portable binary versions
extern void print_runtime_paths_portable(const char *);

int main(int argc, char **argv)
{
int e_flag = 0;
Expand Down Expand Up @@ -1258,7 +1264,8 @@ int main(int argc, char **argv)
break;

case 'R':
print_runtime_paths();
// SILIMATE: use portable version
print_runtime_paths_portable(ivl_root);
return 0;

case 'S':
Expand Down
Loading
Loading