verilogsystem-verilogvlsi

What is the Difference Between Actual and Formal Arguments in Systemverilog DPI?


In SystemVerilog design I am using DPI-C with c program functions. While running simulation on both files, I am getting error: "Actual type is not supported for DPI open array". I want to know which argument is called actual and which is called formal in SystemVerilog side of DPI.


Solution

  • From software programming terminology, the formal arguments to any routine are the ones declared when defining the routine. The actual arguments are the expressions you pass to the routine when calling it. For example

    import "DPI" function void master_write(int address,
                                            int data[]);
    

    address and data are the formal arguments.

    int addr;
    int buffer[$];
    
    always @(posedge clk) master_write(addr/2, buffer);
    

    addr/2 and buffer are the actual arguments passed to master_write().

    Another piece of terminology: "not supported" usually means what you wrote is defined by the LRM, but the tool you are using has not implemented it yet.