From abc2aa17d23c50c7313cf1427b54b8bc7a145859 Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 21 Nov 2008 17:49:41 -0800 Subject: [PATCH] V0.8: complain about a negative repeat value. This patch mirrors what was done in development to complain about a negative repeat value. --- elab_expr.cc | 9 +++++++++ elab_net.cc | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index 037b04da2..29a39c016 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -433,6 +433,15 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const << "may not be undefined (" << rep->value() << ")." << endl; des->errors += 1; + return 0; + } + + if (rep->value().is_negative()) { + cerr << get_line() << ": error: Concatenation repeat " + << "may not be negative (" << rep->value().as_long() + << ")." << endl; + des->errors += 1; + return 0; } repeat = rep; diff --git a/elab_net.cc b/elab_net.cc index 098e3f7a7..8f5a311db 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -1349,6 +1349,14 @@ NetNet* PEConcat::elaborate_net(Design*des, NetScope*scope, des->errors += 1; return 0; } + + if (erep->value().is_negative()) { + cerr << get_line() << ": error: Concatenation repeat " + << "may not be negative (" << erep->value().as_long() + << ")." << endl; + des->errors += 1; + return 0; + } } /* The operands of the concatenation must contain all