Produce a better message for ! and real values.

In the transition to the new expression code we forgot how to
handle the logical not (!) of a real value. This patch adds a
more appropriate error message until we get this reimplemented.
This commit is contained in:
Cary R 2008-09-30 13:22:57 -07:00 committed by Stephen Williams
parent 3bce8bb995
commit 6b62cce14a
2 changed files with 23 additions and 15 deletions

View File

@ -871,6 +871,12 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope)
if (isig == 0) return 0; if (isig == 0) return 0;
if (isig->data_type() == IVL_VT_REAL) { if (isig->data_type() == IVL_VT_REAL) {
if (op() == '!') {
cerr << get_fileline() << ": sorry: ! is currently "
"unsupported for real values." << endl;
des->errors += 1;
return 0;
}
cerr << get_fileline() << ": error: reduction operator (" cerr << get_fileline() << ": error: reduction operator ("
<< human_readable_op(op_) << human_readable_op(op_)
<< ") may not have a REAL operand." << endl; << ") may not have a REAL operand." << endl;

View File

@ -378,26 +378,28 @@ const char *human_readable_op(const char op)
{ {
const char *type; const char *type;
switch (op) { switch (op) {
case '~': type = "~"; break; // Negation case '~': type = "~"; break; // Negation
case '^': type = "^"; break; // XOR case '^': type = "^"; break; // XOR
case 'X': type = "~^"; break; // XNOR case 'X': type = "~^"; break; // XNOR
case '&': type = "&"; break; // Bitwise AND case '&': type = "&"; break; // Bitwise AND
case 'A': type = "~&"; break; // NAND (~&) case 'A': type = "~&"; break; // NAND (~&)
case '|': type = "|"; break; // Bitwise OR case '|': type = "|"; break; // Bitwise OR
case 'O': type = "~|"; break; // NOR case 'O': type = "~|"; break; // NOR
case 'a': type = "&&"; break; // Logical AND case '!': type = "!"; break; // Logical NOT
case 'o': type = "||"; break; // Logical OR case 'a': type = "&&"; break; // Logical AND
case 'o': type = "||"; break; // Logical OR
case 'E': type = "==="; break; // Case equality case 'E': type = "==="; break; // Case equality
case 'N': type = "!=="; break; // Case inequality case 'N': type = "!=="; break; // Case inequality
case 'l': type = "<<(<)"; break; // Left shifts case 'l': type = "<<(<)"; break; // Left shifts
case 'r': type = ">>"; break; // Logical right shift case 'r': type = ">>"; break; // Logical right shift
case 'R': type = ">>>"; break; // Arithmetic right shift case 'R': type = ">>>"; break; // Arithmetic right shift
default: assert(0); default:
assert(0);
} }
return type; return type;
} }