Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vvp asserts on reduce of one-bit .arith/sub #6

Closed
cliffordwolf opened this issue Dec 30, 2013 · 2 comments
Closed

vvp asserts on reduce of one-bit .arith/sub #6

cliffordwolf opened this issue Dec 30, 2013 · 2 comments

Comments

@cliffordwolf
Copy link
Contributor

@cliffordwolf cliffordwolf commented Dec 30, 2013

The following module builds fine with iverilog (ivl) but triggers an assert in vvp:

module issue_011(a, y);
  input [0:0] a;
  output [0:0] y;
  assign y  = |(-a);
endmodule

The error I get is:

Internal error: Input vector expected width=1, got bit=2'b00, base=0, vwid=2
vvp: vvp_net_sig.cc:896: virtual vvp_net_fil_t::prop_t vvp_wire_vec4::filter_vec4(const vvp_vector4_t&, vvp_vector4_t&, unsigned int, unsigned int): Assertion `bits4_.size() == vwid' failed.

@caryr
Copy link
Collaborator

@caryr caryr commented Dec 30, 2013

I only looked at this briefly. This looks to be a problem in the vvp code generator. Icarus converts the unary -a to the binary 0-a expression. The problem is in the constant zero code. The compiler is creating a net that represents the 0 to feed to the subtraction function, but this single bit net is being driven by a two bit constant (C4<00>).

martinwhitaker added a commit that referenced this issue Jan 5, 2014
When creating a constant zero for implementing a unary minus operation
using a binary subtraction operator, the constant needs to be to exactly
the expression width.
@martinwhitaker
Copy link
Collaborator

@martinwhitaker martinwhitaker commented Jan 5, 2014

I've pushed a fix for this bug and added a regression test to the test suite. I've named the test br_gh6 to distinguish it from bugs reported via the main bug tracker on SourceForge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants