From 27213f2af8c914995db2f6375710ebc258534f3a Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 22 Jul 2016 23:09:36 +0100 Subject: [PATCH] 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. --- synth2.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synth2.cc b/synth2.cc index b42fc440d..b8cbf64c8 100644 --- a/synth2.cc +++ b/synth2.cc @@ -846,7 +846,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope, // The minimum selector width is the number of inputs that // 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 // guard values, and there is a default statement, then adjust