Phil, Tristan,
Just the traces (without any investigation or  analysis)  of a few tests 
of ghdl-026 under cygiwin :

I have built the VHPI examples : http://ghdl.free.fr/vhpidirect/.

$ ./random_tb.exe
0
1481765933
1085377743
1270216262
1191391529
812669700
553475508
445349752
1344887256
730417256

seems to be OK

$ ./time_tb.exe
Starting GHDL simulation
time_tb.vhdl:12:7:@0ms:(assertion note): Reset
time_tb.vhdl:17:7:@2ns:(assertion note): Start of clock
time_tb.vhdl:22:7:@1003ns:(assertion note): End of clock
Simulation time: 0 sec 000000 usec

seems that I have an issue reagarding the time function ....

But  showtime fails during the built :

$ make
ghdl -e -Wl,timeit.o time_tb
ghdl -a time_tb.vhdl
ghdl --bind time_tb
gnatmake showtime -largs `ghdl --list-link time_tb`
gnatbind -x showtime.ali
gnatlink showtime.ali e~time_tb.o 
/usr/local/ghdl//lib/gcc/i686-pc-cygwin/4.1.2/vhdl/lib/v93/std/std_standard.o 
time_tb.
o /usr/local/ghdl//lib/gcc/i686-pc-cygwin/4.1.2/vhdl/lib//libgrt.a 
-lpthread -ldl -lm -L./ -lz
/usr/local/gcc-4.1.2/lib/gcc/i686-pc-cygwin/4.1.2/adalib/libgnat.a(a-except.o): 
In function `__gnat_raise_storage_error'
:
/home/michel/gcc-4.1.2/host-i686-pc-cygwin/gcc/ada/rts/a-except.adb:907: 
multiple definition of `___gnat_raise_storage_e
rror'
/usr/local/ghdl//lib/gcc/i686-pc-cygwin/4.1.2/vhdl/lib//libgrt.a(pthread.o):/home/michel/gcc-4.1.2/host-i686-pc-cygwin/g
cc/vhdl/../../.././gcc/vhdl/grt/config/pthread.c:206: first defined here
/usr/local/gcc-4.1.2/lib/gcc/i686-pc-cygwin/4.1.2/adalib/libgnat.a(a-except.o): 
In function `__gnat_raise_program_error'
:
/home/michel/gcc-4.1.2/host-i686-pc-cygwin/gcc/ada/rts/a-except.adb:880: 
multiple definition of `___gnat_raise_program_e
rror'
/usr/local/ghdl//lib/gcc/i686-pc-cygwin/4.1.2/vhdl/lib//libgrt.a(pthread.o):/home/michel/gcc-4.1.2/host-i686-pc-cygwin/g
cc/vhdl/../../.././gcc/vhdl/grt/config/pthread.c:211: first defined here
collect2: ld returned 1 exit status
gnatlink: cannot call /usr/local/gcc-4.1.2/bin/gcc.exe
gnatmake: *** link failed.
make: *** [showtime] Error 4


Regarding the vpi : http://ghdl.free.fr/vpi-ex-ghdl.tar

The built fails :
$ make
gcc --shared -o vpi1.vpi vpi1.o
vpi1.o: In function `vpi_proc':
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:13: undefined reference to 
`_vpi_iterate'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:14: undefined reference to 
`_vpi_scan'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:24: undefined reference to 
`_vpi_get_str'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:26: undefined reference to 
`_vpi_handle'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:31: undefined reference to 
`_vpi_iterate'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:41: undefined reference to 
`_vpi_get'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:42: undefined reference to 
`_vpi_get_str'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:36: undefined reference to 
`_vpi_scan'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:50: undefined reference to 
`_vpi_iterate'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:60: undefined reference to 
`_vpi_get'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:61: undefined reference to 
`_vpi_get_str'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:55: undefined reference to 
`_vpi_scan'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:77: undefined reference to 
`_vpi_iterate'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:85: undefined reference to 
`_vpi_get_str'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:82: undefined reference to 
`_vpi_scan'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:95: undefined reference to 
`_vpi_iterate'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:104: undefined reference to 
`_vpi_get_str'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:100: undefined reference to 
`_vpi_scan'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:114: undefined reference to 
`_vpi_handle'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:118: undefined reference to 
`_vpi_get_str'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:127: undefined reference to 
`_vpi_handle'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:131: undefined reference to 
`_vpi_get_str'
vpi1.o: In function `my_handle_register':
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:147: undefined reference to 
`_vpi_register_cb'
/cygdrive/c/projects/vpi-ex-ghdl-1/vpi1.c:148: undefined reference to 
`_vpi_printf'
collect2: ld returned 1 exit status
make: *** [vpi1.vpi] Error 1

I don't know if these examples are up to date and if they run well under 
linux .
I have to try ....

Regards

Michel
Phil Reid wrote:

> G'day Michel,
>
> If you have any success with the fli, vpi I'd certainly be interested.
> I started looking at the profiling options as well but had problems 
> and run out of time to investigate further.
>
> Regards
> Phil
>
> michel agoyan wrote:
>
>> Hi Tristan,
>> Again ... I know ;-) .
>> Just to say  that  the build of  ghdl -026 fails under cygwin.
>> Something is wrong with the configuration in order to use the win32 
>> fiber api.
>> I tried to use the default implementation using pthread without 
>> success. In this case I can build  ghdl but I  have an error during 
>> the run time ( wait  inside  sensitive process and obviously this not 
>> the case ! ).
>> This error  suggests me that there is actually an error with the 
>> implementation of the grt  and  with the use of pthread.
>> In fact the issue is the way  the pthreads are implemented under cygwin.
>> As Phil Reid  (Thanks Phil ;-) )  suggested fews month ago  I apply  
>> his patch  (  call pthead_mutexattr_settype to set the type of mutex 
>> to PTHREAD_MUTEX_DEFAULT)
>> And it ... works :-) .
>>
>> I plan to try to solve the issue with the configuration in order to 
>> be able to use the win32 fiber .
>> I let you inform if  there is any progress.
>>
>> In the meantime it should be nice to apply the Phil's patch to the 
>> code since it only impacts  the cygwin configuration.
>>
>> I just remind (for those that don't understand why I want a cygwin 
>> version)   that  the cywin version of ghdl is able to build  object  
>> (.o)  files  and  probably ( I hope , I have to test ...) allows us 
>> to use fli  , vpi ( maybe  we have to do some modification to be able 
>> to load a shared library). The win32 native version  of ghdl  is not 
>> able to do that .....
>>
>> Regards
>>
>> Michel Agoyan
>>
>> =========================================================================== 
>>
>> Hereafter few lines describing how to compile ghdl-026 under cygwin :
>>
>> 1)be sure that the Devel/gcc-ada package is installed ( obviously  
>> you need also Devel/gcc)
>>
>> 2) cd /tmp
>>    retrieve the ghdl source  : wget  
>> http://ghdl.free.fr/ghdl-0.26.tar.bz2
>>    retrieve  the gcc source  : wget  
>> ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.2/gcc-core-4.1.2.tar.bz2
>>                                           wget  
>> ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.2/gcc-ada-4.1.2.tar.bz2
>>
>>   tar -xjvf  ghdl-0.26.tar.bz2
>>   tar -xjvf  gcc-core-4.1.2.tar.bz2
>>   tar -xjvf  gcc-ada-4.1.2.tar.bz2
>>
>> 3) Build gcc-4.1.2  (the last version of  gcc under cygwin is 
>> gcc-3.4.4  and we need gcc-4.x.x in oder to build ghdl.)
>> cd  gcc-4.1.2
>>  ./configure  --prefix=/usr/local/gcc-4.1.2  
>> --enable-languages=c,c++,ada
>>  This builds a Makefile to place the new gcc into the directory 
>> /usr/local/gcc-4.1.2
>>
>> Something is wrong with the ada configuration , we have to set  the 
>> environment variable HOST_SUBDIR :
>> export HOST_SUBDIR=host-i686-pc-cygiwin  (depends on your own host !)
>>
>> make
>> make install
>>
>> 4) Now we have a gcc-4.1.2 tools chain (c,c++,ada) under 
>> /usr/local/gcc-4.1.2)
>> modify your path in order to use this version : export 
>> PATH=/usr/local/gcc-4.1.2/bin:$PATH
>>
>> cd /tmp
>> rm -r gcc-4.1.2
>> tar -xjvf  gcc-core-4.1.2.tar.bz2
>> tar -xjvf  gcc-ada-4.1.2.tar.bz2
>>
>> Apply the Phil's Patch  
>> (https://mail.gna.org/public/ghdl-discuss/2006-10/msg00001.html) , I 
>> have regenerate the patchs for the version 026 and enclosed them to 
>> this email
>> cd  /tmp/ghdl-0.26/vhdl/grt/config
>> patch pthread.c < pthread.patch
>> cd  /tmp/ghdl-0.26/vhdl
>> patch Makefile.in < Makefile.in.patch
>>
>> cd  /tmp
>> cp -R  ghdl-0.26/vhdl/  gcc-4.1.2/gcc/
>> ./configure  --prefix=/usr/local/ghdl --enable-languages=vhdl
>> make
>> make install
>>
>>
>> Add /usr/local/ghdl to your PATH.
>>
>>
>> *
>> *
>>
>>------------------------------------------------------------------------
>>
>>--- pthread.c 2006-03-10 02:49:44.000000000 +0100
>>+++ pthread_new.c     2007-05-16 21:21:45.219848900 +0200
>>@@ -28,6 +28,7 @@
>> #include <stdlib.h>
>> #include <stdio.h>
>> #include <setjmp.h>
>>+#include <assert.h>
>> 
>> //#define INFO printf
>> #define INFO (void)
>>@@ -37,6 +38,9 @@
>> typedef struct 
>> {    pthread_t           thread;         // stack's thread
>>      pthread_mutex_t     mutex;          // mutex to suspend/resume thread
>>+#if defined(__CYGWIN__)
>>+    pthread_mutexattr_t mxAttr;
>>+#endif
>>      void                (*Func)(void*); // stack's FUNC
>>      void*               Arg;            // ARG passed to FUNC
>> } Stack_Type_t, *Stack_Type;
>>@@ -54,10 +58,16 @@
>> {    INFO("grt_stack_init\n");
>>      INFO("  main_stack_context=0x%08x\n", &main_stack_context);
>>      
>>-     pthread_mutex_init(&(main_stack_context.mutex), NULL);
>> 
>>+#if defined(__CYGWIN__)
>>+    assert(pthread_mutexattr_init(&(main_stack_context.mxAttr)) == 0);
>>+    
>>assert(pthread_mutexattr_settype(&(main_stack_context.mxAttr),PTHREAD_MUTEX_DEFAULT)
>> == 0);
>>+    
>>assert(pthread_mutex_init(&(main_stack_context.mutex),&(main_stack_context.mxAttr))
>> == 0);
>>+#else
>>+    assert(pthread_mutex_init(&(main_stack_context.mutex), NULL) == 0);
>>+#endif
>>      // lock the mutex, as we are currently running
>>-     pthread_mutex_lock(&(main_stack_context.mutex));
>>+     assert(pthread_mutex_lock(&(main_stack_context.mutex))== 0);
>>      
>>      current = &main_stack_context;
>> 
>>@@ -105,10 +115,17 @@
>>      newStack->Arg=  Arg;
>>      
>>      // create mutex
>>-     pthread_mutex_init(&(newStack->mutex), NULL);
>>+
>>+#if defined(__CYGWIN__)
>>+     assert(pthread_mutexattr_init(&(newStack->mxAttr)) == 0);
>>+     assert(pthread_mutexattr_settype(&(newStack->mxAttr), 
>>PTHREAD_MUTEX_DEFAULT) == 0);
>>+     assert(pthread_mutex_init(&(newStack->mutex), &(newStack->mxAttr)) == 
>>0);
>>+#else
>>+     assert(pthread_mutex_init(&(newStack->mutex), NULL) == 0);
>>+#endif
>>      
>>      // block the mutex, so that thread will blocked in grt_stack_loop
>>-     pthread_mutex_lock(&(newStack->mutex));
>>+     assert(pthread_mutex_lock(&(newStack->mutex)) == 0);
>>      
>>      INFO("  newStack=0x%08x\n", newStack);
>>      
>>@@ -135,12 +152,12 @@
>>      // unlock 'To' mutex. this will make the other thread either
>>      // - starts for first time in grt_stack_loop
>>      // - resumes at lock below
>>-     pthread_mutex_unlock(&(To->mutex));
>>+     assert(pthread_mutex_unlock(&(To->mutex))==0);
>>              
>>      // block until 'From' mutex becomes available again
>>      // as we are running, our mutex is locked and we block here
>>      // when stacks are switched, with above unlock, we may proceed
>>-     pthread_mutex_lock(&(From->mutex));
>>+     assert(pthread_mutex_lock(&(From->mutex))==0);
>> 
>>      if (From == &main_stack_context && need_longjmp != 0)
>>        longjmp (run_env, need_longjmp);
>>  
>>
>>------------------------------------------------------------------------
>>
>>--- Makefile.in       2007-04-08 18:46:39.000000000 +0200
>>+++ Makefile_new.in   2007-05-16 21:35:14.251098900 +0200
>>@@ -472,7 +472,9 @@
>>   GRT_TARGET_OBJS=win32.o clock.o
>> endif
>> ifeq ($(filter-out i%86 cygwin,$(arch) $(osys)),)
>>-  GRT_TARGET_OBJS=win32.o clock.o
>>+#  GRT_TARGET_OBJS=win32.o clock.o
>>+  GRT_TARGET_OBJS=pthread.o times.o
>>+  GRT_EXTRA_LIB=-lpthread -ldl -lm
>> endif
>> # Fall-back: use a generic implementation based on pthreads.
>> ifndef GRT_TARGET_OBJS
>>  
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Ghdl-discuss mailing list
>>[email protected]
>>https://mail.gna.org/listinfo/ghdl-discuss
>>  
>>
>------------------------------------------------------------------------
>
>_______________________________________________
>Ghdl-discuss mailing list
>[email protected]
>https://mail.gna.org/listinfo/ghdl-discuss
>  
>


_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to