Fix pin width mismatch error, bug595.

This commit is contained in:
Wilson Snyder 2013-01-15 19:26:35 -05:00
parent 0286f588bf
commit 0437d0abea
4 changed files with 62 additions and 1 deletions

View File

@ -12,6 +12,9 @@ indicates the contributor was also the author of the fix; Thanks!
*** Support bind, to module names only, bug602. [Ed Lander]
*** Fix pin width mismatch error, bug595. [Alex Solomatnikov]
* Verilator 3.844 2013/01/09
*** Support "unsigned int" DPI import functions, msg966. [Alex Lee]

View File

@ -291,7 +291,6 @@ AstAssignW* V3Inst::pinReconnectSimple(AstPin* pinp, AstCell* cellp, AstNodeModu
pinp->exprp(new AstVarRef (pinexprp->fileline(), newvarp, true));
} else {
// V3 width should have range/extended to make the widths correct
if (pinexprp->width() != pinVarp->width()) pinp->v3fatalSrc("Input pin width mismatch");
assignp = new AstAssignW (pinp->fileline(),
new AstVarRef(pinp->fileline(), newvarp, true),
pinexprp);

18
test_regress/t/t_inst_mism.pl Executable file
View File

@ -0,0 +1,18 @@
#!/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 (
);
execute (
check_finished=>1,
);
ok(1);
1;

View File

@ -0,0 +1,41 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Alex Solomatnikov.
//bug595
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
logic [6-1:0] foo; initial foo = 20;
dut #(.W(6)) udut(.clk(clk),
.foo(foo-16));
endmodule
module dut
#(parameter W = 1)
(input logic clk,
input logic [W-1:0] foo);
genvar i;
generate
for (i = 0; i < W; i++) begin
suba ua(.clk(clk), .foo(foo[i]));
end
endgenerate
endmodule
module suba
(input logic clk,
input logic foo);
always @(posedge clk) begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule