From bb9297483983067828781b02ff0f4deabdcacdbc Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 21 Nov 2008 18:42:52 -0800 Subject: [PATCH] V0.8: Fail on a zero width repeat This patch mirrors what was done in development to fail for zero width repeats. Actually development supports them in some contexts, this is allowed in 1364-2005, but V0.8 doesn't support them at all. --- elab_expr.cc | 7 +++++++ elab_net.cc | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index 29a39c016..ea112eff4 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -444,6 +444,13 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const return 0; } + if (rep->value().is_zero()) { + cerr << get_line() << ": error: Concatenation repeat " + << "may not be zero." << endl; + des->errors += 1; + return 0; + } + repeat = rep; } diff --git a/elab_net.cc b/elab_net.cc index 8f5a311db..1a01e8057 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -1357,6 +1357,13 @@ NetNet* PEConcat::elaborate_net(Design*des, NetScope*scope, des->errors += 1; return 0; } + + if (erep->value().is_zero()) { + cerr << get_line() << ": error: Concatenation repeat " + << "may not be zero." << endl; + des->errors += 1; + return 0; + } } /* The operands of the concatenation must contain all