Fix for GitHub issue #115 - synthesis aborts on case with max guard of 0.

The calculation of the required multiplexer width was incorrect for
the corner case of a single guard value of zero.

(cherry picked from commit 27213f2af8)
This commit is contained in:
Martin Whitaker 2016-07-22 23:09:36 +01:00
parent 9b55a3d67f
commit 0ffbb2b1de
1 changed files with 1 additions and 1 deletions

View File

@ -565,7 +565,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope,
// The minimum selector width is the number of inputs that // The minimum selector width is the number of inputs that
// are selected, rounded up to the nearest power of 2. // are selected, rounded up to the nearest power of 2.
unsigned sel_need = ceil(log2(max_guard_value + 1)); unsigned sel_need = max(ceil(log2(max_guard_value + 1)), 1.0);
// If the sel_width can select more than just the explicit // If the sel_width can select more than just the explicit
// guard values, and there is a default statement, then adjust // guard values, and there is a default statement, then adjust