Search code examples
c++gccsystem-verilogmodelsimsystem-verilog-dpi

error: cannot convert 'bool' to 'svLogic*' in assignment


We are working on the system verilog DPI calls. While compiling the C++ file we are getting the errors like this:

error: cannot convert 'bool' to 'svLogic*' in assignment

Here svLogic is 4-state variable.

The VCS simulator has predefined function in DirectC method vc_putScalar, where vc_putScalar is "Passes the value of a scalar reg or bit to a vc_handle by reference". The vc_handle is input or output variable in function. With VCS we could use: vc_putScalar(mem_req_rdy, mm->req_cmd_ready());

We are working on Modelsim questa simulator so DirectC will not work. We are tiring to modify the vc_putScalar into w.r.t of DPI IEEE Std 1800-2012 standards. We changed the predefined function logic into this: mem_req_rdy = mm->req_cmd_ready(); Here mem_req_rdy is svLogic and req_cmd_ready is bool.


Solution

  • Given that you had:

    vc_putScalar(mem_req_rdy, mm->req_cmd_ready());
    

    I am guessing that mem_req_rdy is of pointer type svLogic* (since from the name of the function vc_putScalar, it seems that it intends to change the value held in mem_req_rdy). So you need to dereference the pointer as in the following statement:

    *mem_req_rdy = mm->req_cmd_ready();