AnsweredAssumed Answered

Need guidance for basic DPI example

Question asked by shiladitya.basu@sibridgetech.com on Mar 27, 2015
Latest reply on Mar 30, 2015 by david_leslie

Hello,

 

I am trying to run a basic DPI example.

 

====================================

=========SV FILE   top.sv ==============

module top;

import "DPI-C" string_sv2c=function void string_sv2c();

 

initial

begin

string_sv2c();

end

 

endmodule

 

===================================

===================================

 

===================================

======== C FILE   main.c ==============

#include "stdio.h"

#include "dpi_header.h"

#include "svdpi.h"

 

void string_sv2c(){

printf(" C: Hellow from C ");

}

 

==================================

==================================

 

 

I am using below commands to simulate :

 

vlib work

vlog -dpi_header dpi_header.h top.sv main.c

vism -c work.main -do "run -all"

 

 

BELOW IS THE SIMULATION REPORT :

 

Reading pref.tcl

# 10.2c

 

# vsim -do {run -all} -c work.main

# ** Note: (vsim-3812) Design is being optimized...

# ** Error: Failed to find design unit work.main.

# Optimization failed

# Error loading design

Error loading design

 

 

Can somebody please tell me what wrong I am doing ??

If I am using wrong commands, then please provide me the correct commands.

 

Thanks

Shiladitya

Outcomes