Skip to content

Commit

Permalink
Cygwin port changes from Venkat
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Sep 30, 2000
1 parent c12e0f5 commit b34a451
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 95 deletions.
44 changes: 22 additions & 22 deletions Makefile.in
Expand Up @@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.69 2000/09/23 05:15:07 steve Exp $" #ident "$Id: Makefile.in,v 1.70 2000/09/30 03:20:47 steve Exp $"
# #
# #
SHELL = /bin/sh SHELL = /bin/sh
Expand Down Expand Up @@ -51,20 +51,20 @@ CPPFLAGS = @CPPFLAGS@ @DEFS@
CXXFLAGS = @CXXFLAGS@ -I$(srcdir) CXXFLAGS = @CXXFLAGS@ -I$(srcdir)
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@


all: ivl verilog iverilog all: ivl@EXEEXT@ verilog iverilog@EXEEXT@
cd vpi ; $(MAKE) all
cd vvm ; $(MAKE) all cd vvm ; $(MAKE) all
cd vpi ; $(MAKE) all
cd ivlpp ; $(MAKE) all cd ivlpp ; $(MAKE) all


clean: clean:
rm -f *.o parse.cc parse.cc.output parse.h dep/*.d lexor.cc lexor_keyword.cc verilog iverilog rm -f *.o parse.cc parse.cc.output parse.h dep/*.d lexor.cc lexor_keyword.cc verilog iverilog@EXEEXT@
cd vpi ; $(MAKE) clean
cd vvm ; $(MAKE) clean cd vvm ; $(MAKE) clean
cd vpi ; $(MAKE) clean
cd ivlpp ; $(MAKE) clean cd ivlpp ; $(MAKE) clean


distclean: clean distclean: clean
rm -f vpi/Makefile
rm -f vvm/Makefile rm -f vvm/Makefile
rm -f vpi/Makefile
rm -f ivlpp/Makefile rm -f ivlpp/Makefile
rm -f config.status config.cache config.log rm -f config.status config.cache config.log
rm -f Makefile rm -f Makefile
Expand Down Expand Up @@ -104,11 +104,11 @@ verilog: $(srcdir)/verilog.sh
-e 's;@dllib@;@DLLIB@;' \ -e 's;@dllib@;@DLLIB@;' \
-e 's;@$(tmp4)@;@CXX@;' < $< > $@ -e 's;@$(tmp4)@;@CXX@;' < $< > $@


ivl: $O ivl@EXEEXT@: $O
$(CXX) $(CXXFLAGS) $(rdynamic) -o ivl $O $(dllib) $(CXX) $(CXXFLAGS) $(rdynamic) -o ivl@EXEEXT@ $O $(dllib)


iverilog: iverilog.c iverilog@EXEEXT@: iverilog.c
$(CC) $(CPPFLAGS) -o iverilog -DCXX='"@CXX@"' -DIVL_ROOT='"@libdir@/ivl"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DRDYNAMIC=\"$(rdynamic)\" -DDLLIB='"@DLLIB@"' iverilog.c $(CC) $(CPPFLAGS) -o iverilog@EXEEXT@ -DCXX='"@CXX@"' -DIVL_ROOT='"@libdir@/ivl"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DRDYNAMIC=\"$(rdynamic)\" -DDLLIB='"@DLLIB@"' iverilog.c


%.o dep/%.d: %.cc %.o dep/%.d: %.cc
@[ -d dep ] || mkdir dep @[ -d dep ] || mkdir dep
Expand Down Expand Up @@ -136,18 +136,18 @@ lexor_keyword.cc: lexor_keyword.gperf
gperf -o -i 7 -C -k 1-3,$$ -L ANSI-C -H keyword_hash -N check_identifier -t lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false) gperf -o -i 7 -C -k 1-3,$$ -L ANSI-C -H keyword_hash -N check_identifier -t lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)




install: all installdirs $(bindir)/iverilog $(libdir)/ivl/ivl $(includedir)/ivl_target.h $(mandir)/man1/iverilog.1 install: all installdirs $(bindir)/iverilog@EXEEXT@ $(libdir)/ivl/ivl@EXEEXT@ $(includedir)/ivl_target.h $(mandir)/man1/iverilog.1
cd vpi ; $(MAKE) install
cd vvm ; $(MAKE) install cd vvm ; $(MAKE) install
cd vpi ; $(MAKE) install
cd ivlpp ; $(MAKE) install cd ivlpp ; $(MAKE) install


$(bindir)/iverilog: ./iverilog $(bindir)/iverilog@EXEEXT@: ./iverilog@EXEEXT@
$(INSTALL_PROGRAM) ./iverilog $(bindir)/iverilog $(INSTALL_PROGRAM) ./iverilog@EXEEXT@ $(bindir)/iverilog@EXEEXT@
$(STRIP) $(bindir)/iverilog $(STRIP) $(bindir)/iverilog@EXEEXT@


$(libdir)/ivl/ivl: ./ivl $(libdir)/ivl/ivl@EXEEXT@: ./ivl@EXEEXT@
$(INSTALL_PROGRAM) ./ivl $(libdir)/ivl/ivl $(INSTALL_PROGRAM) ./ivl@EXEEXT@ $(libdir)/ivl/ivl@EXEEXT@
$(STRIP) $(libdir)/ivl/ivl $(STRIP) $(libdir)/ivl/ivl@EXEEXT@


$(includedir)/ivl_target.h: $(srcdir)/ivl_target.h $(includedir)/ivl_target.h: $(srcdir)/ivl_target.h
$(INSTALL_DATA) $(srcdir)/ivl_target.h $(includedir)/ivl_target.h $(INSTALL_DATA) $(srcdir)/ivl_target.h $(includedir)/ivl_target.h
Expand All @@ -159,10 +159,10 @@ installdirs: mkinstalldirs
$(srcdir)/mkinstalldirs $(bindir) $(includedir) $(libdir)/ivl $(mandir)/man1 $(srcdir)/mkinstalldirs $(bindir) $(includedir) $(libdir)/ivl $(mandir)/man1


uninstall: uninstall:
rm -f $(libdir)/ivl/ivl rm -f $(libdir)/ivl/ivl@EXEEXT@
rm -f $(bindir)/verilog rm -f $(bindir)/verilog@EXEEXT@
rm -f $(bindir)/gverilog rm -f $(bindir)/gverilog@EXEEXT@
rm -f $(bindir)/iverilog rm -f $(bindir)/iverilog@EXEEXT@
rm -r $(includedir)/ivl_target.h rm -r $(includedir)/ivl_target.h
rm -f $(mandir)/man1/verilog.1 rm -f $(mandir)/man1/verilog.1
rm -f $(mandir)/man1/iverilog.1 rm -f $(mandir)/man1/iverilog.1
Expand Down
3 changes: 3 additions & 0 deletions README.txt
Expand Up @@ -399,6 +399,9 @@ removed from the list) send e-mail to me.
Solaris/SPARC packages (.pkg) Solaris/SPARC packages (.pkg)
Dan McMahill <mcmahill@mtl.mit.edu> Dan McMahill <mcmahill@mtl.mit.edu>


Cygwin32/*
Venkat Iyer <venkat@comit.com>

(*) These are not the only systems where Icarus Verilog has been run, (*) These are not the only systems where Icarus Verilog has been run,
just the systems where precompiled binaries are publicly available. just the systems where precompiled binaries are publicly available.


Expand Down
24 changes: 21 additions & 3 deletions configure.in
Expand Up @@ -10,28 +10,42 @@ AC_PROG_INSTALL
AC_CHECK_LIB(dl,main,[DLLIB=-ldl]) AC_CHECK_LIB(dl,main,[DLLIB=-ldl])
AC_SUBST(DLLIB) AC_SUBST(DLLIB)
AC_CANONICAL_HOST AC_CANONICAL_HOST
$host # $host


####################### #######################
## test for underscores. The vpi module loader in vvm needs to know this ## test for underscores. The vpi module loader in vvm needs to know this
## in order to know the name of the start symbol for the .vpi module. ## in order to know the name of the start symbol for the .vpi module.
####################### #######################


AC_CYGWIN
AC_EXEEXT
AC_SUBST(EXEEXT)

AC_MSG_CHECKING("for leading and/or trailing underscores") AC_MSG_CHECKING("for leading and/or trailing underscores")
cat << EOF > underscore.c cat << EOF > underscore.c
void underscore(void){} void underscore(void){}
EOF EOF
$CC -c underscore.c > /dev/null 2>&1 $CC -shared -c underscore.c > /dev/null 2>&1


CC_LEADING_UNDERSCORE=no CC_LEADING_UNDERSCORE=no
CC_TRAILING_UNDERSCORE=no CC_TRAILING_UNDERSCORE=no


output=`nm underscore.o|grep _underscore 2>&1` output=`nm underscore.o|grep _underscore 2>&1`
if test ! -z "$output"; then if test ! -z "$output" -a -z "$CYGWIN" ; then
CC_LEADING_UNDERSCORE=yes CC_LEADING_UNDERSCORE=yes
AC_DEFINE(NEED_LU) AC_DEFINE(NEED_LU)
fi fi


PICFLAG=-fPIC

if test ! -z "$CYGWIN" ; then
PICFLAG=
AC_DEFINE(USE_LIBVPIP)
fi

AC_SUBST(CYGWIN)
AC_SUBST(PICFLAG)

output=`nm underscore.o|grep underscore_ 2>&1` output=`nm underscore.o|grep underscore_ 2>&1`
if test ! -z "$output"; then if test ! -z "$output"; then
CC_TRAILING_UNDERSCORE=yes CC_TRAILING_UNDERSCORE=yes
Expand Down Expand Up @@ -69,6 +83,10 @@ case "${host}" in
rdynamic="" rdynamic=""
;; ;;


*-*-cygwin*)
rdynamic=""
;;

esac esac


AC_SUBST(rdynamic) AC_SUBST(rdynamic)
Expand Down
17 changes: 15 additions & 2 deletions iverilog.c
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: iverilog.c,v 1.21 2000/09/12 01:17:19 steve Exp $" #ident "$Id: iverilog.c,v 1.22 2000/09/30 03:20:47 steve Exp $"
#endif #endif


#include <stdio.h> #include <stdio.h>
Expand All @@ -28,6 +28,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>


#if HAVE_GETOPT_H
#include <getopt.h>
#endif

#ifndef IVL_ROOT #ifndef IVL_ROOT
# define IVL_ROOT "." # define IVL_ROOT "."
#endif #endif
Expand All @@ -36,6 +40,12 @@
# define RDYNAMIC "-rdynamic" # define RDYNAMIC "-rdynamic"
#endif #endif


#ifdef USE_LIBVPIP
# define LIBVPIP "-lvpip"
#else
# define LIBVPIP ""
#endif

const char*base = IVL_ROOT; const char*base = IVL_ROOT;
const char*mtm = 0; const char*mtm = 0;
const char*opath = "a.out"; const char*opath = "a.out";
Expand Down Expand Up @@ -195,7 +205,7 @@ static int t_vvm(char*cmd, unsigned ncmd)
} }


sprintf(tmp, "%s -O " RDYNAMIC " -fno-exceptions -o %s -I%s " sprintf(tmp, "%s -O " RDYNAMIC " -fno-exceptions -o %s -I%s "
"-L%s %s.cc -lvvm %s", CXX, opath, IVL_INC, IVL_LIB, "-L%s %s.cc -lvvm " LIBVPIP "%s", CXX, opath, IVL_INC, IVL_LIB,
opath, DLLIB); opath, DLLIB);


if (verbose_flag) if (verbose_flag)
Expand Down Expand Up @@ -491,6 +501,9 @@ int main(int argc, char **argv)


/* /*
* $Log: iverilog.c,v $ * $Log: iverilog.c,v $
* Revision 1.22 2000/09/30 03:20:47 steve
* Cygwin port changes from Venkat
*
* Revision 1.21 2000/09/12 01:17:19 steve * Revision 1.21 2000/09/12 01:17:19 steve
* Oops, the -m flag takes a parameter and needs the : * Oops, the -m flag takes a parameter and needs the :
* *
Expand Down
12 changes: 9 additions & 3 deletions vpi/Makefile.in
Expand Up @@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.11 2000/08/12 20:54:33 steve Exp $" #ident "$Id: Makefile.in,v 1.12 2000/09/30 03:20:47 steve Exp $"
# #
# #
SHELL = /bin/sh SHELL = /bin/sh
Expand All @@ -41,7 +41,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@


CPPFLAGS = @CPPFLAGS@ @DEFS@ -fPIC CPPFLAGS = @CPPFLAGS@ @DEFS@ @PICFLAG@ -DBUILD_vpi
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@


Expand All @@ -55,8 +55,14 @@ all: system.vpi
O = sys_table.o sys_display.o sys_finish.o sys_random.o \ O = sys_table.o sys_display.o sys_finish.o sys_random.o \
sys_readmem.o sys_readmem_lex.o sys_vcd.o sys_readmem.o sys_readmem_lex.o sys_vcd.o


ifeq (@CYGWIN@,yes)
SYSTEM_VPI_LDFLAGS=-Wl,--enable-auto-image-base -L../vvm -lvvm -lvpip
else
SYSTEM_VPI_LDFLAGS=
endif

system.vpi: $O system.vpi: $O
$(CC) -shared -o $@ $O $(CC) -shared -o $@ $O $(SYSTEM_VPI_LDFLAGS)


sys_readmem_lex.c: sys_readmem_lex.lex sys_readmem_lex.c: sys_readmem_lex.lex
flex -t -Preadmem sys_readmem_lex.lex > sys_readmem_lex.c flex -t -Preadmem sys_readmem_lex.lex > sys_readmem_lex.c
Expand Down
9 changes: 8 additions & 1 deletion vpi/sys_table.c
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: sys_table.c,v 1.5 2000/05/04 03:37:59 steve Exp $" #ident "$Id: sys_table.c,v 1.6 2000/09/30 03:20:47 steve Exp $"
#endif #endif


extern void sys_finish_register(); extern void sys_finish_register();
Expand All @@ -35,9 +35,16 @@ void (*vlog_startup_routines[])() = {
0 0
}; };


#ifdef __CYGWIN32__
#include <cygwin/cygwin_dll.h>
DECLARE_CYGWIN_DLL(DllMain);
#endif


/* /*
* $Log: sys_table.c,v $ * $Log: sys_table.c,v $
* Revision 1.6 2000/09/30 03:20:47 steve
* Cygwin port changes from Venkat
*
* Revision 1.5 2000/05/04 03:37:59 steve * Revision 1.5 2000/05/04 03:37:59 steve
* Add infrastructure for system functions, move * Add infrastructure for system functions, move
* $time to that structure and add $random. * $time to that structure and add $random.
Expand Down
73 changes: 51 additions & 22 deletions vpi/vpi_user.h
Expand Up @@ -19,9 +19,35 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_user.h,v 1.20 2000/08/08 01:47:52 steve Exp $" #ident "$Id: vpi_user.h,v 1.21 2000/09/30 03:20:48 steve Exp $"
#endif #endif



#if defined(__CYGWIN32__)
# define DLLIMPORT __declspec(dllimport)
# define DLLEXPORT __declspec(dllexport)
#else
# define DLLIMPORT
# define DLLEXPORT
#endif

#undef VPI_STORAGE_CLASS
#if defined(BUILD_vvm)
# define VVM_STORAGE_CLASS DLLEXPORT
#else
# define VVM_STORAGE_CLASS DLLIMPORT
#endif

#undef VPI_STORAGE_CLASS
#if defined(BUILD_vpi)
# define VPI_STORAGE_CLASS DLLEXPORT
#else
# define VPI_STORAGE_CLASS DLLIMPORT
#endif

#define VVM_EXTERN extern VVM_STORAGE_CLASS
#define VPI_EXTERN extern VPI_STORAGE_CLASS

#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
Expand Down Expand Up @@ -162,13 +188,13 @@ typedef struct t_vpi_value {




/* VPI FUNCTIONS */ /* VPI FUNCTIONS */
extern void vpi_register_systf(const struct t_vpi_systf_data*ss); VVM_EXTERN void vpi_register_systf(const struct t_vpi_systf_data*ss);
extern void vpi_printf(const char*fmt, ...); VVM_EXTERN void vpi_printf(const char*fmt, ...);


extern unsigned int vpi_mcd_close(unsigned int mcd); VVM_EXTERN unsigned int vpi_mcd_close(unsigned int mcd);
extern char *vpi_mcd_name(unsigned int mcd); VVM_EXTERN char *vpi_mcd_name(unsigned int mcd);
extern unsigned int vpi_mcd_open(char *name); VVM_EXTERN unsigned int vpi_mcd_open(char *name);
extern int vpi_mcd_printf(unsigned int mcd, const char*fmt, ...); VVM_EXTERN int vpi_mcd_printf(unsigned int mcd, const char*fmt, ...);


/* /*
* support for VPI callback functions. * support for VPI callback functions.
Expand Down Expand Up @@ -208,8 +234,8 @@ typedef struct t_cb_data {
#define cbInteractiveScopeChange 23 #define cbInteractiveScopeChange 23
#define cbUnresolvedSystf 24 #define cbUnresolvedSystf 24


extern vpiHandle vpi_register_cb(p_cb_data data); VVM_EXTERN vpiHandle vpi_register_cb(p_cb_data data);
extern int vpi_remove_cb(vpiHandle ref); VVM_EXTERN int vpi_remove_cb(vpiHandle ref);


/* /*
* This function allows a vpi application to control the simulation * This function allows a vpi application to control the simulation
Expand All @@ -226,37 +252,40 @@ extern int vpi_remove_cb(vpiHandle ref);
* vpiReset - * vpiReset -
* vpiSetInteractiveScope - * vpiSetInteractiveScope -
*/ */
extern void vpi_sim_control(int operation, ...); VVM_EXTERN void vpi_sim_control(int operation, ...);
#define vpiStop 1 #define vpiStop 1
#define vpiFinish 2 #define vpiFinish 2
#define vpiReset 3 #define vpiReset 3
#define vpiSetInteractiveScope 4 #define vpiSetInteractiveScope 4


extern vpiHandle vpi_handle(int type, vpiHandle ref); VVM_EXTERN vpiHandle vpi_handle(int type, vpiHandle ref);
extern vpiHandle vpi_iterate(int type, vpiHandle ref); VVM_EXTERN vpiHandle vpi_iterate(int type, vpiHandle ref);
extern vpiHandle vpi_scan(vpiHandle iter); VVM_EXTERN vpiHandle vpi_scan(vpiHandle iter);
extern vpiHandle vpi_handle_by_index(vpiHandle ref, int index); VVM_EXTERN vpiHandle vpi_handle_by_index(vpiHandle ref, int index);


extern void vpi_get_time(vpiHandle obj, s_vpi_time*t); VVM_EXTERN void vpi_get_time(vpiHandle obj, s_vpi_time*t);
extern int vpi_get(int property, vpiHandle ref); VVM_EXTERN int vpi_get(int property, vpiHandle ref);
extern char* vpi_get_str(int property, vpiHandle ref); VVM_EXTERN char* vpi_get_str(int property, vpiHandle ref);
extern void vpi_get_value(vpiHandle expr, p_vpi_value value); VVM_EXTERN void vpi_get_value(vpiHandle expr, p_vpi_value value);
extern vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value, VVM_EXTERN vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value,
p_vpi_time when, int flags); p_vpi_time when, int flags);


extern int vpi_free_object(vpiHandle ref); VVM_EXTERN int vpi_free_object(vpiHandle ref);
extern int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p); VVM_EXTERN int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p);




/* This is the table of startup routines included in each module. */ /* This is the table of startup routines included in each module. */
extern void (*vlog_startup_routines[])(); VPI_EXTERN void (*vlog_startup_routines[])();


#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif


/* /*
* $Log: vpi_user.h,v $ * $Log: vpi_user.h,v $
* Revision 1.21 2000/09/30 03:20:48 steve
* Cygwin port changes from Venkat
*
* Revision 1.20 2000/08/08 01:47:52 steve * Revision 1.20 2000/08/08 01:47:52 steve
* Add vpi_vlog_info support from Adrian * Add vpi_vlog_info support from Adrian
* *
Expand Down

0 comments on commit b34a451

Please sign in to comment.