Fix parameters with function parameter arguments, bug952.

Signed-off-by: Wilson Snyder <[email protected]>
This commit is contained in:
Jie Xu
2015-08-12 19:29:06 -04:00
committed by Wilson Snyder
parent 60b48a6830
commit 5a5a0006fe
4 changed files with 54 additions and 2 deletions
+2
View File
@@ -25,6 +25,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix coverage documentation, bug954. [Thomas J Whatson]
**** Fix parameters with function parameter arguments, bug952. [Jie Xu]
* Verilator 3.874 2015-06-06
+4 -2
View File
@@ -260,7 +260,9 @@ private:
// We can't have non-delayed assignments with same value on LHS and RHS
// as we don't figure out variable ordering.
// Delayed is OK though, as we'll decode the next state separately.
if (!nodep->varp()->dtypeSkipRefp()->castBasicDType()) clearOptimizable(nodep,"Array references/not basic");
if (!nodep->varp()->dtypeSkipRefp()->castBasicDType()
&& !nodep->varp()->dtypeSkipRefp()->castPackArrayDType())
clearOptimizable(nodep,"Array references/not basic");
if (nodep->lvalue()) {
if (m_inDlyAssign) {
if (!(vscp->user1() & VU_LVDLY)) {
@@ -450,7 +452,7 @@ private:
if (!m_params) { clearOptimizable(nodep, "LHS has select"); return; }
checkNodeInfo(selp);
AstVarRef* varrefp = selp->fromp()->castVarRef();
if (!varrefp) {
if (!varrefp) {
clearOptimizable(nodep, "Select LHS isn't simple variable");
return;
}
+14
View File
@@ -0,0 +1,14 @@
#!/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 (
);
ok(1);
1;
+34
View File
@@ -0,0 +1,34 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This test examines Verilator against paramter definition with functions.
// Particularly the function takes in argument which is multi-dimentional.
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Roland Kruse and Jie Xu.
module test#(
parameter size = 4,
parameter p = sum({32'h1,32'h2,32'h3,32'h4}, size))
(input clk,
input logic sel,
output [p:0] res);
logic [p:0] cc = 'h45;
assign res = sel ? cc : {(p+1){1'b1}};
function integer sum;
input [3:0][31:0] values;
input int size;
sum = 0;
begin
for (int i = 0; i < size; i ++)
sum += values[i];
end
endfunction
endmodule