forked from github/verilator
Report interface ports connected to wrong interface, bug1294.
This commit is contained in:
parent
c7c99d8553
commit
9219ddaece
2
Changes
2
Changes
@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
* Verilator 3.923 devel
|
||||
|
||||
**** Report interface ports connected to wrong interface, bug1294. [Todd Strader]
|
||||
|
||||
**** Fix parsing "output signed" in V2K port list, msg2540. [James Jung]
|
||||
|
||||
|
||||
|
@ -652,6 +652,14 @@ void ParamVisitor::visitCell(AstCell* nodep) {
|
||||
longname += "_" + paramSmallName(srcModp, pinp->modVarp()) + paramValueNumber(pinIrefp);
|
||||
any_overrides = true;
|
||||
ifaceRefRefs.push_back(make_pair(portIrefp,pinIrefp));
|
||||
if (portIrefp->ifacep() != pinIrefp->ifacep()
|
||||
// Might be different only due to param cloning, so check names too
|
||||
&& portIrefp->ifaceName() != pinIrefp->ifaceName()) {
|
||||
pinp->v3error("Port '"<<pinp->prettyName()<<"' expects '"
|
||||
<<AstNode::prettyName(portIrefp->ifaceName())
|
||||
<<"' interface but pin connects '"
|
||||
<<AstNode::prettyName(pinIrefp->ifaceName())<<"' interface");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
test_regress/t/t_interface_wrong_bad.pl
Executable file
17
test_regress/t/t_interface_wrong_bad.pl
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
compile (
|
||||
fails=>1,
|
||||
expect =>
|
||||
q{%Error: t/t_interface_wrong_bad.v:\d+: Port 'foo_port' expects 'foo_intf' interface but pin connects 'bar_intf' interface},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
39
test_regress/t/t_interface_wrong_bad.v
Normal file
39
test_regress/t/t_interface_wrong_bad.v
Normal file
@ -0,0 +1,39 @@
|
||||
// DESCRIPTION: Verilator: Using the wrong kind of interface in a portmap
|
||||
// should cause an error
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2018 by Todd Strader.
|
||||
|
||||
interface foo_intf;
|
||||
logic [7:0] a;
|
||||
endinterface
|
||||
|
||||
interface bar_intf;
|
||||
logic [7:0] a;
|
||||
endinterface
|
||||
|
||||
module foo_mod (foo_intf foo_port);
|
||||
// initial begin
|
||||
// $display("a = %0d", foo_port.a);
|
||||
// end
|
||||
endmodule
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
foo_intf foo ();
|
||||
bar_intf bar ();
|
||||
|
||||
// assign foo.a = 8'd1;
|
||||
// assign bar.a = 8'd2;
|
||||
|
||||
foo_mod
|
||||
foo_mod (
|
||||
.foo_port (bar)
|
||||
);
|
||||
|
||||
initial begin
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user