From 6d2fa6e5792fbfa0142f60d4bba8d8d3a0a278ed Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Fri, 13 Jun 2014 18:22:24 -0700 Subject: [PATCH] case/x/z synthesis with constant case expression. If the case expression is constant, then the guards probably are not, and the synthesis should be handled differently. --- synth2.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/synth2.cc b/synth2.cc index 104533b08..4d9e744b1 100644 --- a/synth2.cc +++ b/synth2.cc @@ -252,7 +252,14 @@ bool NetCase::synth_async(Design*des, NetScope*scope, NexusSet&nex_map, NetBus&nex_out, NetBus&accumulated_nex_out) { - if (type()==NetCase::EQZ) + if (type()==NetCase::EQZ || type()==NetCase::EQX) + return synth_async_casez_(des, scope, nex_map, nex_out, accumulated_nex_out); + + // Special case: If the case expression is constant, then this + // is a pattern where the guards are non-constant and tested + // against a constant case. Handle this as chained conditions + // instead. + if (dynamic_cast (expr_)) return synth_async_casez_(des, scope, nex_map, nex_out, accumulated_nex_out); /* Synthesize the select expression. */ @@ -298,7 +305,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope, } NetEConst*ge = dynamic_cast(items_[item].guard); - assert(ge); + ivl_assert(*this, ge); verinum gval = ge->value(); unsigned sel_idx = gval.as_ulong();