noobuntu noobuntu - 11 months ago 78
Ruby Question

Ruby and SystemVerilog DPI

The DPI functionality in System Verilog always mentions that you can interface it with any language, the most common one being C/C++. I want to interface my system Verilog code with Ruby. Is there any documentation or support for this functionality? Any known way to do this?

I should add that my main goal is to call a ruby script from my system Verilog uvm test.


Answer Source

While the standard mentions that the DPI can interface SystemVerilog with any other foreign language, it then chickens out and says:

For now, however, SystemVerilog defines a foreign language layer only for the C programming language.

This means that you should get DPI-C support in all IEEE 1800 compliant simulators, but any other foreign languages you get depend on your simulator vendor. Mine for example also offers SystemC, but requires that the SystemC code be patched (i.e. it won't work out of the box).

Some guys in my company managed to interface Python with SystemVerilog through the DPI, but they did it via a 2-step approach: Python -> C and C -> SystemVerilog. You would probably need to do something similar.