Major Tools
Other Tools
General Info

Issue #1294

Connecting the wrong interface to a port does not cause an error

Added by Todd Strader over 1 year ago. Updated over 1 year ago.

% Done:



Please see the GitHub branch for a test and a not-quite-there-yet fix:

The fix works fine for my simple example, but breaks a lot of other tests like so:
%Error: t/t_interface_gen.v:26: Expected ifc interface but got ifc interface instead

The problem seems to be that the point at which I've added the check, interfaces are being de-parameterized. This means that the port's interface reference is pointing at the general interface while the pin is pointing at the specialized interface.

I just tried changing the test to compare ifaceName() instead of ifacep(). This works (all tests pass), but with the additional string compare. Is this the preferable way to go, or can this be caught at some earlier stage (without reproducing a lot of V3Param logic) so we can avoid the string compare?


#1 Updated by Wilson Snyder over 1 year ago

  • Category set to Lint
  • Status changed from New to Confirmed

Seems an OK spot, I'd still compare the pointers as you do to speed things up, but then add an "&& " check on the names being different

Nits: Rename the test, put single quotes around the error names, and call AstNode::prettyName (so that a \escaped name will print right).

I think something like this makes the error clearer:

pinp->v3error("Port '"<&lt;pinp-&gt;prettyName()<<"' expects '" 
              <<"' interface but pin connects '" 
              <<"' interface");

Also not sure why you need a return - that will just make it miss reporting other possible errors if there's more than one interface. Think just remove it.

#2 Updated by Todd Strader over 1 year ago

I think the latest commit takes care of everything:

#3 Updated by Wilson Snyder over 1 year ago

  • Status changed from Confirmed to Resolved

Good stuff! Thanks.

Merged into git towards 3.924.

#4 Updated by Wilson Snyder over 1 year ago

  • Status changed from Resolved to Closed

In 3.924.

Also available in: Atom