Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1294

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

Added by Todd Strader 9 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Lint
% Done:

0%


Description

Please see the GitHub branch for a test and a not-quite-there-yet fix: https://github.com/toddstrader/verilator-dev/tree/wrong_intf

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?

History

#1 Updated by Wilson Snyder 9 months 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 t_interface_wrong_bad.pl/v, 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 '" 
              <&lt;AstNode::prettyName(portIrefp-&gt;ifaceName())
              <<"' interface but pin connects '" 
              <&lt;AstNode::prettyName(pinIrefp-&gt;ifaceName())
              <<"' 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 9 months ago

I think the latest commit takes care of everything: https://github.com/toddstrader/verilator-dev/tree/wrong_intf

#3 Updated by Wilson Snyder 9 months ago

  • Status changed from Confirmed to Resolved

Good stuff! Thanks.

Merged into git towards 3.924.

#4 Updated by Wilson Snyder 6 months ago

  • Status changed from Resolved to Closed

In 3.924.

Also available in: Atom