+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 5
    Points: 245, Level: 2

    Join Date
    Sep 2013
    Location
    Ahmedabad
    Posts
    9
    Helped
    1 / 1
    Points
    245
    Level
    2

    how to connect .cpp file with systemverilog(Using DPI)

    I am trying to connect .cpp file with systemverilog file( USING DPI ) but i got an fatal error while running my code

    fatal error like : Null foreign function pointer encountered when calling 'fib_oa'

    When i take .c file instead of .cpp file it runs completely and i got output

    Is there any new connection require for .cpp file????????

    My cpp file and sv file are below

    .CPP FILE::

    #include "svdpi.h"
    #include "stdio.h"
    #include "svdpi_src.h"
    #include "stdarg.h"

    void fib_oa(const svOpenArrayHandle data)
    {

    int i=0;
    char *str1,*str2;
    str1=*(char **)svGetArrElemPtr1(data,i);
    str2=*(char **)svGetArrElemPtr1(data,i+1);
    printf(" string str1=%s\n string str2=%s\n",str1,str2);
    }

    SV FILE ::

    import "DPI-C" function void fib_oa(input string data[]);

    program automatic testt;

    string d[20];
    int i;

    initial begin
    d[0]="ABCD";
    d[1]="WXYZ";

    fib_oa(d);

    end
    endprogram

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 3
    Points: 6,382, Level: 19
    Achievements:
    Created Blog entry 7 years registered

    Join Date
    Dec 2011
    Location
    Fremont, CA, USA
    Posts
    774
    Helped
    354 / 354
    Points
    6,382
    Level
    19
    Blog Entries
    4

    Re: how to connect .cpp file with systemverilog

    I just answered this here.
    Dave Rich
    Senior Verification Consultant
    Mentor Graphics Corporation



    •   AltAdvertisment

        
       

  3. #3
    Newbie level 5
    Points: 245, Level: 2

    Join Date
    Sep 2013
    Location
    Ahmedabad
    Posts
    9
    Helped
    1 / 1
    Points
    245
    Level
    2

    Re: how to connect .cpp file with systemverilog

    Thx For your help its done



--[[ ]]--