Help save net neutrality! Learn more.
Close

#904 sizetf ignored for vpiSizedFunc

closed-invalid
nobody
None
5
2012-08-16
2012-08-16
Anonymous
No

For the attached VPI (hello.c) and Verilog code show below, the sizetf related function appears to never be called:

===begin hello.v===
module hello;
reg [127:0] x;
initial x = $hello;
initial $display("%x\n", x);
endmodule

=== compiling and running the code as follows===
iverilog-vpi hello.c
iverilog -ohello.vvp hello.v
vvp -M. -mhello hello.vvp -v

=== produces the following output===
000000000000000000000000ffffffff

=== whereas the output should be ===
00000000abcdabcddeadbeefffffffff

It appears the size() method is never called and so the vector width is assumed to be 32 bits.

=== VPI snippet ===
void hello_register() {
s_vpi_systf_data data = { vpiSysFunc, vpiSizedFunc, "$hello", hello_calltf, 0, size, 0 };
vpi_register_systf(&data);
}

Discussion

  • Nobody/Anonymous

    vpi code

     
  • Nobody/Anonymous

    I see now from http://iverilog.wikia.com/wiki/Using_VPI that:

    Any functions that do not have an explicit type declaration in an SFT file are implicitly taken to be "vpiSysFuncSized 32 unsigned".

    I will use this workaround.

     
  • Cary R.

    Cary R. - 2012-08-16

    Yes, the SFT file is what Icarus uses to determine the size of a VPI function. It is annoying that it doesn't match the standard, but there are good reasons for using the SFT file over trying to add sizetf() support to the compiler.

    I'm going to close this report as invalid since I don;t expect this to ever get changed in Icarus.

     
  • Cary R.

    Cary R. - 2012-08-16
    • status: open --> closed-invalid
     

Log in to post a comment.