Passing an ENUM as an argument for a DPI function

Hi,

Assuming that one of my fields in a class is an enum as shown below …

typedef enum logic [3:0] {
PKT_0,



PKT_13
} pkt_t;

Now, If I want to assign a value to a field of type enum as shown above
using DPI functions from within my C++ model, how do I do that?

While for other datatypes in System Verilog there is some equivalent mapping
in the C-world, there seems to be no such mapping for enum type variables.

Please let me know if this is assumption is wrong and I am missing something
here.

Thanks in advance,
– Kartik.

An SV enum will map to its base type, in your case, logic [3:0]. You would be much better off using an int base type.