From 13b8dcc0b130dcaecefbb072690ba7c51973c0ca Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 18 Nov 2010 20:58:01 -0800 Subject: [PATCH] Fail if the user defines a real variable as a vector. Using reg real [1:0] var you can define a real variable with a range. This was crashing the run time. This patch catches this in the compiler and prints an appropriate message. --- elab_sig.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/elab_sig.cc b/elab_sig.cc index cb188a356..5d5213bec 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -1048,6 +1048,17 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const array_dimensions = 1; } + if (data_type_ == IVL_VT_REAL && (msb != 0 || lsb != 0)) { + cerr << get_fileline() << ": error: real "; + if (wtype == NetNet::REG) cerr << "variable"; + else cerr << "net"; + cerr << " '" << name_ + << "' cannot be declared as a vector, found a range [" + << msb << ":" << lsb << "]." << endl; + des->errors += 1; + return 0; + } + /* If the net type is supply0 or supply1, replace it with a simple wire with a pulldown/pullup with supply strength. In other words, transform: @@ -1077,8 +1088,10 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const if (debug_elaborate) { cerr << get_fileline() << ": debug: " - << "Generate a SUPPLY pulldown for the " - << "supply0 net." << endl; + << "Generate a SUPPLY pull for the "; + if (wtype == NetNet::SUPPLY0) cerr << "supply0"; + else cerr << "supply1"; + cerr << " net." << endl; } }