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

Multidimensional arrays and UNOPTFLAT warning #739

Closed
veripoolbot opened this issue Apr 10, 2014 · 1 comment
Closed

Multidimensional arrays and UNOPTFLAT warning #739

veripoolbot opened this issue Apr 10, 2014 · 1 comment
Labels
resolution: duplicate Closed; issue or pull request already exists

Comments

@veripoolbot
Copy link
Contributor


Author Name: Glen Gibb
Original Redmine Issue: 739 from https://www.veripool.org
Original Date: 2014-04-10


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[6]@) then I receive an UNOPTFLAT warning because of a circular loop:

%Warning-UNOPTFLAT: t/t_multi_dim_array.v:16: Signal unoptimizable: Feedback to clock or circular logic: v.row
%Warning-UNOPTFLAT: Use "/* verilator lint_off UNOPTFLAT */" and lint_on around source to disable this message.

The code does execute correctly with the appropriate lint_off directive. Two questions:

  1. What is the performance impact of disabling the UNOPTFLAT warning and having this signal unoptimized?
  2. I think that this coding style (i.e., using a multidimensional array to propagate a signal through a number of combination processing stages) is a reasonable coding choice. If so, should Verilator be modified to better optimize code using multidimensional arrays in this manner?
@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-04-11T00:59:57Z


(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:

  1. After unrolling converting arrays (or bits in arrays) to non-arrays so code schedules properly. (Presumably only when each element is completely "independent."
  2. Recognizing array elements and ordering separately.
  3. Putting unopt code into a smaller code section so it is less expensive when there is an UNOPTFLAT.
  4. Adding a real event model so such code can self-resolve.

Long term I'd like to do #1 as it is the best performing, AND #4 as it allows for clock generation and other more standard features.

@veripoolbot veripoolbot added the resolution: duplicate Closed; issue or pull request already exists label Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: duplicate Closed; issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

1 participant