On Wed, Apr 10, 2013 at 3:03 PM, Brian Drummond <[email protected]>wrote: > > > > > > > I am attempting to write a multithreaded application in VHDL, using > > > GHDL as the compiler. I need to call from C a function written in > > > VHDL and compiled into object form using GHDL back into the VHDL > > > code somehow, since I can't get direct access to pthreads from VHDL. > > I have called VHDL from a gcc-compiled main program. Not individual VHDL > functions but a VHDL "main program" (which expected argc,argv). I > thought this was the only supported form of cal/ling VHDL from > externally but I would be delighted to be wrong. >
Yes, I saw this in the manual though: This function must be called once, and returns 0 at the end of the simulation. Doesn't sound too useful unless I can call it multiple times to start different threads, with different arguments in each thread invocation to enable the main loop to execute different functions based on the different arguments.... > The VHDL code in turn called back to functions in the foreign language. > > This may not satisfy your requirements but it is probably worth briefly > placing it on record anyway. > > Incidentally the "foreign" language here is Ada, and though the > functionality would translate to C easily enough, Ada would probably be > a more natural choice for multithreading thanks to its tasking > facilities. > Well, I am hoping to be able to get the code I am writing to be able to run OS-like on bare metal hardware, so I think I am stuck with C and possibly assembler. > Forcing VHPI to be a C-like interface throws away a LOT of useful type > safety I have so far not tried to pass anything through VHPI other than integer types - I pass strings as a pair of integers, one for the index of the string array and one for the character value, and then assemble them into a global variable on the native side using multiple functions calls in a for-loop. Ugly but it works OK |->. Jon
_______________________________________________ Ghdl-discuss mailing list [email protected] https://mail.gna.org/listinfo/ghdl-discuss
