Menu

#967 Vvp crash when repeat value is not an integer

devel
closed-fixed
None
5
2014-12-13
2014-12-13
No

When the repeat expression is not an integer the vvp runtime crashes with the message

/usr/local/bin/iverilog frac_repeat.v ; /usr/local/bin/vvp a.out
XXXX Evaluate VEC4 expression (16)
Assertion failed: (depth < stack_vec4_.size()), function peek_vec4, file vthread.cc, line 130.
Abort trap: 6

I will attach a test case. With 0.9.6 there is no error but the repeat is ignored as if the expression is 0 or negative. Modelsim appears to just decrement the expression by one until it reaches zero or negative. So in the testcase provided the second repeat is equivalent to to repeat(11).

In reading the standard there does not seem to be any mention of what to do if the repeat value is not an integer. It is clear that zero and negative values are allowed and should be treated as if the repeat expression did not exist.

I think the 0.9.6 behavior is not desirable but at least does not crash. The modelsim behavior seems more desirable.

Discussion

  • Peter Johnson

    Peter Johnson - 2014-12-13

    Here is my test case. Thanks for looking into this.

     
  • Martin Whitaker

    Martin Whitaker - 2014-12-13

    I've reproduced this behaviour. Whilst the standard doesn't make this explicit, it seems reasonable to perform an implicit conversion to an integer value (using the same rules as if the expression was assigned to an integer variable). I'll look at fixing this.

     
  • Martin Whitaker

    Martin Whitaker - 2014-12-13
    • assigned_to: Martin Whitaker
     
  • Martin Whitaker

    Martin Whitaker - 2014-12-13

    I've pushed fixes for both the master and v0.9 branches to github.

     
  • Martin Whitaker

    Martin Whitaker - 2014-12-13
    • status: open --> closed-fixed
     

Log in to post a comment.