Merge pull request #826 from steveicarus/parser-cleanup

Parser cleanup
This commit is contained in:
Stephen Williams 2022-12-24 17:31:17 -08:00 committed by GitHub
commit 507d8cc8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1552 additions and 1544 deletions

View File

@ -1,2 +1,2 @@
./ivltests/br1027a.v:1: error: missing task/function port direction.
./ivltests/br1027a.v:1: error: missing task/function port direction.
./ivltests/br1027a.v:1: error: Missing task/function port direction.
./ivltests/br1027a.v:1: error: Missing task/function port direction.

View File

@ -1 +1 @@
./ivltests/br1027c.v:1: error: missing task/function port direction.
./ivltests/br1027c.v:1: error: Missing task/function port direction.

View File

@ -1 +1 @@
./ivltests/br1027e.v:1: error: missing task/function port direction.
./ivltests/br1027e.v:1: error: Missing task/function port direction.

View File

@ -1,16 +1,16 @@
./ivltests/br_gh79.v:6: syntax error
./ivltests/br_gh79.v:6: error: malformed statement
./ivltests/br_gh79.v:6: error: Malformed statement
./ivltests/br_gh79.v:7: syntax error
./ivltests/br_gh79.v:7: error: malformed statement
./ivltests/br_gh79.v:7: error: Malformed statement
./ivltests/br_gh79.v:9: syntax error
./ivltests/br_gh79.v:9: error: malformed statement
./ivltests/br_gh79.v:9: error: Malformed statement
./ivltests/br_gh79.v:10: syntax error
./ivltests/br_gh79.v:10: error: malformed statement
./ivltests/br_gh79.v:10: error: Malformed statement
./ivltests/br_gh79.v:12: syntax error
./ivltests/br_gh79.v:12: error: malformed statement
./ivltests/br_gh79.v:12: error: Malformed statement
./ivltests/br_gh79.v:13: syntax error
./ivltests/br_gh79.v:13: error: malformed statement
./ivltests/br_gh79.v:13: error: Malformed statement
./ivltests/br_gh79.v:15: syntax error
./ivltests/br_gh79.v:15: error: malformed statement
./ivltests/br_gh79.v:15: error: Malformed statement
./ivltests/br_gh79.v:16: syntax error
./ivltests/br_gh79.v:16: error: malformed statement
./ivltests/br_gh79.v:16: error: Malformed statement

View File

@ -1,2 +1,2 @@
./ivltests/pr1792152.v:2: warning: choosing typ expression.
./ivltests/pr1792152.v:2: warning: Choosing typ expression.
2

View File

@ -1,22 +1,22 @@
./ivltests/pr3366217d.v:3: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:4: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:5: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:6: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:6: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:7: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:8: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:9: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:10: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:10: error: undefined value used in enum name sequence.
./ivltests/pr3366217d.v:13: error: zero count used in enum name sequence.
./ivltests/pr3366217d.v:14: error: zero count used in enum name sequence.
./ivltests/pr3366217d.v:17: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:18: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:19: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:20: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:20: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:21: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:22: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:23: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:24: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:24: error: negative value used in enum name sequence.
./ivltests/pr3366217d.v:3: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:4: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:5: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:6: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:6: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:7: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:8: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:9: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:10: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:10: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:13: error: Zero count used in enum name sequence.
./ivltests/pr3366217d.v:14: error: Zero count used in enum name sequence.
./ivltests/pr3366217d.v:17: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:18: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:19: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:20: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:20: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:21: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:22: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:23: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:24: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:24: error: Negative value used in enum name sequence.

View File

@ -1,8 +1,8 @@
./ivltests/struct_invalid_member.v:9: syntax error
./ivltests/struct_invalid_member.v:9: Error in struct/union member.
./ivltests/struct_invalid_member.v:9: error: Error in struct/union member.
./ivltests/struct_invalid_member.v:10: syntax error
./ivltests/struct_invalid_member.v:10: Error in struct/union member.
./ivltests/struct_invalid_member.v:10: error: Error in struct/union member.
./ivltests/struct_invalid_member.v:11: syntax error
./ivltests/struct_invalid_member.v:11: Error in struct/union member.
./ivltests/struct_invalid_member.v:11: error: Error in struct/union member.
./ivltests/struct_invalid_member.v:12: syntax error
./ivltests/struct_invalid_member.v:12: Error in struct/union member.
./ivltests/struct_invalid_member.v:12: error: Error in struct/union member.

View File

@ -1,3 +1,3 @@
./ivltests/sv_end_labels_unnamed.v:7: error: unnamed block must not have end label.
./ivltests/sv_end_labels_unnamed.v:11: error: unnamed block must not have end label.
./ivltests/sv_end_labels_unnamed.v:14: error: unnamed fork must not have end label.
./ivltests/sv_end_labels_unnamed.v:7: error: Unnamed block must not have end label.
./ivltests/sv_end_labels_unnamed.v:11: error: Unnamed block must not have end label.
./ivltests/sv_end_labels_unnamed.v:14: error: Unnamed fork must not have end label.

View File

@ -1,20 +1,20 @@
./ivltests/sv_timeunit_prec_fail1a.v:9: error: repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:10: error: repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:15: error: repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:21: error: repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:27: error: repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:33: error: repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:40: error: repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:47: error: repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:53: Invalid timeunit constant (1st digit).
./ivltests/sv_timeunit_prec_fail1a.v:54: Invalid timeprecision constant (1st digit).
./ivltests/sv_timeunit_prec_fail1a.v:56: Invalid timeunit constant (number of zeros).
./ivltests/sv_timeunit_prec_fail1a.v:57: Invalid timeprecision constant (number of zeros).
./ivltests/sv_timeunit_prec_fail1a.v:59: Invalid timeunit scale '2s'.
./ivltests/sv_timeunit_prec_fail1a.v:60: Invalid timeprecision scale '2s'.
./ivltests/sv_timeunit_prec_fail1a.v:63: Invalid timeunit constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail1a.v:64: Invalid timeprecision constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail1b.v:4: error: a timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1c.v:4: error: a timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1d.v:5: error: a timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1e.v:5: error: a timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1a.v:9: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:10: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:15: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:21: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:27: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:33: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:40: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:47: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:53: error: Invalid timeunit constant (1st digit).
./ivltests/sv_timeunit_prec_fail1a.v:54: error: Invalid timeprecision constant (1st digit).
./ivltests/sv_timeunit_prec_fail1a.v:56: error: Invalid timeunit constant (number of zeros).
./ivltests/sv_timeunit_prec_fail1a.v:57: error: Invalid timeprecision constant (number of zeros).
./ivltests/sv_timeunit_prec_fail1a.v:59: error: Invalid timeunit scale '2s'.
./ivltests/sv_timeunit_prec_fail1a.v:60: error: Invalid timeprecision scale '2s'.
./ivltests/sv_timeunit_prec_fail1a.v:63: error: Invalid timeunit constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail1a.v:64: error: Invalid timeprecision constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail1b.v:4: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1c.v:4: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1d.v:5: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1e.v:5: error: A timeprecision is missing or is too large!

View File

@ -1,20 +1,20 @@
./ivltests/sv_timeunit_prec_fail2a.v:8: error: repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:8: error: repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:13: error: repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:13: error: repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:14: error: repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:15: error: repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:21: error: repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:21: error: repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:27: error: repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:33: error: repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:39: Invalid timeunit constant (1st digit).
./ivltests/sv_timeunit_prec_fail2a.v:39: Invalid timeprecision constant (1st digit).
./ivltests/sv_timeunit_prec_fail2a.v:41: Invalid timeunit constant (number of zeros).
./ivltests/sv_timeunit_prec_fail2a.v:41: Invalid timeprecision constant (number of zeros).
./ivltests/sv_timeunit_prec_fail2a.v:43: Invalid timeunit scale '2s'.
./ivltests/sv_timeunit_prec_fail2a.v:43: Invalid timeprecision scale '2s'.
./ivltests/sv_timeunit_prec_fail2a.v:46: Invalid timeunit constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail2a.v:46: Invalid timeprecision constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail2b.v:4: error: a timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail2c.v:5: error: a timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail2a.v:8: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:8: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:13: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:13: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:14: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:15: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:21: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:21: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:27: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:33: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:39: error: Invalid timeunit constant (1st digit).
./ivltests/sv_timeunit_prec_fail2a.v:39: error: Invalid timeprecision constant (1st digit).
./ivltests/sv_timeunit_prec_fail2a.v:41: error: Invalid timeunit constant (number of zeros).
./ivltests/sv_timeunit_prec_fail2a.v:41: error: Invalid timeprecision constant (number of zeros).
./ivltests/sv_timeunit_prec_fail2a.v:43: error: Invalid timeunit scale '2s'.
./ivltests/sv_timeunit_prec_fail2a.v:43: error: Invalid timeprecision scale '2s'.
./ivltests/sv_timeunit_prec_fail2a.v:46: error: Invalid timeunit constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail2a.v:46: error: Invalid timeprecision constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail2b.v:4: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail2c.v:5: error: A timeprecision is missing or is too large!

128
lexor.lex
View File

@ -509,9 +509,8 @@ TU [munpf]
}
\'[01xzXZ] {
if (!gn_system_verilog()) {
cerr << yylloc.text << ":" << yylloc.first_line << ": warning: "
<< "Using SystemVerilog 'N bit vector. Use at least "
<< "-g2005-sv to remove this warning." << endl;
VLwarn(yylloc, "warning: Using SystemVerilog 'N bit vector. "
"Use at least -g2005-sv to remove this warning.");
}
generation_t generation_save = generation_flag;
generation_flag = GN_VER2005_SV;
@ -827,10 +826,8 @@ TU [munpf]
net_type = NetNet::NONE;
} else {
cerr << yylloc.text << ":" << yylloc.first_line
<< ": error: Net type " << yytext
<< " is not a valid (or supported)"
<< " default net type." << endl;
VLerror(yylloc, "error: Net type '%s' is not a valid (or supported) "
"default net type.", yytext);
net_type = NetNet::WIRE;
error_count += 1;
}
@ -853,80 +850,58 @@ TU [munpf]
been handled by an external preprocessor such as ivlpp. */
^{W}?`define{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `define not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `define not supported. Use an external preprocessor.");
}
^{W}?`else{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `else not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `else not supported. Use an external preprocessor.");
}
^{W}?`elsif{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `elsif not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `elsif not supported. Use an external preprocessor.");
}
^{W}?`endif{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `endif not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `endif not supported. Use an external preprocessor.");
}
^{W}?`ifdef{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `ifdef not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `ifdef not supported. Use an external preprocessor.");
}
^{W}?`ifndef{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `ifndef not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `ifndef not supported. Use an external preprocessor.");
}
^`include{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `include not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `include not supported. Use an external preprocessor.");
}
^`undef{W}?.* {
cerr << yylloc.text << ":" << yylloc.first_line <<
": warning: `undef not supported. Use an external preprocessor."
<< endl;
VLwarn(yylloc, "warning: `undef not supported. Use an external preprocessor.");
}
`[a-zA-Z_]+ {
yywarn(yylloc, "macro replacement not supported. "
VLwarn(yylloc, "warning: Macro replacement not supported. "
"Use an external preprocessor.");
}
`{W} { cerr << yylloc.text << ":" << yylloc.first_line << ": error: "
<< "Stray tic (`) here. Perhaps you put white space" << endl;
cerr << yylloc.text << ":" << yylloc.first_line << ": : "
<< "between the tic and preprocessor directive?"
<< endl;
error_count += 1; }
`{W} { VLerror(yylloc, "error: Stray tic (`) here. Perhaps you put white "
"space between the tic and preprocessor directive?"); }
. { return yytext[0]; }
/* Final catchall. something got lost or mishandled. */
/* XXX Should we tell the user something about the lexical state? */
<*>.|\n { cerr << yylloc.text << ":" << yylloc.first_line
<< ": error: unmatched character (";
<*>.|\n {
if (isprint(yytext[0]))
cerr << yytext[0];
VLerror(yylloc, "error: Unmatched character (%c).", yytext[0]);
else
cerr << "hex " << hex << ((unsigned char) yytext[0]);
cerr << ")" << endl;
error_count += 1; }
VLerror(yylloc, "error: Unmatched character (0x%x).",
(unsigned char) yytext[0]);
}
%%
@ -949,7 +924,8 @@ static unsigned truncate_to_integer_width(verinum::V*bits, unsigned size)
for (unsigned idx = integer_width; idx < size; idx += 1) {
if (bits[idx] != pad) {
yywarn(yylloc, "Unsized numeric constant truncated to integer width.");
VLwarn(yylloc, "warning: Unsized numeric constant truncated "
"to integer width.");
break;
}
}
@ -985,15 +961,15 @@ verinum*make_unsized_binary(const char*txt)
if (*idx != '_') size += 1;
if (size == 0) {
VLerror(yylloc, "Numeric literal has no digits in it.");
VLerror(yylloc, "error: Numeric literal has no digits in it.");
verinum*out = new verinum();
out->has_sign(sign_flag);
out->is_single(single_flag);
return out;
}
if ((based_size > 0) && (size > based_size)) yywarn(yylloc,
"extra digits given for sized binary constant.");
if ((based_size > 0) && (size > based_size)) VLwarn(yylloc,
"warning: Extra digits given for sized binary constant.");
verinum::V*bits = new verinum::V[size];
@ -1057,8 +1033,8 @@ verinum*make_unsized_octal(const char*txt)
if (based_size > 0) {
int rem = based_size % 3;
if (rem != 0) based_size += 3 - rem;
if (size > based_size) yywarn(yylloc,
"extra digits given for sized octal constant.");
if (size > based_size) VLwarn(yylloc,
"warning: Extra digits given for sized octal constant.");
}
verinum::V*bits = new verinum::V[size];
@ -1126,8 +1102,8 @@ verinum*make_unsized_hex(const char*txt)
if (based_size > 0) {
int rem = based_size % 4;
if (rem != 0) based_size += 4 - rem;
if (size > based_size) yywarn(yylloc,
"extra digits given for sized hex constant.");
if (size > based_size) VLwarn(yylloc,
"warning: Extra digits given for sized hex constant.");
}
verinum::V*bits = new verinum::V[size];
@ -1431,7 +1407,7 @@ static void process_ucdrive(const char*txt)
const char*cp = txt;
if (strncmp("pull", cp, 4) != 0) {
VLerror(yylloc, "pull required for `unconnected_drive "
VLerror(yylloc, "error: pull required for `unconnected_drive "
"directive.");
return;
}
@ -1439,16 +1415,14 @@ static void process_ucdrive(const char*txt)
if (*cp == '0') ucd = UCD_PULL0;
else if (*cp == '1') ucd = UCD_PULL1;
else {
cerr << yylloc.text << ":" << yylloc.first_line << ": error: "
"`unconnected_drive does not support 'pull" << *cp
<< "'." << endl;
error_count += 1;
VLerror(yylloc, "error: `unconnected_drive does not support "
"'pull%c'.", *cp);
return;
}
cp += 1;
if (*cp != '\0') {
VLerror(yylloc, "Invalid `unconnected_drive directive (extra "
"garbage after pull direction).");
VLerror(yylloc, "error: Invalid `unconnected_drive directive "
"(extra garbage after pull direction).");
return;
}
@ -1479,7 +1453,7 @@ static void line_directive()
/* Find the starting " and skip it. */
char*fn_start = strchr(cp, '"');
if (cp != fn_start) {
VLerror(yylloc, "Invalid #line directive (file name start).");
VLerror(yylloc, "error: Invalid #line directive (file name start).");
return;
}
fn_start += 1;
@ -1487,7 +1461,7 @@ static void line_directive()
/* Find the last ". */
char*fn_end = strrchr(fn_start, '"');
if (!fn_end) {
VLerror(yylloc, "Invalid #line directive (file name end).");
VLerror(yylloc, "error: Invalid #line directive (file name end).");
return;
}
@ -1502,8 +1476,8 @@ static void line_directive()
cpr = cp;
cpr += strspn(cp, " \t");
if (cp == cpr) {
VLerror(yylloc, "Invalid #line directive (missing space after "
"file name).");
VLerror(yylloc, "error: Invalid #line directive (missing space "
"after file name).");
delete[] buf;
return;
}
@ -1512,7 +1486,7 @@ static void line_directive()
/* Get the line number and verify that it is correct. */
unsigned long lineno = strtoul(cp, &cpr, 10);
if (cp == cpr) {
VLerror(yylloc, "Invalid line number for #line directive.");
VLerror(yylloc, "error: Invalid line number for #line directive.");
delete[] buf;
return;
}
@ -1521,8 +1495,8 @@ static void line_directive()
/* Verify that only space is left. */
cpr += strspn(cp, " \t");
if ((size_t)(cpr-yytext) != strlen(yytext)) {
VLerror(yylloc, "Invalid #line directive (extra garbage after "
"line number).");
VLerror(yylloc, "error: Invalid #line directive (extra garbage "
"after line number).");
delete[] buf;
return;
}
@ -1549,7 +1523,7 @@ static void line_directive2()
/* strtoul skips leading space. */
unsigned long lineno = strtoul(cp, &cpr, 10);
if (cp == cpr) {
VLerror(yylloc, "Invalid line number for `line directive.");
VLerror(yylloc, "error: Invalid line number for `line directive.");
return;
}
lineno -= 1;
@ -1558,8 +1532,8 @@ static void line_directive2()
/* Skip the space between the line number and the file name. */
cpr += strspn(cp, " \t");
if (cp == cpr) {
VLerror(yylloc, "Invalid `line directive (missing space after "
"line number).");
VLerror(yylloc, "error: Invalid `line directive (missing space "
"after line number).");
return;
}
cp = cpr;
@ -1567,7 +1541,7 @@ static void line_directive2()
/* Find the starting " and skip it. */
char*fn_start = strchr(cp, '"');
if (cp != fn_start) {
VLerror(yylloc, "Invalid `line directive (file name start).");
VLerror(yylloc, "error: Invalid `line directive (file name start).");
return;
}
fn_start += 1;
@ -1575,7 +1549,7 @@ static void line_directive2()
/* Find the last ". */
char*fn_end = strrchr(fn_start, '"');
if (!fn_end) {
VLerror(yylloc, "Invalid `line directive (file name end).");
VLerror(yylloc, "error: Invalid `line directive (file name end).");
return;
}
@ -1584,15 +1558,15 @@ static void line_directive2()
cpr = cp;
cpr += strspn(cp, " \t");
if (cp == cpr) {
VLerror(yylloc, "Invalid `line directive (missing space after "
"file name).");
VLerror(yylloc, "error: Invalid `line directive (missing space "
"after file name).");
return;
}
cp = cpr;
/* Check that the level is correct, we do not need the level. */
if (strspn(cp, "012") != 1) {
VLerror(yylloc, "Invalid level for `line directive.");
VLerror(yylloc, "error: Invalid level for `line directive.");
return;
}
cp += 1;
@ -1601,8 +1575,8 @@ static void line_directive2()
cp += strspn(cp, " \t");
if (strncmp(cp, "//", 2) != 0 &&
(size_t)(cp-yytext) != strlen(yytext)) {
VLerror(yylloc, "Invalid `line directive (extra garbage after "
"level).");
VLerror(yylloc, "error: Invalid `line directive (extra garbage "
"after level).");
return;
}

251
parse.y
View File

@ -250,16 +250,16 @@ static long check_enum_seq_value(const YYLTYPE&loc, verinum *arg, bool zero_ok)
// We can never have an undefined value in an enumeration name
// declaration sequence.
if (! arg->is_defined()) {
yyerror(loc, "error: undefined value used in enum name sequence.");
yyerror(loc, "error: Undefined value used in enum name sequence.");
// We can never have a negative value in an enumeration name
// declaration sequence.
} else if (arg->is_negative()) {
yyerror(loc, "error: negative value used in enum name sequence.");
yyerror(loc, "error: Negative value used in enum name sequence.");
} else {
value = arg->as_ulong();
// We cannot have a zero enumeration name declaration count.
if (! zero_ok && (value == 0)) {
yyerror(loc, "error: zero count used in enum name sequence.");
yyerror(loc, "error: Zero count used in enum name sequence.");
value = 1;
}
}
@ -273,7 +273,7 @@ static void check_end_label(const struct vlltype&loc, const char *type,
return;
if (!begin)
yyerror(loc, "error: unnamed %s must not have end label.", type);
yyerror(loc, "error: Unnamed %s must not have end label.", type);
else if (strcmp(begin, end) != 0)
yyerror(loc, "error: %s end label `%s` doesn't match %s name"
" `%s`.", type, end, type, begin);
@ -946,7 +946,7 @@ class_item /* IEEE1800-2005: A.1.8 */
| ';'
| error ';'
{ yyerror(@2, "error: invalid class item.");
{ yyerror(@2, "error: Invalid class item.");
yyerrok;
}
@ -1892,7 +1892,7 @@ modport_ports_list
pform_add_modport_port(@3, last_modport_port.direction,
lex_strings.make($3), 0);
} else if (last_modport_port.type != MP_TF) {
yyerror(@3, "error: list of identifiers not allowed here.");
yyerror(@3, "error: List of identifiers not allowed here.");
}
delete[] $3;
}
@ -1958,7 +1958,8 @@ non_integer_type /* IEEE1800-2005: A.2.2.1 */
| K_shortreal { $$ = real_type_t::SHORTREAL; }
;
number : BASED_NUMBER
number
: BASED_NUMBER
{ $$ = $1; based_size = 0;}
| DEC_NUMBER
{ $$ = $1; based_size = 0;}
@ -1968,8 +1969,7 @@ number : BASED_NUMBER
| UNBASED_NUMBER
{ $$ = $1; based_size = 0;}
| DEC_NUMBER UNBASED_NUMBER
{ yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
"a size.");
{ yyerror(@1, "error: Unbased SystemVerilog literal cannot have a size.");
$$ = $1; based_size = 0;}
;
@ -2369,7 +2369,7 @@ tf_port_item /* IEEE1800-2005: A.2.7 */
list<pform_port_t>* port_list = make_port_list($4, $5, 0);
if (use_port_type == NetNet::PIMPLICIT) {
yyerror(@1, "error: missing task/function port direction.");
yyerror(@1, "error: Missing task/function port direction.");
use_port_type = NetNet::PINPUT; // for error recovery
}
if (($3 == 0) && ($1==NetNet::PIMPLICIT)) {
@ -2533,7 +2533,7 @@ variable_lifetime_opt
: lifetime
{ if (pform_requires_sv(@1, "Overriding default variable lifetime") &&
$1 != pform_peek_scope()->default_lifetime) {
yyerror(@1, "sorry: overriding the default variable lifetime "
yyerror(@1, "sorry: Overriding the default variable lifetime "
"is not yet supported.");
}
var_lifetime = $1;
@ -2642,24 +2642,24 @@ block_item_decl
trailing semi-colon to resync the parser. */
| K_var variable_lifetime_opt data_type_or_implicit error ';'
{ yyerror(@1, "error: syntax error in variable list.");
{ yyerror(@1, "error: Syntax error in variable list.");
yyerrok;
}
| variable_lifetime_opt data_type error ';'
{ yyerror(@1, "error: syntax error in variable list.");
{ yyerror(@1, "error: Syntax error in variable list.");
yyerrok;
}
| K_event error ';'
{ yyerror(@1, "error: syntax error in event variable list.");
{ yyerror(@1, "error: Syntax error in event variable list.");
yyerrok;
}
| parameter error ';'
{ yyerror(@1, "error: syntax error in parameter list.");
{ yyerror(@1, "error: Syntax error in parameter list.");
yyerrok;
}
| localparam error ';'
{ yyerror(@1, "error: syntax error localparam list.");
{ yyerror(@1, "error: Syntax error localparam list.");
yyerrok;
}
;
@ -2876,7 +2876,7 @@ struct_union_member /* IEEE 1800-2012 A.2.2.1 */
$$ = tmp;
}
| error ';'
{ yyerror(@2, "Error in struct/union member.");
{ yyerror(@2, "error: Error in struct/union member.");
yyerrok;
$$ = 0;
}
@ -3046,8 +3046,7 @@ delay_value_simple
if ($1 == 0 || !get_time_unit($1, unit))
yyerror(@1, "internal error: time literal delay.");
else {
double p = pow(10.0,
(double)(unit - pform_get_timeunit()));
double p = pow(10.0, (double)(unit - pform_get_timeunit()));
double time = atof($1) * p;
verireal *v = new verireal(time);
@ -3189,8 +3188,10 @@ drive_strength
;
drive_strength_opt
: drive_strength { $$ = $1; }
| { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
: drive_strength
{ $$ = $1; }
|
{ $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
;
dr_strength0
@ -3537,7 +3538,7 @@ expr_mintypmax
break;
}
if (min_typ_max_warn > 0) {
cerr << $$->get_fileline() << ": warning: choosing ";
cerr << $$->get_fileline() << ": warning: Choosing ";
switch (min_typ_max_flag) {
case MIN:
cerr << "min";
@ -3592,8 +3593,10 @@ expression_list_with_nuls
* an argument list in parenthesis or with just the task/function name by
* itself. When an argument list is used it might be empty. */
argument_list_parens_opt
: '(' expression_list_with_nuls ')' { $$ = $2; }
| { $$ = new std::list<PExpr*>; }
: '(' expression_list_with_nuls ')'
{ $$ = $2; }
|
{ $$ = new std::list<PExpr*>; }
expression_list_proper
: expression_list_proper ',' expression
@ -4050,8 +4053,10 @@ expr_primary
declarations of ports. We check later to make sure there are no
output or inout ports actually used for functions. */
tf_item_list_opt /* IEEE1800-2017: A.2.7 */
: tf_item_list { $$ = $1; }
| { $$ = 0; }
: tf_item_list
{ $$ = $1; }
|
{ $$ = 0; }
;
tf_item_list /* IEEE1800-2017: A.2.7 */
@ -4326,8 +4331,7 @@ list_of_variable_port_identifiers
list_of_ports
: port_opt
{ std::vector<Module::port_t*>*tmp
= new std::vector<Module::port_t*>(1);
{ std::vector<Module::port_t*>*tmp = new std::vector<Module::port_t*>(1);
(*tmp)[0] = $1;
$$ = tmp;
}
@ -4340,8 +4344,7 @@ list_of_ports
list_of_port_declarations
: port_declaration
{ std::vector<Module::port_t*>*tmp
= new std::vector<Module::port_t*>(1);
{ std::vector<Module::port_t*>*tmp = new std::vector<Module::port_t*>(1);
(*tmp)[0] = $1;
$$ = tmp;
}
@ -4385,14 +4388,9 @@ list_of_port_declarations
$$ = tmp;
}
| list_of_port_declarations ','
{
yyerror(@2, "error: Superfluous comma in port declaration list.");
}
{ yyerror(@2, "error: Superfluous comma in port declaration list."); }
| list_of_port_declarations ';'
{
yyerror(@2, "error: ';' is an invalid port declaration "
"separator.");
}
{ yyerror(@2, "error: ';' is an invalid port declaration separator."); }
;
port_declaration
@ -4593,7 +4591,7 @@ lpvalue
}
| streaming_concatenation
{ yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
{ yyerror(@1, "sorry: Streaming concatenation not supported in l-values.");
$$ = 0;
}
;
@ -4735,9 +4733,12 @@ module_attribute_foreign
;
module_port_list_opt
: '(' list_of_ports ')' { $$ = $2; }
| '(' list_of_port_declarations ')' { $$ = $2; }
| { $$ = 0; }
: '(' list_of_ports ')'
{ $$ = $2; }
| '(' list_of_port_declarations ')'
{ $$ = $2; }
|
{ $$ = 0; }
| '(' error ')'
{ yyerror(@2, "Errors in port declarations.");
yyerrok;
@ -4780,9 +4781,7 @@ module_parameter_port_list
"list");
}
| type_param
{
param_is_local = false;
}
{ param_is_local = false; }
parameter_assign
| module_parameter_port_list ',' module_parameter
| module_parameter_port_list ',' data_type_opt
@ -4812,7 +4811,7 @@ module_item
}
pform_set_data_type(@2, data_type, $5, $2, $1);
if ($4 != 0) {
yyerror(@2, "sorry: net delays not supported.");
yyerror(@2, "sorry: Net delays not supported.");
delete $4;
}
delete $1;
@ -4822,7 +4821,7 @@ module_item
{ real_type_t*tmpt = new real_type_t(real_type_t::REAL);
pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
if ($3 != 0) {
yyerror(@3, "sorry: net delays not supported.");
yyerror(@3, "sorry: Net delays not supported.");
delete $3;
}
delete $1;
@ -5184,7 +5183,7 @@ module_item
specify_item_list_opt K_endspecify
| K_specify error K_endspecify
{ yyerror(@1, "error: syntax error in specify block");
{ yyerror(@1, "error: Syntax error in specify block");
yyerrok;
}
@ -5193,18 +5192,18 @@ module_item
reasonable error message can be produced. */
| error ';'
{ yyerror(@2, "error: invalid module item.");
{ yyerror(@2, "error: Invalid module item.");
yyerrok;
}
| K_assign error '=' expression ';'
{ yyerror(@1, "error: syntax error in left side of "
{ yyerror(@1, "error: Syntax error in left side of "
"continuous assignment.");
yyerrok;
}
| K_assign error ';'
{ yyerror(@1, "error: syntax error in continuous assignment");
{ yyerror(@1, "error: Syntax error in continuous assignment");
yyerrok;
}
@ -5282,7 +5281,10 @@ module_item_list_opt
|
;
generate_if : K_if '(' expression ')' { pform_start_generate_if(@1, $3); } ;
generate_if
: K_if '(' expression ')'
{ pform_start_generate_if(@1, $3); }
;
generate_case_items
: generate_case_items generate_case_item
@ -5290,9 +5292,13 @@ generate_case_items
;
generate_case_item
: expression_list_proper ':' { pform_generate_case_item(@1, $1); } generate_block
: expression_list_proper ':'
{ pform_generate_case_item(@1, $1); }
generate_block
{ pform_endgenerate(false); }
| K_default ':' { pform_generate_case_item(@1, 0); } generate_block
| K_default ':'
{ pform_generate_case_item(@1, 0); }
generate_block
{ pform_endgenerate(false); }
;
@ -5306,9 +5312,9 @@ generate_item
cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
}
}
| K_begin ':' IDENTIFIER {
pform_start_generate_nblock(@1, $3);
} generate_item_list_opt K_end
| K_begin ':' IDENTIFIER
{ pform_start_generate_nblock(@1, $3); }
generate_item_list_opt K_end
{ /* Detect and warn about anachronistic named begin/end use */
if (generation_flag > GN_VER2001 && warn_anachronisms) {
warn_count += 1;
@ -5324,7 +5330,8 @@ generate_item_list
;
generate_item_list_opt
: { pform_generate_single_item = false; } generate_item_list
: { pform_generate_single_item = false; }
generate_item_list
|
;
@ -5421,8 +5428,15 @@ param_type
}
| type_param
parameter : K_parameter { param_is_local = false; };
localparam : K_localparam { param_is_local = true; };
parameter
: K_parameter
{ param_is_local = false; }
;
localparam
: K_localparam
{ param_is_local = true; }
;
parameter_declaration
: parameter_or_localparam param_type parameter_assign_list ';'
@ -5534,8 +5548,7 @@ parameter_value_opt
$$ = lst;
}
| '#' error
{ yyerror(@1, "error: syntax error in parameter value "
"assignment list.");
{ yyerror(@1, "error: Syntax error in parameter value assignment list.");
$$ = 0;
}
|
@ -5644,7 +5657,7 @@ port_name
$$ = tmp;
}
| attribute_list_opt '.' IDENTIFIER '(' error ')'
{ yyerror(@3, "error: invalid port connection expression.");
{ yyerror(@3, "error: Invalid port connection expression.");
named_pexpr_t*tmp = new named_pexpr_t;
tmp->name = lex_strings.make($3);
tmp->parm = 0;
@ -5728,7 +5741,6 @@ port_conn_expression_list_with_nuls
port_t object to pass it up to the module declaration code. */
port_reference
: IDENTIFIER
{ Module::port_t*ptmp;
perm_string name = lex_strings.make($1);
@ -5736,7 +5748,6 @@ port_reference
delete[]$1;
$$ = ptmp;
}
| IDENTIFIER '[' expression ':' expression ']'
{ index_component_t itmp;
itmp.sel = index_component_t::SEL_PART;
@ -5760,7 +5771,6 @@ port_reference
delete[]$1;
$$ = ptmp;
}
| IDENTIFIER '[' expression ']'
{ index_component_t itmp;
itmp.sel = index_component_t::SEL_BIT;
@ -5783,9 +5793,8 @@ port_reference
delete[]$1;
$$ = ptmp;
}
| IDENTIFIER '[' error ']'
{ yyerror(@1, "error: invalid port bit select");
{ yyerror(@1, "error: Invalid port bit select");
Module::port_t*ptmp = new Module::port_t;
PEIdent*wtmp = new PEIdent(lex_strings.make($1));
FILE_NAME(wtmp, @1);
@ -5868,11 +5877,9 @@ event_variable_list
specify_item
: K_specparam specparam_decl ';'
| specify_simple_path_decl ';'
{ pform_module_specify_path($1);
}
{ pform_module_specify_path($1); }
| specify_edge_path_decl ';'
{ pform_module_specify_path($1);
}
{ pform_module_specify_path($1); }
| K_if '(' expression ')' specify_simple_path_decl ';'
{ PSpecPath*tmp = $5;
if (tmp) {
@ -5898,8 +5905,7 @@ specify_item
pform_module_specify_path(tmp);
}
| K_ifnone specify_edge_path_decl ';'
{ yywarn(@1, "Sorry: ifnone with an edge-sensitive path is "
"not supported.");
{ yywarn(@1, "sorry: ifnone with an edge-sensitive path is not supported.");
yyerrok;
}
| K_Sfullskew '(' spec_reference_event ',' spec_reference_event
@ -5993,25 +5999,32 @@ specify_edge_path_decl
}
;
edge_operator : K_posedge { $$ = true; } | K_negedge { $$ = false; } ;
edge_operator
: K_posedge { $$ = true; }
| K_negedge { $$ = false; }
;
specify_edge_path
: '(' specify_path_identifiers spec_polarity
K_EG '(' specify_path_identifiers polarity_operator expression ')' ')'
{ int edge_flag = 0;
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8);
}
| '(' edge_operator specify_path_identifiers spec_polarity
K_EG '(' specify_path_identifiers polarity_operator expression ')' ')'
{ int edge_flag = $2? 1 : -1;
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);
}
| '(' specify_path_identifiers spec_polarity
K_SG '(' specify_path_identifiers polarity_operator expression ')' ')'
{ int edge_flag = 0;
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8);
}
| '(' edge_operator specify_path_identifiers spec_polarity
K_SG '(' specify_path_identifiers polarity_operator expression ')' ')'
{ int edge_flag = $2? 1 : -1;
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9);
}
;
polarity_operator
@ -6036,11 +6049,9 @@ specify_simple_path_decl
;
specify_simple_path
: '(' specify_path_identifiers spec_polarity
K_EG specify_path_identifiers ')'
: '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')'
{ $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
| '(' specify_path_identifiers spec_polarity
K_SG specify_path_identifiers ')'
| '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')'
{ $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
| '(' error ')'
{ yyerror(@1, "Invalid simple path");
@ -6057,7 +6068,7 @@ specify_path_identifiers
}
| IDENTIFIER '[' expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Bit selects are not currently supported "
yywarn(@4, "warning: Bit selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6068,7 +6079,7 @@ specify_path_identifiers
}
| IDENTIFIER '[' expr_primary polarity_operator expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Part selects are not currently supported "
yywarn(@4, "warning: Part selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6085,7 +6096,7 @@ specify_path_identifiers
}
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Bit selects are not currently supported "
yywarn(@4, "warning: Bit selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6096,7 +6107,7 @@ specify_path_identifiers
}
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']'
{ if (gn_specify_blocks_flag) {
yywarn(@4, "Part selects are not currently supported "
yywarn(@4, "warning: Part selects are not currently supported "
"in path declarations. The declaration "
"will be applied to the whole vector.");
}
@ -6110,8 +6121,7 @@ specify_path_identifiers
specparam
: IDENTIFIER '=' expression
{ PExpr*tmp = $3;
pform_set_specparam(@1, lex_strings.make($1),
specparam_active_range, tmp);
pform_set_specparam(@1, lex_strings.make($1), specparam_active_range, tmp);
delete[]$1;
}
| IDENTIFIER '=' expression ':' expression ':' expression
@ -6134,7 +6144,7 @@ specparam
break;
}
if (min_typ_max_warn > 0) {
cerr << tmp->get_fileline() << ": warning: choosing ";
cerr << tmp->get_fileline() << ": warning: Choosing ";
switch (min_typ_max_flag) {
case MIN:
cerr << "min";
@ -6149,8 +6159,7 @@ specparam
cerr << " expression." << endl;
min_typ_max_warn -= 1;
}
pform_set_specparam(@1, lex_strings.make($1),
specparam_active_range, tmp);
pform_set_specparam(@1, lex_strings.make($1), specparam_active_range, tmp);
delete[]$1;
}
| PATHPULSE_IDENTIFIER '=' expression
@ -6235,11 +6244,12 @@ spec_notifier
| spec_notifier ',' hierarchy_identifier
{ args_after_notifier += 1;
if (args_after_notifier >= 3) {
cerr << @3 << ": warning: timing checks are not supported "
cerr << @3 << ": warning: Timing checks are not supported "
"and delayed signal \"" << *$3
<< "\" will not be driven." << endl;
}
delete $3; }
delete $3;
}
/* How do we match this path? */
| IDENTIFIER
{ args_after_notifier = 0; delete[]$1; }
@ -6434,20 +6444,23 @@ statement_item /* This is roughly statement_item in the LRM */
{ PNBTrigger*tmp = pform_new_nb_trigger(@3, 0, *$3);
delete $3;
$$ = tmp;
yywarn(@1, "Sorry: ->> with event control is not currently supported.");
yywarn(@1, "sorry: ->> with event control is not currently supported.");
}
| K_NB_TRIGGER K_repeat '(' expression ')' event_control hierarchy_identifier ';'
{ PNBTrigger*tmp = pform_new_nb_trigger(@7, 0, *$7);
delete $7;
$$ = tmp;
yywarn(@1, "Sorry: ->> with repeat event control is not currently supported.");
yywarn(@1, "sorry: ->> with repeat event control is not currently supported.");
}
| procedural_assertion_statement { $$ = $1; }
| procedural_assertion_statement
{ $$ = $1; }
| loop_statement { $$ = $1; }
| loop_statement
{ $$ = $1; }
| jump_statement { $$ = $1; }
| jump_statement
{ $$ = $1; }
| unique_priority K_case '(' expression ')' case_items K_endcase
{ PCase*tmp = new PCase($1, NetCase::EQ, $4, $6);
@ -6666,7 +6679,7 @@ statement_item /* This is roughly statement_item in the LRM */
$$ = tmp;
}
| error ';'
{ yyerror(@2, "error: malformed statement");
{ yyerror(@2, "error: Malformed statement");
yyerrok;
$$ = new PNoop;
}
@ -6695,7 +6708,6 @@ compressed_statement
}
;
statement_or_null_list_opt
: statement_or_null_list
{ $$ = $1; }
@ -6875,7 +6887,10 @@ udp_input_sym
| 'q' { $$ = 'q'; }
| '_' { $$ = '_'; }
| '+' { $$ = '+'; }
| DEC_NUMBER { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
| DEC_NUMBER
{ yyerror(@1, "internal error: Input digits parse as decimal number!");
$$ = '0';
}
;
udp_output_sym
@ -6883,7 +6898,10 @@ udp_output_sym
| '1' { $$ = '1'; }
| 'x' { $$ = 'x'; }
| '-' { $$ = '-'; }
| DEC_NUMBER { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
| DEC_NUMBER
{ yyerror(@1, "internal error: Output digits parse as decimal number!");
$$ = '0';
}
;
/* Port declarations create wires for the inputs and the output. The
@ -6947,7 +6965,9 @@ udp_port_list
}
;
udp_reg_opt: K_reg { $$ = true; } | { $$ = false; };
udp_reg_opt
: K_reg { $$ = true; }
| { $$ = false; };
udp_input_declaration_list
: K_input IDENTIFIER
@ -6974,7 +6994,6 @@ udp_primitive
udp_init_opt
udp_body
K_endprimitive label_opt
{ perm_string tmp2 = lex_strings.make($2);
pform_make_udp(@2, tmp2, $4, $7, $9, $8);
check_end_label(@11, "primitive", $2, $11);
@ -6989,7 +7008,6 @@ udp_primitive
udp_input_declaration_list ')' ';'
udp_body
K_endprimitive label_opt
{ perm_string tmp2 = lex_strings.make($2);
perm_string tmp6 = lex_strings.make($6);
pform_make_udp(@2, tmp2, $5, tmp6, $7, $9, $12);
@ -7010,7 +7028,22 @@ unique_priority
presence is significant. This is a fairly common pattern so
collect those rules here. */
K_genvar_opt : K_genvar { $$ = true; } | { $$ = false; } ;
K_static_opt : K_static { $$ = true; } | { $$ = false; } ;
K_virtual_opt : K_virtual { $$ = true; } | { $$ = false; } ;
K_var_opt : K_var | ;
K_genvar_opt
: K_genvar { $$ = true; }
| { $$ = false; }
;
K_static_opt
: K_static { $$ = true; }
| { $$ = false; }
;
K_virtual_opt
: K_virtual { $$ = true; }
| { $$ = false; }
;
K_var_opt
: K_var
|
;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -67,10 +67,10 @@ void VLerror(const YYLTYPE&loc, const char*msg, ...)
based_size = 0; /* Clear the base information if we have an error. */
}
void yywarn(const YYLTYPE&loc, const char*msg)
void VLwarn(const YYLTYPE&loc, const char*msg)
{
warn_count += 1;
cerr << loc << ": warning: " << msg << endl;
cerr << loc << ": " << msg << endl;
}
int VLwrap()

View File

@ -1,7 +1,7 @@
#ifndef IVL_parse_misc_H
#define IVL_parse_misc_H
/*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -57,7 +57,6 @@ extern YYLTYPE yylloc;
*/
extern int VLlex();
extern void VLerror(const char*msg);
extern void VLerror(const YYLTYPE&loc, va_list ap);
extern void VLerror(const YYLTYPE&loc, const char*msg, ...) __attribute__((format(printf,2,3)));
#define yywarn VLwarn
extern void VLwarn(const char*msg);

View File

@ -569,7 +569,7 @@ void pform_set_scope_timescale(const struct vlltype&loc)
if (gn_system_verilog() && (scope->time_unit < scope->time_precision)) {
if (scope->time_unit_is_local || scope->time_prec_is_local) {
VLerror("error: a timeprecision is missing or is too large!");
VLerror("error: A timeprecision is missing or is too large!");
}
} else {
assert(scope->time_unit >= scope->time_precision);
@ -1093,7 +1093,7 @@ bool get_time_unit(const char*cp, int &unit)
bool rc = true;
if (strchr(cp, '_')) {
VLerror(yylloc, "Invalid timeunit constant ('_' is not "
VLerror(yylloc, "error: Invalid timeunit constant ('_' is not "
"supported).");
return false;
}
@ -1118,7 +1118,7 @@ bool get_time_unit(const char*cp, int &unit)
rc = false;
ostringstream msg;
msg << "Invalid timeunit scale '" << cp << "'.";
msg << "error: Invalid timeunit scale '" << cp << "'.";
VLerror(msg.str().c_str());
}
@ -1134,11 +1134,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
/* We do not support a '_' in these time constants. */
if (strchr(cp, '_')) {
if (is_unit) {
VLerror(yylloc, "Invalid timeunit constant ('_' is not "
"supported).");
VLerror(yylloc, "error: Invalid timeunit constant ('_' "
"is not supported).");
} else {
VLerror(yylloc, "Invalid timeprecision constant ('_' is not "
"supported).");
VLerror(yylloc, "error: Invalid timeprecision constant ('_' "
"is not supported).");
}
return true;
}
@ -1146,9 +1146,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
/* Check for the 1 digit. */
if (*cp != '1') {
if (is_unit) {
VLerror(yylloc, "Invalid timeunit constant (1st digit).");
VLerror(yylloc, "error: Invalid timeunit constant "
"(1st digit).");
} else {
VLerror(yylloc, "Invalid timeprecision constant (1st digit).");
VLerror(yylloc, "error: Invalid timeprecision constant "
"(1st digit).");
}
return true;
}
@ -1158,11 +1160,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
res = strspn(cp, "0");
if (res > 2) {
if (is_unit) {
VLerror(yylloc, "Invalid timeunit constant (number of "
"zeros).");
VLerror(yylloc, "error: Invalid timeunit constant "
"(number of zeros).");
} else {
VLerror(yylloc, "Invalid timeprecision constant (number of "
"zeros).");
VLerror(yylloc, "error: Invalid timeprecision constant "
"(number of zeros).");
}
return true;
}
@ -1196,7 +1198,7 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
}
ostringstream msg;
msg << "Invalid ";
msg << "error: Invalid ";
if (is_unit) msg << "timeunit";
else msg << "timeprecision";
msg << " scale '" << cp << "'.";
@ -1220,10 +1222,10 @@ void pform_set_timeunit(const char*txt, bool initial_decl)
scope->time_unit_is_default = false;
allow_timeunit_decl = false;
} else if (!scope->time_unit_is_local) {
VLerror(yylloc, "error: repeat timeunit found and the initial "
VLerror(yylloc, "error: Repeat timeunit found and the initial "
"timeunit for this scope is missing.");
} else if (scope->time_unit != val) {
VLerror(yylloc, "error: repeat timeunit does not match the "
VLerror(yylloc, "error: Repeat timeunit does not match the "
"initial timeunit for this scope.");
}
}
@ -1258,10 +1260,10 @@ void pform_set_timeprec(const char*txt, bool initial_decl)
scope->time_prec_is_default = false;
allow_timeprec_decl = false;
} else if (!scope->time_prec_is_local) {
VLerror(yylloc, "error: repeat timeprecision found and the initial "
VLerror(yylloc, "error: Repeat timeprecision found and the initial "
"timeprecision for this scope is missing.");
} else if (scope->time_precision != val) {
VLerror(yylloc, "error: repeat timeprecision does not match the "
VLerror(yylloc, "error: Repeat timeprecision does not match the "
"initial timeprecision for this scope.");
}
}
@ -1458,7 +1460,7 @@ void pform_endmodule(const char*name, bool inside_celldefine,
perm_string tmp_name = tmp_module->mod_name();
pform_cur_module.pop_front();
ostringstream msg;
msg << "Module " << mod_name
msg << "error: Module " << mod_name
<< " was nested within " << tmp_name
<< " but broken.";
VLerror(msg.str().c_str());
@ -1492,7 +1494,7 @@ void pform_endmodule(const char*name, bool inside_celldefine,
if (test != use_module_map.end()) {
ostringstream msg;
msg << "Module " << name << " was already declared here: "
msg << "error: Module " << name << " was already declared here: "
<< test->second->get_fileline() << endl;
VLerror(msg.str().c_str());
} else {
@ -1792,7 +1794,7 @@ PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max)
}
if (min_typ_max_warn > 0) {
cerr << res->get_fileline() << ": warning: choosing ";
cerr << res->get_fileline() << ": warning: Choosing ";
switch (min_typ_max_flag) {
case MIN:
cerr << "min";
@ -2046,7 +2048,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
// Put the primitive into the primitives table
if (pform_primitives[name]) {
VLwarn("UDP primitive already exists.");
VLwarn("warning: UDP primitive already exists.");
} else {
PUdp*udp = new PUdp(name, parms->size());
@ -2127,7 +2129,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
// Put the primitive into the primitives table
if (pform_primitives[name]) {
VLerror("UDP primitive already exists.");
VLerror("error: UDP primitive already exists.");
} else {
PUdp*udp = new PUdp(name, pins.size());
@ -2210,7 +2212,7 @@ static void pform_makegate(PGBuiltin::Type type,
list<named_pexpr_t>*attr)
{
if (info.parms_by_name) {
cerr << info.get_fileline() << ": Gates do not have port names."
cerr << info.get_fileline() << ": error: Gates do not have port names."
<< endl;
error_count += 1;
return;
@ -2515,7 +2517,7 @@ void pform_make_var_init(const struct vlltype&li,
perm_string name, PExpr*expr)
{
if (! pform_at_module_level() && !gn_system_verilog()) {
VLerror(li, "error: variable declaration assignments are only "
VLerror(li, "error: Variable declaration assignments are only "
"allowed at the module level.");
delete expr;
return;
@ -2678,7 +2680,7 @@ void pform_makewire(const struct vlltype&li,
list<named_pexpr_t>*attr)
{
if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) {
VLerror(li, "error: variable declarations must be contained within a module.");
VLerror(li, "error: Variable declarations must be contained within a module.");
return;
}
@ -2876,7 +2878,7 @@ void pform_set_attrib(perm_string name, perm_string key, char*value)
} else {
delete[] value;
VLerror("Unable to match name for setting attribute.");
VLerror("error: Unable to match name for setting attribute.");
}
}
@ -2890,7 +2892,7 @@ void pform_set_type_attrib(perm_string name, const string&key,
{
map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(name);
if (udp == pform_primitives.end()) {
VLerror("type name is not (yet) defined.");
VLerror("error: Type name is not (yet) defined.");
delete[] value;
return;
}
@ -2923,7 +2925,7 @@ static void pform_set_type_parameter(const struct vlltype&loc, perm_string name,
pform_requires_sv(loc, "Type parameter");
if (value_range)
VLerror(loc, "error: type parameter must not have value range.");
VLerror(loc, "error: Type parameter must not have value range.");
type_parameter_t *type = new type_parameter_t(name);
pform_set_typedef(loc, name, type, 0);

View File

@ -60,9 +60,9 @@ void pform_end_package_declaration(const struct vlltype&loc)
map<perm_string,PPackage*>::const_iterator test = packages_by_name.find(use_name);
if (test != packages_by_name.end()) {
ostringstream msg;
msg << "Package " << use_name << " was already declared here: "
msg << "error: Package " << use_name << " was already declared here: "
<< test->second->get_fileline() << ends;
VLerror(msg.str().c_str());
VLerror(loc, msg.str().c_str());
}