Question

I am running System Verilog inside of an ASIC simulator. SV has an import/export mechanism to call C functions from SV, and for SV functions to be called from within C.

I'd like to send realtime-ish (a very slow stream) data from the simulation to a charting program that I will write in Java. What is the best way to call the Java with periodic updates from the simulator/C program?

Was it helpful?

Solution

After a quick glance here : http://java.sun.com/docs/books/jni/html/invoke.html, ...

Then consider this:

The simplest way is to write the data to a file, and write a java program to read from the file as it grows. See this answer: Java IO implementation of unix/linux "tail -f"

Start them both separately, or use system() to start the java program from your plugin, passing the filename as an argument.

OTHER TIPS

The best way would be to have the Java program listen on a TCP socket for updates from the C program which can send them. Have the C program connect to the Java program when it begins, and whenever there's an update, it can pass it along the connected socket. The Java program can then take the data and update whatever it needs to update.

This also has the nice advantage that the two programs don't even have to run on the same machine.

There is the java native interface which allows C programs to interact with java objects. But you need to write some C code to get this integrated into the ASIC simulator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top