Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Accessing a c variable in modelsim

Status
Not open for further replies.

rayan123

Newbie level 5
Newbie level 5
Joined
Nov 24, 2012
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,340
I am using modelsim to simulate a DPI files and want to access a variable from a c file. I am not sure if i can do that. I tried to find the command for this but could not. Is it possible, if so what is the command.

Thanks in advance
 

If you mean you want to access a Verilog/SystemVerilog variable from a C file, you cannot do it directly. You can either export a SV function that returns the value of the variable you want to access(preferred), or you can write VPI routines to access the variable.

- - - Updated - - -

After reading the title of your post again, it seems you want to access a C variable from Modelsim. You can do this with the properly licensed version of Modelsim/Questa that supports C debug. See the C debug section of the User Manual.

Or maybe you meant you want to access a C variable from SystemVerilog. You can't do that directly either. You would have to import a C method that does the access for you.
 
Hi Dave,

Thanks for the reply.

What i meant was, is it possible to add c variables from system verilog into questasim wave, so that i can see how that c variable is changing its value at different clock edges

Regards,
Rayan
 

You can't do that. Your C code is compiled by a generic C compiler and does not produce "update" events when someone writes to a variable. As I said, you would need to either call a C DPI function that polls the C variable at each clock cycle, or export a SV function that sets an SV variable that you can add to the wave window. There might be other ways depending on how your DPI code executes.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top