Improve error handling on slices of packed arrays
- We didn't throw an error if a constant value was assigned to an entire array. This could give wrong runtime results.
- Because an assign was cloned, an error would be printed once for each clone. Only print one slice error per assign.
#2 Updated by Wilson Snyder over 9 years ago
From: Lane Brooks Subject: [Verilator-dev] array issues
I haven't been following the array/slice changes, but I recently pulled and rebased the tristate changes I have been working on and my design is now failing to verilate with an error:
%Error: ../../UXN1230/lib/rtl/HostInterface/models/fx2.v:46: Unsupported: Assignment between packed arrays of different dimensions
The verilog of line in question is:
reg [15:0] wbuf[0:255] /* verilator public */;
I git reverted commit 6715cb988001917ec341413f7ea133bc04a94fd4 and it verilates fine as before.
Do you need me to further isolate the problem or is this sufficient? The error message and line number are cryptic enough that I do not really know how what the issue is. The array in question has been working without issue prior to this.
#4 Updated by Lane Brooks over 9 years ago
%Error: Internal Error: ../../UXN1230/lib/rtl/HostInterface/models/fx2.v:75: ../V3Slice.cpp:178: Couldn't find VarRef under the ArraySelLine 75 is a read from the array inside a clocked process:
datao <= wbuf[wptr + 1];
If I revert this patch, everything works fine.
#5 Updated by Byron Bradley over 9 years ago
I haven't been able to reproduce this but I have found some possible issues with the code. Some of these were found as part of #227 so I'll probably put most/all of the patches there.
Wilson, at the moment V3Slice runs on every AstNodeAssign but I don't think it should. I've skipped AstAssignAlias nodes and all of the Verilator and my regression passes. Can you think of any other assign nodes that don't make it to V3Emit?
#7 Updated by Lane Brooks over 9 years ago
I did a little more digging into this problem, and it seems like a false alarm. I checked out the main branch without my new tristate changes and I do not see these errors. Likewise if I leave my changes in but revert this patch, I do not see the errors. So there is a conflict between this patch and my tristate changes.
So I dug a little deeper and found that the array was being tristate expanded because it did not have an any drivers (the drivers are actually in C). I decided that I will not tristate expand public variables when they have no drivers. That resolves the conflict.
Also available in: Atom