Command line control of warnings

Implement extended vvp command line options to control the amount
of detail that the sdf annotator emits while parsing the source
file.

Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
Stephen Williams 2007-11-22 18:22:46 -08:00
parent 4986e550b1
commit 5af8fff980
4 changed files with 86 additions and 28 deletions

View File

@ -91,35 +91,43 @@ sdfversion
design_name
: '(' K_DESIGN QSTRING ')'
{ vpi_printf("SDF Design: %s\n", $3);
free($3);
}
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: Design: %s\n",
sdf_parse_path, @2.first_line, $3);
free($3);
}
;
date
: '(' K_DATE QSTRING ')'
{ vpi_printf("SDF Date: %s\n", $3);
free($3);
}
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: Date: %s\n",
sdf_parse_path, @2.first_line, $3);
free($3);
}
;
vendor : '(' K_VENDOR QSTRING ')'
{ vpi_printf("SDF Vendor: %s\n", $3);
free($3);
}
vendor
: '(' K_VENDOR QSTRING ')'
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: Vendor: %s\n",
sdf_parse_path, @2.first_line, $3);
free($3);
}
;
program_name : '(' K_PROGRAM QSTRING ')'
{ vpi_printf("SDF Program: %s\n", $3);
free($3);
}
;
program_name
: '(' K_PROGRAM QSTRING ')'
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: Program: %s\n",
sdf_parse_path, @2.first_line, $3);
free($3);
}
;
program_version : '(' K_VERSION QSTRING ')'
{ vpi_printf("SDF Program Version: %s\n", $3);
free($3);
}
;
program_version
: '(' K_VERSION QSTRING ')'
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: Program Version: %s\n",
sdf_parse_path, @2.first_line, $3);
free($3);
}
;
hierarchy_divider
: '(' K_DIVIDER '.' ')' { use_hchar = '.'; }
@ -131,11 +139,13 @@ voltage
| '(' K_VOLTAGE signed_real_number ')'
;
process : '(' K_PROCESS QSTRING ')'
{ vpi_printf("SDF Process: %s\n", $3);
free($3);
}
;
process
: '(' K_PROCESS QSTRING ')'
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: Process: %s\n",
sdf_parse_path, @2.first_line, $3);
free($3);
}
;
temperature
: '(' K_TEMPERATURE rtriple ')'
@ -144,9 +154,10 @@ temperature
time_scale
: '(' K_TIMESCALE REAL_NUMBER IDENTIFIER ')'
{ vpi_printf("SDF TIMESCALE : %f%s\n", $3, $4);
free($4);
}
{ if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: TIMESCALE : %f%s\n",
sdf_parse_path, @2.first_line, $3, $4);
free($4);
}
;
cell_list

View File

@ -28,6 +28,8 @@
*/
extern void sdf_process_file(FILE*fd, const char*path);
extern int sdf_flag_warning;
extern int sdf_flag_inform;
/* ****
* These functions are called by the parser to process the SDF file as

View File

@ -29,6 +29,9 @@
* These are static context
*/
int sdf_flag_warnings = 0;
int sdf_flag_inform = 0;
/* Scope of the $sdf_annotate call. Annotation starts here. */
static vpiHandle sdf_scope;
/* The cell in process. */
@ -134,8 +137,36 @@ void sdf_iopath_delays(const char*src, const char*dst,
vpi_put_delays(path, &delays);
}
static void check_command_line_args(void)
{
struct t_vpi_vlog_info vlog_info;
int idx;
static int sdf_command_line_done = 0;
if (sdf_command_line_done)
return;
vpi_get_vlog_info(&vlog_info);
for (idx = 0 ; idx < vlog_info.argc ; idx += 1) {
if (strcmp(vlog_info.argv[idx],"-sdf-warn") == 0) {
sdf_flag_warnings = 1;
} else if (strcmp(vlog_info.argv[idx],"-sdf-info") == 0) {
sdf_flag_inform = 1;
} else if (strcmp(vlog_info.argv[idx],"-sdf-verbose") == 0) {
sdf_flag_warnings = 1;
sdf_flag_inform = 1;
}
}
sdf_command_line_done = 1;
}
static PLI_INT32 sys_sdf_annotate_compiletf(PLI_BYTE8*name)
{
check_command_line_args();
return 0;
}

View File

@ -96,6 +96,20 @@ space, and is written out incrementally. Thus, you can view lxt2 files
while a simulation is still running (or paused) or if your simulation
crashes or is killed, you still have a useful dump.
.TP 8
.B -sdf-warn
When loading an SDF annnotation file, this option causes the annotator
to print warnings for questionable but non-fatal issues.
.TP 8
.B -sdf-info
When loading an SDF annnotation file, this option causes the annotator
to print information about the annotation.
.TP 8
.B -sdf-verbose
This is shorthand for -sdf-info -sdf-warn.
.SH ENVIRONMENT
.PP
The vvp command also accepts some environment variables that control