Need guidance for basic DPI example

Status
Not open for further replies.

sbasu

Newbie level 2
Joined
Mar 30, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
20
Hello,


I am trying to run a basic DPI example.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
====================================
=========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 :


Code dot - [expand]
1
2
3
vlib work
vlog -dpi_header dpi_header.h top.sv main.c
vism -c work.main -do "run -all"



BELOW IS THE SIMULATION REPORT :


Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
 
Last edited by a moderator:

Thanks Dave...... I found it working...

I am working on sce-mi using dpi... Can you please suggest me any basic study material for that ??

Regards
Shiladitya Basu


The correct vsim command should be

Code:
vsim -c top -do "run -all;quit"
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…