Fix array slicing of non-const indexes, bug1006.

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Johan Bjork 2015-11-24 21:28:04 -05:00 committed by Wilson Snyder
parent 2102f86909
commit 5613758ee3
3 changed files with 15 additions and 3 deletions

View File

@ -23,6 +23,9 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix parameter constant propagation from package, bug1004. [Johan Bjork]
**** Fix array slicing of non-const indexes, bug1006. [Johan Bjork]
* Verilator 3.878 2015-11-01

View File

@ -36,6 +36,7 @@
#include "V3Inst.h"
#include "V3Ast.h"
#include "V3Changed.h"
#include "V3Const.h"
//######################################################################
// Inst state, as a visitor of each AstNode
@ -250,6 +251,7 @@ private:
if (!arrp->subDTypep()->castIfaceRefDType())
return;
V3Const::constifyParamsEdit(arrselp->rhsp());
AstConst *constp = arrselp->rhsp()->castConst();
if (!constp) {
nodep->v3error("Unsupported: Non-constant index when passing interface to module");

View File

@ -17,6 +17,10 @@ intf.source intf_inst
assign intf_inst.logic_in_intf = value;
endmodule
function integer return_3();
return 3;
endfunction
module t
#(
parameter N = 6
@ -27,16 +31,19 @@ module t
generate
genvar i;
for (i = 0;i < 4; i++) begin
for (i = 0;i < 3; i++) begin
assign ifs[i].logic_in_intf = data[i];
end
endgenerate
modify_interface m3 (
.value(data[return_3()]),
.intf_inst(ifs[return_3()]));
modify_interface m (
modify_interface m4 (
.value(data[4]),
.intf_inst(ifs[4]));
modify_interface m1 (
modify_interface m5 (
.value(~ifs[4].logic_in_intf),
.intf_inst(ifs[5]));