[sv-cc] vpiHandle on DPI method port proposal

From: Radoslaw Nawrot <Radoslaw.Nawrot@aldec.com.pl>
Date: Tue Oct 04 2011 - 08:24:19 PDT

Hi All,
I'd like to propose constructon that will imporve integration between DPI
and VPI. Many project uses vpi methods inside imported DPI function/tasks. I
think it would be nice feature to let user pass signal on SV side and have
vpiHandle to this signal on DPI side.
 
In example:
 
SV :
module top;
import "DPI-C" context task getInfo(vHandle h);
int i=1;
initial #1 getInfo(i);
endmodule

 
Cpp:
#include <iostream>
#include <fstream>
#include <svdpi.h>
#include "vpi_user.h"
#include "veriuser.h"
 
std::ofstream file("results.txt",std::ios::out | std::ios::app );
std::ofstream err_log("results_err.txt",std::ios::out | std::ios::app );
 

extern "C" void getInfo(vpiHandle hnd) {
  s_vpi_error_info SInfo;
         if ( vpi_chk_error( &SInfo ) )
           err_log<<SInfo.message <<std::endl;
  file <<"Type := "<< vpi_get_str(vpiType, hnd);
  file<<std::endl;
  file <<"Name := "<< vpi_get_str(vpiName, hnd);
  file<<std::endl;
 
}
 
Any type can be passed on the same DPI context method. User can decide what
to do with signal using information from vpiHandle and/or other arguments
from task/function port (value or information from open arrays handle)
Advantages:
    - The same method can be reused with different types
   - User can simply use VPI method to signal passed directly to foreign
language layer
Disadvantages:
    - New type is needed (or some special keyword on port) because this pass
is not type dependent
 
 
Plase note that this affect only context methods and vpi_chk_error should
be check at first on method call
 
 
Thanks,
Radek Nawrot
Radoslaw.Nawrot@aldec.com.pl
 
 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Oct 4 08:25:00 2011

This archive was generated by hypermail 2.1.8 : Tue Oct 04 2011 - 08:25:12 PDT