Fix segfault on unrolling for's with bad inits, bug90.

This commit is contained in:
Wilson Snyder 2009-06-08 15:59:33 -04:00
parent e9a7f60fa7
commit b9be4ae4e8
4 changed files with 58 additions and 0 deletions

View File

@ -3,6 +3,10 @@ Revision history for Verilator
The contributors that suggested a given feature are shown in []. [by ...]
indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.71***
**** Fix segfault on unrolling for's with bad inits, bug90. [Andreas Olofsson]
* Verilator 3.710 2009/05/19
** Verilator is now licensed under LGPL v3 and/or Artistic v2.0.

View File

@ -102,6 +102,7 @@ private:
AstAssign* initAssp = initp->castAssign();
if (!initAssp) return cantUnroll(nodep, "no initial assignment");
if (initp->nextp() && initp->nextp()!=nodep) nodep->v3fatalSrc("initial assignment shouldn't be a list");
if (!initAssp->lhsp()->castVarRef()) return cantUnroll(nodep, "no initial assignment to simple variable");
m_forVarp = initAssp->lhsp()->castVarRef()->varp();
m_forVscp = initAssp->lhsp()->castVarRef()->varScopep();
if (nodep->castGenFor() && !m_forVarp->isGenVar()) {

View File

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

View File

@ -0,0 +1,37 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t (/*AUTOARG*/
// Outputs
priority_mask,
// Inputs
muxed_requests
);
parameter ARW = 7;
// verilator lint_off UNOPTFLAT
integer i,j;
output reg [ARW-1:0] priority_mask;
input [ARW-1:0] muxed_requests;
always @* begin
for (i=ARW-1;i>0;i=i-1) begin
priority_mask[i]=1'b0;
// vvvv=== note j=j not j=i; was bug
for( j=j;j>=0;j=j-1)
priority_mask[i]=priority_mask[j] | muxed_requests[j];
end
//Bit zero is always enabled
priority_mask[0]=1'b0;
end
endmodule
// Local Variables:
// verilog-auto-inst-param-value: t
// End: