Re: [vhdl-200x] DPI example

From: Chris Higgs <Chris.Higgs@detica.com>
Date: Fri Feb 18 2011 - 03:38:12 PST

All,

I have attached a simple VHPI example demonstrating a call out from VHDL
to a C function, which returns a random integer. There is more
boilerplate code required to register the foreign function when compared
to Hans' DPI example but I don't believe it's too onerous.

I'm not sure whether it's possible to call a VHDL function from C. If it
isn't, perhaps we should look to extend VHPI to include this capability.

Thanks,

Chris

-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf
Of hans@ht-lab
Sent: 17 February 2011 18:26
To: vhdl-200x@eda.org
Subject: [POSSIBLE VIRUS:###] Re: [vhdl-200x] {Filename?} DPI example

Lets try again this time without the compile script.

Regards,
Hans.
www.ht-lab.com

-----Original Message-----
From: hans@ht-lab
Sent: Thursday, February 17, 2011 6:18 PM
To: vhdl-200x@eda.org
Subject: [vhdl-200x] {Filename?} DPI example

Warning: This message has had one or more attachments removed
Warning: (simple_dpi_test.zip, run.bat).
Warning: Please read the "EDA-Attachment-Warning.txt" attachment(s) for
more
information.

Hi All,

As mentioned during the meeting I have attached a simple 2 way DPI
example.

If you look at tb.sv you will see that in line 53 a simple C function is
called. The only thing you need to do to make this work is to "import"
the
function which is done in line 20.

Then in the my_function.c code the C function calls a SV function which
is
defined in the tb.sv file. To call a SV from C you need to "export" the
function which is done in line 25 of the tb.sv code.

A simple struct (packet) is passed from SV to C and back to SV again.

Would this be possible with the VHPI?

Regards,
Hans.
www.ht-lab.com

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Please consider the environment before printing this email.
This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory.  The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.
Detica Limited is registered in England under No: 1337451.
Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Received on Fri Feb 18 03:38:57 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 18 2011 - 03:39:06 PST