How to Switch from from foreign language(C or C++) to Systemverilog viceversa after particular time
Ex: After 5000ms need to switch from systemverilog to C lanaguage
please Help me in this
How to Switch from from foreign language(C or C++) to Systemverilog viceversa after particular time
Ex: After 5000ms need to switch from systemverilog to C lanaguage
please Help me in this
In reply to Subbi Reddy:
Hi,
There are multiple ways for achieving a handshake between C and System Verilog. The most commonly used method is to use a dedicated scratchpad memory and write some data to a particular location. Then, implement a polling API with this data as an expected argument in the C program at the appropriate time. Similarly, you can implement the System Verilog API to jump back.
Alternatively, you can send a pulse on a GPIO and wait for the pulse in the C program.
please elaborate with one example
In reply to Subbi Reddy:
This code does exactly what you asked for: After 5000ms need to switch from systemverilog to C lanaguage
module test;
import "DPI-C" function void C_code();
initial begin
$display("Hello from SystemVerilog");
#5000ms C_code();
$finish;
end
endmodule
#include <stdio.h>
void C_code() {
printf("Hello from C\n");
}
But your question does not make complete sense since C/C++ has no concept of simulation time. You need to elaborate what you are trying to accomplish.
May i Know, How to switch from c program to SV Program after some time
In reply to Subbi Reddy:
C/C++ has no concept of simulation time. You need to elaborate what you are trying to accomplish.
Through DPI, SV TB interacting with C language program.TB calls the C method, during C method execution instantly need to jump to TB, before completing the C method execution,what is the process to Jump from C Method to SV TB for this scenario??
In reply to Subbi Reddy:
This paper might answer some of your questions: Easy Steps Towards Virtual Prototyping using the SystemVerilog DPI | DVCon 2013 | Verification Academy