Permalink
Browse files

Add the iverilog-vpi command.

  • Loading branch information...
1 parent 0c04e29 commit 1893e7c8e5b2d4e23ff52ddb6a8fd05560b4755d steve committed Apr 7, 2002
Showing with 103 additions and 1 deletion.
  1. +17 −1 Makefile.in
  2. +85 −0 iverilog-vpi.sh
  3. +1 −0 verilog.spec
View
18 Makefile.in
@@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.116 2002/03/09 02:10:22 steve Exp $"
+#ident "$Id: Makefile.in,v 1.117 2002/04/07 00:47:10 steve Exp $"
#
#
SHELL = /bin/sh
@@ -85,6 +85,9 @@ ifeq (@WIN32@,yes)
all: dosify.exe
dosify.exe: dosify.c
$(CC) -o dosify.exe dosify.c
+
+else
+all: iverilog-vpi
endif
# This rule rules the compiler in the trivial hello.vl program to make
@@ -170,6 +173,14 @@ ivl@EXEEXT@: $O
endif
+ifeq (@WIN32@,yes)
+
+else
+iverilog-vpi: iverilog-vpi.sh
+ sed -e 's;@SHARED@;@shared@;' -e 's;@PIC@;@PICFLAG@;' $< > $@
+ chmod +x $@
+endif
+
%.o: %.cc
@[ -d dep ] || mkdir dep
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o
@@ -197,6 +208,8 @@ lexor_keyword.cc: lexor_keyword.gperf
ifeq (@WIN32@,yes)
WIN32_INSTALL = $(prefix)/hello.vl $(prefix)/sqrt.vl $(prefix)/QUICK_START.txt
+else
+WIN32_INSTALL = $(bindir)/iverilog-vpi
endif
install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/vpi_user.h $(libdir)/libvpi.a $(WIN32_INSTALL)
@@ -206,6 +219,9 @@ install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $
for tgt in $(SUBDIRS) $(SUB_VVM); do (cd $$tgt ; $(MAKE) install); done
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) install); done
+$(bindir)/vpi-tool: ./vpi-tool
+ $(INSTALL_PROGRAM) ./vpi-tool $(bindir)/vpi-tool
+
$(libdir)/libvpi.a : ./libvpi.a
$(INSTALL_DATA) libvpi.a $(libdir)/libvpi.a
View
85 iverilog-vpi.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+#
+# This source code is free software; you can redistribute it
+# and/or modify it in source code form under the terms of the GNU
+# Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc.,
+# 59 Temple Place - Suite 330
+# Boston, MA 02111-1307, USA
+#
+#ident "$Id: iverilog-vpi.sh,v 1.1 2002/04/07 00:47:10 steve Exp $"
+
+# These are the variables used for compiling files
+CC=gcc
+CFLAGS="@PIC@ -O"
+
+# These are used for linking...
+LD=gcc
+LDFLAGS="@SHARED@"
+LDLIBS=-lvpi
+
+SRC=
+OBJ=
+LIB=
+OUT=
+
+# --
+# parse the command line switches. This collects the source files
+# and precompiled object files, and maybe user libraries. As we are
+# going, guess an output file name.
+for parm
+do
+ case $parm
+ in
+
+ *.c) SRC="$SRC $parm"
+ if [ x$OUT = x ]; then
+ OUT=`basename $parm .c`
+ fi
+ ;;
+
+ *.o) OBJ="$OBJ $parm"
+ if [ x$OUT = x ]; then
+ OUT=`basename $parm .o`
+ fi
+ ;;
+
+ -l*) LIB="$LIB $parm"
+ ;;
+
+ esac
+
+done
+
+if [ x$OUT = x ]; then
+ echo "Usage: vpi-tool [src and obj files]..."
+ exit 0
+fi
+
+# Put the .vpi on the result file.
+OUT=$OUT".vpi"
+
+# Compile all the source files into object files
+for src
+in $SRC
+do
+ base=`basename $src .c`
+ obj=$base".o"
+
+ echo "Compiling $src..."
+ $CC -c -o $obj $src
+ OBJ="$OBJ $obj"
+done
+
+echo "Making $OUT from $OBJ..."
+$LD -o $OUT $LDFLAGS $OBJ $LDLIBS
View
1 verilog.spec
@@ -38,6 +38,7 @@ make prefix=$RPM_BUILD_ROOT/usr install
%attr(-,root,root) /usr/man/man1/vvp.1.gz
%attr(-,root,root) /usr/bin/iverilog
+%attr(-,root,root) /usr/bin/iverilog-vpi
%attr(-,root,root) /usr/bin/vvp
%attr(-,root,root) /usr/lib/ivl/ivl
%attr(-,root,root) /usr/lib/ivl/ivlpp

0 comments on commit 1893e7c

Please sign in to comment.