SourceForge has been redesigned. Learn more.

#908 Can't set arrays of reals using VPI


I can pass a single real to C through the VPI, examine it, change it, and pass it back to Verilog just fine. When I try to do the same with an array of reals I get an assert. My VPI is a little shaky but I think I'm doing this correctly. I can get this code to work for arrays of non-reals just fine. The C and Verilog are attached.

This is from the latest Git version.

#0 0x0000003e8aa35965 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x0000003e8aa37118 in __GI_abort () at abort.c:91
#2 0x0000003e8aa2e6e2 in __assert_fail_base (fmt=0x3e8ab78448 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x4ac238 "arr->nets != 0", file=file@entry=0x4c1c1d "", line=line@entry=987,
function=function@entry=0x4acb00 "void array_set_word(vvp_array_t, unsigned int, unsigned int, vvp_vector4_t)") at assert.c:94
#3 0x0000003e8aa2e792 in __GI___assert_fail (assertion=0x4ac238 "arr->nets != 0", file=0x4c1c1d "", line=987,
function=0x4acb00 "void array_set_word(vvp_array_t, unsigned int, unsigned int, vvp_vector4_t)") at assert.c:103
#4 0x000000000044dc4f in array_set_word (arr=arr@entry=0x8efd50, address=address@entry=0, part_off=part_off@entry=0, val=...) at
#5 0x000000000044df6f in vpi_array_var_word_put_value (vp=0x7fffffffdd40, ref=0x8f0070) at
#6 __vpiArrayWord::as_word_t::vpi_put_value (this=0x8f0070, val=0x7fffffffdd40, flags=<optimized out>) at
#7 0x000000000049449f in vpi_put_value (obj=0x8f0070, vp=0x7fffffffdd40, when=<optimized out>, flags=1) at
#8 0x00007ffff7de49d2 in hello_calltf (userdata=0x0) at hello.c:34
#9 0x000000000049b5a2 in vpip_execute_vpi_call (thr=<optimized out>, ref=0x8efee0) at
#10 0x0000000000469ae1 in of_VPI_CALL (thr=0x904b60, cp=<optimized out>) at
#11 0x000000000046212a in vthread_run (thr=0x904b60) at
#12 0x000000000046f8b4 in schedule_simulate () at
#13 0x0000000000439063 in main (argc=4, argv=0x7fffffffe0d8) at


  • Brian Magnuson

    Brian Magnuson - 2012-10-05
  • Brian Magnuson

    Brian Magnuson - 2012-10-05
  • Cary R.

    Cary R. - 2012-10-05

    I have not looked at your code, but this does not surprise me. I seem to remember the same issue when looking at creating a $readmem() like routine to initialize a real array. As I remember the issue is that Icarus does not handle the real array VPI interface correctly (they look like vector arrays). Because of this when you write the real data the wrong routine is used and then the code asserts. We have plans to rework the VPI interface to be correct, but no one has had time to do this yet.

    When I have some free time I'll look at your code to see if my recollections are correct.

  • Cary R.

    Cary R. - 2012-10-05

    This is likely a duplicate of pr3112076. I looked at the assert line and this matched what I remembered; the routine called expects a vector array, but this is obviously a real array. It's worth noting that the value to be put was also incorrectly converted to a vector since the routines are assuming this is a vector array.


Log in to post a comment.