Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Multidimensional arrays and UNOPTFLAT warning #739
Author Name: Glen Gibb
I'd like to use a multidimensional array to connect a number of combinational blocks where the output of one block is used as the input to the next block.
To explain what I mean, I've put together a simple test case that sums the number of ones in a signal. I'm using the technique that one would use in a software implementation where it iteratively masks, shifts, and adds blocks of increasing width. (Ignore the fact that there may be better ways to do this in hardware.) A parameterized module performs a single mask-shift-add step. A number of these modules are instantiated and connected in sequence. The first module instance takes row 0 as input and generates row 1 as output; the second module instance takes row 1 as input and generates row 2 as output etc.
If I create distinct signals for each row (e.g., @reg [31:0] row_0, row_1, row_2, ...@) then everything works fine. If I try using a multi-dimensional array (e.g., @reg [31:0] row@) then I receive an UNOPTFLAT warning because of a circular loop:
The code does execute correctly with the appropriate lint_off directive. Two questions:
Original Redmine Comment
(Unfortunately) There are other bugs about UNOPTFLAT here, for example #� on a version of this with bit numbers. In brief the cost is as much as dividing performance of your whole model by the number of loops; Verilator reevaluates ALL combinatorial code when a change occurs, and there may be a change for each loop.
The fixes include one or more of: