- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Has anybody managed to successfully interface to C in Modelsim?
I have a function or procedure in VHDL which I want to farm out to a bit of C code:function my_function (input : integer) return real;
attribute foreign of my_function : function is "my_function path_to_my_package.dll";
The C code looks like: __declspec( dllexport ) double my_function (int input) {
double temp = 1E15;
return temp;
}
__declspec( dllexport ) is just to get Visual C to make the function visible to the outside world. I've tried this as a procedure too: procedure my_proc (input : in integer; real_output : out real);
attribute foreign of my_proc : function is "my_proc path_to_my_package.dll";
And two alternatives for the C (neither of which work): __declspec( dllexport ) void my_proc (int input, double output) {
output = 1E15;
return;
}
__declspec( dllexport ) void my_proc (int input, double *output) {
*output = 1E15;
return;
}
Everything compiles and Modelsim loads everything without complaint but I can't get the C code to modify the variable in VHDL. I don't get any errors when I run a simulation but the VHDL variable remains unchanged. I've scoured the Modelsim FLI document and I can't find any suggestion of what I'm doing wrong. Does anybody have any ideas? Cheers
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't worry - sorted
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page