Cleanup build of VPI modules under Cygwin. (Venkat)

This commit is contained in:
steve 2000-10-03 16:15:35 +00:00
parent b34a451cbc
commit bb777f317b
5 changed files with 140 additions and 86 deletions

54
cygwin.txt Normal file
View File

@ -0,0 +1,54 @@
This file describes the build procedure under cygwin32 (Windows 95/98/NT/2K)
----------------------------------------------------------------------------
To build using cygwin:
Prerequisites:
o Latest net release (1.1.4) of cygwin (sources.redhat.com/cygwin)
o autoconf version 2.13 (or later) from cygutils (cygutils.netpedia.net)
o cvs (1.10.8 or later) also from cygutils
Procedure:
o Get the source code - see the main icarus verilog page for how to
do this
o cd to the verilog directory
o autoconf
o ./configure
o make
o make install
That's all that's needed. But there're two common problems during
the make phase. All steps are in the verilog directory.
1.
If gcc dies saying virtual memory exhausted while compiling parse.c
then recompile with -O1 or without -O flag and do these steps to
continue
o c++ -DHAVE_GETOPT_H=1 -DUSE_LIBVPIP=1 -g -I. -MD -c parse.cc -o parse.o
o mv parse.d dep/parse.d
o make
2.
If gcc dies in the vpi directory while compiling vpi_systask.c with the
error, conflicting types for `_cygwin_dll_entry', then fix the line in
/usr/include/cygwin/cygwin_dll.h. Change the line:
int WINAPI _cygwin_dll_entry (HANDLE h, DWORD reason, void *ptr); \
to
int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr); \
Note the change from HANDLE to HINSTANCE. Then do
o make
To build your own extensions - just include vpi_user.h and link with
a command like this:
$(CC) -shared -o <dllname> <objects> -Wl,--enable-auto-image-base -L../vvm -lvvm -lvpip
- Venkat Iyer <venkat@comit.com>

View File

@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.12 2000/09/30 03:20:47 steve Exp $"
#ident "$Id: Makefile.in,v 1.13 2000/10/03 16:15:35 steve Exp $"
#
#
SHELL = /bin/sh
@ -41,7 +41,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
CPPFLAGS = @CPPFLAGS@ @DEFS@ @PICFLAG@ -DBUILD_vpi
CPPFLAGS = @CPPFLAGS@ @DEFS@ @PICFLAG@
CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@
@ -57,11 +57,13 @@ 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
VPIP_LIBS = ../vvm/libvvm.a ../vvm/libvpip.a
else
SYSTEM_VPI_LDFLAGS=
VPIP_LIBS =
endif
system.vpi: $O
system.vpi: $O $(VPIP_LIBS)
$(CC) -shared -o $@ $O $(SYSTEM_VPI_LDFLAGS)
sys_readmem_lex.c: sys_readmem_lex.lex

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_user.h,v 1.21 2000/09/30 03:20:48 steve Exp $"
#ident "$Id: vpi_user.h,v 1.22 2000/10/03 16:15:35 steve Exp $"
#endif
@ -31,22 +31,14 @@
# define DLLEXPORT
#endif
#undef VPI_STORAGE_CLASS
#if defined(BUILD_vvm)
# define VVM_STORAGE_CLASS DLLEXPORT
#undef VPIP_STORAGE_CLASS
#if defined(__build_vpip)
# define VPIP_STORAGE_CLASS DLLEXPORT
#else
# define VVM_STORAGE_CLASS DLLIMPORT
# define VPIP_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
#define VPIP_EXTERN extern VPIP_STORAGE_CLASS
#ifdef __cplusplus
extern "C" {
@ -188,13 +180,13 @@ typedef struct t_vpi_value {
/* VPI FUNCTIONS */
VVM_EXTERN void vpi_register_systf(const struct t_vpi_systf_data*ss);
VVM_EXTERN void vpi_printf(const char*fmt, ...);
VPIP_EXTERN void vpi_register_systf(const struct t_vpi_systf_data*ss);
VPIP_EXTERN void vpi_printf(const char*fmt, ...);
VVM_EXTERN unsigned int vpi_mcd_close(unsigned int mcd);
VVM_EXTERN char *vpi_mcd_name(unsigned int mcd);
VVM_EXTERN unsigned int vpi_mcd_open(char *name);
VVM_EXTERN int vpi_mcd_printf(unsigned int mcd, const char*fmt, ...);
VPIP_EXTERN unsigned int vpi_mcd_close(unsigned int mcd);
VPIP_EXTERN char *vpi_mcd_name(unsigned int mcd);
VPIP_EXTERN unsigned int vpi_mcd_open(char *name);
VPIP_EXTERN int vpi_mcd_printf(unsigned int mcd, const char*fmt, ...);
/*
* support for VPI callback functions.
@ -234,8 +226,8 @@ typedef struct t_cb_data {
#define cbInteractiveScopeChange 23
#define cbUnresolvedSystf 24
VVM_EXTERN vpiHandle vpi_register_cb(p_cb_data data);
VVM_EXTERN int vpi_remove_cb(vpiHandle ref);
VPIP_EXTERN vpiHandle vpi_register_cb(p_cb_data data);
VPIP_EXTERN int vpi_remove_cb(vpiHandle ref);
/*
* This function allows a vpi application to control the simulation
@ -252,30 +244,30 @@ VVM_EXTERN int vpi_remove_cb(vpiHandle ref);
* vpiReset -
* vpiSetInteractiveScope -
*/
VVM_EXTERN void vpi_sim_control(int operation, ...);
VPIP_EXTERN void vpi_sim_control(int operation, ...);
#define vpiStop 1
#define vpiFinish 2
#define vpiReset 3
#define vpiSetInteractiveScope 4
VVM_EXTERN vpiHandle vpi_handle(int type, vpiHandle ref);
VVM_EXTERN vpiHandle vpi_iterate(int type, vpiHandle ref);
VVM_EXTERN vpiHandle vpi_scan(vpiHandle iter);
VVM_EXTERN vpiHandle vpi_handle_by_index(vpiHandle ref, int index);
VPIP_EXTERN vpiHandle vpi_handle(int type, vpiHandle ref);
VPIP_EXTERN vpiHandle vpi_iterate(int type, vpiHandle ref);
VPIP_EXTERN vpiHandle vpi_scan(vpiHandle iter);
VPIP_EXTERN vpiHandle vpi_handle_by_index(vpiHandle ref, int index);
VVM_EXTERN void vpi_get_time(vpiHandle obj, s_vpi_time*t);
VVM_EXTERN int vpi_get(int property, vpiHandle ref);
VVM_EXTERN char* vpi_get_str(int property, vpiHandle ref);
VVM_EXTERN void vpi_get_value(vpiHandle expr, p_vpi_value value);
VVM_EXTERN vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value,
VPIP_EXTERN void vpi_get_time(vpiHandle obj, s_vpi_time*t);
VPIP_EXTERN int vpi_get(int property, vpiHandle ref);
VPIP_EXTERN char* vpi_get_str(int property, vpiHandle ref);
VPIP_EXTERN void vpi_get_value(vpiHandle expr, p_vpi_value value);
VPIP_EXTERN vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value,
p_vpi_time when, int flags);
VVM_EXTERN int vpi_free_object(vpiHandle ref);
VVM_EXTERN int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p);
VPIP_EXTERN int vpi_free_object(vpiHandle ref);
VPIP_EXTERN int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p);
/* This is the table of startup routines included in each module. */
VPI_EXTERN void (*vlog_startup_routines[])();
extern DLLEXPORT void (*vlog_startup_routines[])();
#ifdef __cplusplus
}
@ -283,6 +275,9 @@ VPI_EXTERN void (*vlog_startup_routines[])();
/*
* $Log: vpi_user.h,v $
* Revision 1.22 2000/10/03 16:15:35 steve
* Cleanup build of VPI modules under Cygwin. (Venkat)
*
* Revision 1.21 2000/09/30 03:20:48 steve
* Cygwin port changes from Venkat
*

View File

@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.33 2000/09/30 03:20:48 steve Exp $"
#ident "$Id: Makefile.in,v 1.34 2000/10/03 16:15:35 steve Exp $"
#
#
SHELL = /bin/sh
@ -35,7 +35,7 @@ bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
CC = @CC@ -I$(srcdir) -I$(srcdir)/../vpi -DBUILD_vvm
CC = @CC@ -I$(srcdir) -I$(srcdir)/../vpi -D__build_vpip
CXX = @CXX@ -I$(srcdir) -I$(srcdir)/../vpi
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -47,17 +47,28 @@ CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
STRIP = @STRIP@
O = vvm_add_sub.o vvm_bit.o vvm_calltf.o vvm_clshift.o vvm_compare.o \
vvm_event.o vvm_ff.o vvm_force.o \
vvm_func.o vvm_gates.o vvm_idiv.o vvm_imod.o vvm_mult.o vvm_mux.o \
vvm_nexus.o vvm_pevent.o vvm_signal.o vvm_thread.o vvm_udp.o
P = vpi_bit.o vpi_callback.o \
vpi_const.o vpi_iter.o vpi_memory.o vpi_null.o \
vpi_priv.o vpi_scope.o vpi_signal.o vpi_simulation.o vpi_systask.o vpi_time.o \
vpi_mcd.o vpi_vlog_info.o
ifeq (@CYGWIN@,yes)
# In the DOS world, we need to split out the vpip object file.
all: libvvm.a libvpip.a
libvvm.a: $O libvpip.a
libvvm.a: $O
rm -f $@
ar cvq $@ $O $P
ar cvq $@ $O
libvpip.a vpip.dll: $P
$(CC) -shared -o libvpip.a -Wl,--enable-auto-image-base,--out-implib,libvpip.a -o vpip.dll $P
$(CC) -shared -Wl,--enable-auto-image-base,--out-implib,libvpip.a -o vpip.dll $P
else
@ -81,17 +92,6 @@ endif
$(CC) -Wall $(CPPFLAGS) $(CFLAGS) -MD -c $< -o $*.o
mv $*.d dep
O = vvm_add_sub.o vvm_bit.o vvm_calltf.o vvm_clshift.o vvm_compare.o \
vvm_event.o vvm_ff.o vvm_force.o \
vvm_func.o vvm_gates.o vvm_idiv.o vvm_imod.o vvm_mult.o vvm_mux.o \
vvm_nexus.o vvm_pevent.o vvm_signal.o vvm_thread.o vvm_udp.o
P = vpi_bit.o vpi_callback.o \
vpi_const.o vpi_iter.o vpi_memory.o vpi_null.o \
vpi_priv.o vpi_scope.o vpi_signal.o vpi_simulation.o vpi_systask.o vpi_time.o \
vpi_mcd.o vpi_vlog_info.o
clean:
rm -f *.o dep/*.d
@ -111,11 +111,11 @@ $(libdir)/libvvm.a: ./libvvm.a
$(INSTALL_DATA) ./libvvm.a $(libdir)/libvvm.a
ifeq (@CYGWIN@,yes)
install :: $(libdir)/libvvm.a \
install :: $(libdir)/libvpip.a \
$(bindir)/vpip.dll
$(libdir)/libvpip.a: ./libvpip.a
$(INSTALL_DATA) ./libvvm.a $(libdir)/libvpip.a
$(INSTALL_DATA) ./libvpip.a $(libdir)/libvpip.a
$(bindir)/vpip.dll: ./vpip.dll
$(INSTALL_PROGRAM) ./vpip.dll $(bindir)/vpip.dll

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_priv.h,v 1.25 2000/09/30 03:20:48 steve Exp $"
#ident "$Id: vpi_priv.h,v 1.26 2000/10/03 16:15:35 steve Exp $"
#endif
/*
@ -107,13 +107,13 @@ typedef unsigned char vpip_bit_t;
/* Take as input an array of bits, and return the resolved
value. The result accounts for the strengths involved. */
VVM_EXTERN vpip_bit_t vpip_pair_resolve(vpip_bit_t a, vpip_bit_t b);
VVM_EXTERN vpip_bit_t vpip_bits_resolve(const vpip_bit_t*bits, unsigned nbits);
VPIP_EXTERN vpip_bit_t vpip_pair_resolve(vpip_bit_t a, vpip_bit_t b);
VPIP_EXTERN vpip_bit_t vpip_bits_resolve(const vpip_bit_t*bits, unsigned nbits);
VVM_EXTERN void vpip_bits_get_value(const vpip_bit_t*bits, unsigned nbits,
VPIP_EXTERN void vpip_bits_get_value(const vpip_bit_t*bits, unsigned nbits,
s_vpi_value*vp);
VVM_EXTERN void vpip_bits_set_value(vpip_bit_t*bits, unsigned nbits,
VPIP_EXTERN void vpip_bits_set_value(vpip_bit_t*bits, unsigned nbits,
s_vpi_value*vp);
/*
@ -203,7 +203,7 @@ struct __vpiNull {
struct __vpiHandle base;
};
VVM_EXTERN struct __vpiNull vpip_null;
VPIP_EXTERN struct __vpiNull vpip_null;
/*
* This type represents the handle to a Verilog scope. These include
@ -219,7 +219,7 @@ struct __vpiScope {
struct __vpiHandle**intern;
unsigned nintern;
};
VVM_EXTERN void vpip_attach_to_scope(struct __vpiScope*scope, vpiHandle obj);
VPIP_EXTERN void vpip_attach_to_scope(struct __vpiScope*scope, vpiHandle obj);
/*
@ -241,8 +241,8 @@ struct __vpiSignal {
};
VVM_EXTERN const struct __vpirt vpip_systask_rt;
VVM_EXTERN const struct __vpirt vpip_sysfunc_rt;
VPIP_EXTERN const struct __vpirt vpip_systask_rt;
VPIP_EXTERN const struct __vpirt vpip_sysfunc_rt;
struct __vpiSysTaskCall {
struct __vpiHandle base;
@ -293,35 +293,35 @@ struct __vpiNumberConst {
* to allocate the memory for the handle. The result is the vpiHandle
* of the constructed object.
*/
VVM_EXTERN vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args);
VVM_EXTERN vpiHandle vpip_make_net(struct __vpiSignal*ref, const char*name,
VPIP_EXTERN vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args);
VPIP_EXTERN vpiHandle vpip_make_net(struct __vpiSignal*ref, const char*name,
vpip_bit_t*bits, unsigned nbits);
VVM_EXTERN vpiHandle vpip_make_scope(struct __vpiScope*ref,
VPIP_EXTERN vpiHandle vpip_make_scope(struct __vpiScope*ref,
int type_code,
const char*name);
VVM_EXTERN vpiHandle vpip_make_string_const(struct __vpiStringConst*ref,
VPIP_EXTERN vpiHandle vpip_make_string_const(struct __vpiStringConst*ref,
const char*val);
VVM_EXTERN vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref,
VPIP_EXTERN vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref,
const vpip_bit_t*bits,
unsigned nbits);
VVM_EXTERN vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name,
VPIP_EXTERN vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name,
unsigned width, unsigned size);
VVM_EXTERN vpiHandle vpip_make_reg(struct __vpiSignal*ref, const char*name,
VPIP_EXTERN vpiHandle vpip_make_reg(struct __vpiSignal*ref, const char*name,
vpip_bit_t*bits, unsigned nbits);
VVM_EXTERN vpiHandle vpip_make_time_var(struct __vpiTimeVar*ref,
VPIP_EXTERN vpiHandle vpip_make_time_var(struct __vpiTimeVar*ref,
const char*val);
/* Use this function to call a registered task. */
VVM_EXTERN void vpip_calltask(const char*name, unsigned nparms, vpiHandle*parms);
VPIP_EXTERN void vpip_calltask(const char*name, unsigned nparms, vpiHandle*parms);
/*
* This calls a system function with a given name. The return value is
* taken by the res[] array.
*/
VVM_EXTERN void vpip_callfunc(const char*name, unsigned nres, vpip_bit_t*res,
VPIP_EXTERN void vpip_callfunc(const char*name, unsigned nres, vpip_bit_t*res,
unsigned nparms, vpiHandle*parms);
VVM_EXTERN void vpip_run_value_changes(struct __vpiSignal*sig);
VPIP_EXTERN void vpip_run_value_changes(struct __vpiSignal*sig);
/*
* The simulation object holds the current state of the
@ -347,13 +347,13 @@ struct vpip_simulation {
short time_precision;
};
VVM_EXTERN struct vpip_simulation vpip_simulation_obj;
VPIP_EXTERN struct vpip_simulation vpip_simulation_obj;
VVM_EXTERN void vpip_set_vlog_info(int argc, char**argv);
VVM_EXTERN void vpip_init_simulation();
VVM_EXTERN void vpip_time_scale(int precision);
VVM_EXTERN void vpip_simulation_run();
VVM_EXTERN void vpi_mcd_init(void);
VPIP_EXTERN void vpip_set_vlog_info(int argc, char**argv);
VPIP_EXTERN void vpip_init_simulation();
VPIP_EXTERN void vpip_time_scale(int precision);
VPIP_EXTERN void vpip_simulation_run();
VPIP_EXTERN void vpi_mcd_init(void);
/*
* Schedule an event to be run sometime in the future. The d parmater
@ -364,22 +364,22 @@ VVM_EXTERN void vpi_mcd_init(void);
* The return value from the insert method is a cookie that can be
* used to manipulate the event before it is executed.
*/
VVM_EXTERN struct vpip_event* vpip_sim_insert_event(unsigned long d,
VPIP_EXTERN struct vpip_event* vpip_sim_insert_event(unsigned long d,
void*user_data,
void (*sim_fun)(void*),
int nonblock_flag);
VVM_EXTERN void vpip_sim_cancel_event(struct vpip_event*cookie);
VPIP_EXTERN void vpip_sim_cancel_event(struct vpip_event*cookie);
/*
* This function returns a handle to the vpiTimeVar that is th main
* simulation time clock.
*/
VVM_EXTERN vpiHandle vpip_sim_time();
VPIP_EXTERN vpiHandle vpip_sim_time();
/*
* Return true if the going_flag is false.
*/
VVM_EXTERN int vpip_finished();
VPIP_EXTERN int vpip_finished();
#ifdef __cplusplus
@ -388,6 +388,9 @@ VVM_EXTERN int vpip_finished();
/*
* $Log: vpi_priv.h,v $
* Revision 1.26 2000/10/03 16:15:35 steve
* Cleanup build of VPI modules under Cygwin. (Venkat)
*
* Revision 1.25 2000/09/30 03:20:48 steve
* Cygwin port changes from Venkat
*