Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid types `SData[int]' for array subscript #44

Closed
veripoolbot opened this issue Nov 19, 2008 · 1 comment
Closed

invalid types `SData[int]' for array subscript #44

veripoolbot opened this issue Nov 19, 2008 · 1 comment
Assignees
Labels
resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Ralf Karge
Original Redmine Issue: 44 from https://www.veripool.org
Original Date: 2008-11-19
Original Assignee: Wilson Snyder (@wsnyder)


I received new RTL code that causes Verilator to generate illegal C-code. Attached a small test case triggering the same problem.

$ perl $VERILATOR_ROOT/bin/verilator --cc -x-assign 0 --stats -Wno-WIDTH tb_ip_shell.v

$ cd obj_dir

$ make -f Vtb_ip_shell.mk

g++ -I. -MMD -I/cygdrive/c/Projects/Verilator-3.681/include -DVL_PRINTF=printf -DVM_TRACE=0 -DVM_COVERAGE=0 -c -o Vtb_ip_shell__ALLcls.o Vtb_ip_shell__ALLcls.cpp
In file included from Vtb_ip_shell__ALLcls.cpp:1:
Vtb_ip_shell.cpp: In static member function static void Vtb_ip_shell::_sequent__TOP__1(Vtb_ip_shell__Syms*)': Vtb_ip_shell.cpp:127: error: invalid types SData[int]' for array subscript
Vtb_ip_shell.cpp:128: error: invalid types SData[int]' for array subscript Vtb_ip_shell.cpp:129: error: invalid types SData[int]' for array subscript
Vtb_ip_shell.cpp:130: error: invalid types `SData[int]' for array subscript
make: *** [Vtb_ip_shell__ALLcls.o] Error 1

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2008-11-19T14:43:19Z


The workaround for this is to move the "reg [9:0] p [3:0];" outside of the task; any array in tasks causes this.

The patch is below; this is in GIT and will be in the next release 3.682.

diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h
index 02dd792..d5f58b5 100644
--- a/src/V3AstNodes.h
+++ b/src/V3AstNodes.h
@@ -284,8 +284,12 @@ public:
 	init();
 	combineType(type);
 	if (examplep->rangep()) {
+	    // Creating is faster than cloning; know have constant args
 	    setOp1p(new AstRange(fl, examplep->msb(), examplep->lsb()));
 	}
+	if (examplep->arraysp()) {
+	    setOp2p(examplep->arraysp()->cloneTree(true));
+	}
 	width(msb()-lsb()+1,0);
      }
      virtual ~AstVar() {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

2 participants