Parse TIMINGCHECK syntax

Parse and ignore the TIMINGCHECK rules, and also parse
and ignore INTERCONNECT delays.
This commit is contained in:
Stephen Williams 2007-11-27 20:53:48 -08:00
parent 2851b9bd9a
commit 2a269f1bb7
3 changed files with 81 additions and 12 deletions

View File

@ -74,6 +74,15 @@ static int yywrap(void)
return QSTRING;
}
/* The HCHAR (hierarchy separator) is set by the SDF file itself. We
recognize here the HCHAR. */
[./] {
if (sdf_use_hchar==yytext[0])
return HCHAR;
else
return yytext[0];
}
. { return yytext[0]; }
%%
@ -90,17 +99,25 @@ static struct {
{ "DELAYFILE", K_DELAYFILE },
{ "DESIGN", K_DESIGN },
{ "DIVIDER", K_DIVIDER },
{ "HOLD", K_HOLD },
{ "INCREMENT", K_INCREMENT },
{ "INTERCONNECT",K_INTERCONNECT },
{ "INSTANCE", K_INSTANCE },
{ "IOPATH", K_IOPATH },
{ "PROCESS", K_PROCESS },
{ "PROGRAM", K_PROGRAM },
{ "RECOVERY", K_RECOVERY },
{ "REMOVAL", K_REMOVAL },
{ "SDFVERSION", K_SDFVERSION },
{ "SETUP", K_SETUP },
{ "SETUPHOLD", K_SETUPHOLD },
{ "TEMPERATURE",K_TEMPERATURE },
{ "TIMESCALE", K_TIMESCALE },
{ "TIMINGCHECK",K_TIMINGCHECK },
{ "VENDOR", K_VENDOR },
{ "VERSION", K_VERSION },
{ "VOLTAGE", K_VOLTAGE },
{ "WIDTH", K_WIDTH },
{ 0, IDENTIFIER }
};

View File

@ -25,9 +25,10 @@ static void yyerror(const char*msg);
# include "sdf_parse_priv.h"
# include "sdf_priv.h"
# include <stdio.h>
# include <string.h>
/* This is the hierarchy separator to use. */
static char use_hchar = '.';
char sdf_use_hchar = '.';
%}
@ -40,10 +41,12 @@ static char use_hchar = '.';
};
%token K_ABSOLUTE K_CELL K_CELLTYPE K_DATE K_DELAYFILE K_DELAY K_DESIGN
%token K_DIVIDER K_INCREMENT K_INSTANCE K_IOPATH
%token K_PROCESS K_PROGRAM K_SDFVERSION K_TEMPERATURE K_TIMESCALE
%token K_VENDOR K_VERSION K_VOLTAGE
%token K_DIVIDER K_HOLD K_INCREMENT K_INSTANCE K_INTERCONNECT K_IOPATH
%token K_PROCESS K_PROGRAM K_RECOVERY K_REMOVAL
%token K_SDFVERSION K_SETUP K_SETUPHOLD K_TEMPERATURE K_TIMESCALE
%token K_TIMINGCHECK K_VENDOR K_VERSION K_VOLTAGE K_WIDTH
%token HCHAR
%token <string_val> QSTRING IDENTIFIER
%token <real_val> REAL_NUMBER
%token <int_val> INTEGER
@ -134,8 +137,9 @@ program_version
;
hierarchy_divider
: '(' K_DIVIDER '.' ')' { use_hchar = '.'; }
| '(' K_DIVIDER '/' ')' { use_hchar = '/'; }
: '(' K_DIVIDER '.' ')' { sdf_use_hchar = '.'; }
| '(' K_DIVIDER '/' ')' { sdf_use_hchar = '/'; }
| '(' K_DIVIDER HCHAR ')' { /* sdf_use_hchar no-change */; }
;
voltage
@ -175,7 +179,8 @@ cell
timing_spec_list
')'
{ free($3);
free($4); }
if ($4) free($4);
}
| '(' K_CELL error ')'
{ vpi_printf("%s:%d: Syntax error in CELL\n",
sdf_parse_path, @2.first_line); }
@ -189,6 +194,8 @@ celltype
cell_instance
: '(' K_INSTANCE hierarchical_identifier ')'
{ $$ = $3; }
| '(' K_INSTANCE ')'
{ $$ = strdup(""); }
| '(' K_INSTANCE '*' ')'
{ $$ = 0; }
;
@ -201,8 +208,12 @@ timing_spec_list
timing_spec
: '(' K_DELAY deltype_list ')'
| '(' K_DELAY error ')'
{ vpi_printf("%s:%d: Syntax error in CELL DELAY SPEC\n",
sdf_parse_path, @2.first_line); }
{ vpi_printf("%s:%d: Syntax error in CELL DELAY SPEC\n",
sdf_parse_path, @2.first_line); }
| '(' K_TIMINGCHECK tchk_def_list ')'
| '(' K_TIMINGCHECK error ')'
{ vpi_printf("%s:%d: Syntax error in TIMINGCHECK SPEC\n",
sdf_parse_path, @2.first_line); }
;
deltype_list
@ -214,7 +225,7 @@ deltype
: '(' K_ABSOLUTE del_def_list ')'
| '(' K_INCREMENT del_def_list ')'
| '(' error ')'
{ vpi_printf("%s:%d: Invalid/malformed delay type\n",
{ vpi_printf("%s:%d: SDF ERROR: Invalid/malformed delay type\n",
sdf_parse_path, @1.first_line); }
;
@ -230,8 +241,38 @@ del_def
free($4);
}
| '(' K_IOPATH error ')'
{ vpi_printf("%s:%d: Invalid/malformed IOPATH\n",
{ vpi_printf("%s:%d: SDF ERROR: Invalid/malformed IOPATH\n",
sdf_parse_path, @2.first_line); }
| '(' K_INTERCONNECT port_instance port_instance delval_list ')'
{ if (sdf_flag_warning) vpi_printf("%s:%d: SDF WARNING: "
"INTERCONNECT not supported.\n",
sdf_parse_path, @2.first_line);
free($3);
free($4);
}
| '(' K_INTERCONNECT error ')'
{ vpi_printf("%s:%d: SDF ERROR: Invalid/malformed INTERCONNECT\n",
sdf_parse_path, @2.first_line); }
;
tchk_def_list
: tchk_def_list tchk_def
| tchk_def
;
/* Timing checks are ignored. */
tchk_def
: '(' K_SETUP port_tchk port_tchk rvalue ')'
| '(' K_HOLD port_tchk port_tchk rvalue ')'
| '(' K_SETUPHOLD port_tchk port_tchk rvalue rvalue ')'
| '(' K_RECOVERY port_tchk port_tchk rvalue ')'
| '(' K_REMOVAL port_tchk port_tchk rvalue ')'
| '(' K_WIDTH port_tchk rvalue ')'
;
port_tchk
: port_spec
/* | '(' K_COND qstring_opt timing_check_condition port_spec ')' */
;
port_spec
@ -290,7 +331,15 @@ rvalue
hierarchical_identifier
: IDENTIFIER
{ $$ = $1; }
{ $$ = $1; }
| hierarchical_identifier HCHAR IDENTIFIER
{ int len = strlen($1) + strlen($3) + 2;
char*tmp = realloc($1, len);
strcat(tmp, ".");
strcat(tmp, $3);
free($3);
$$ = tmp;
}
;
rtriple

View File

@ -27,4 +27,7 @@
/* Path to source for error messages. */
extern const char*sdf_parse_path;
/* Hierarchy seperator charactor to use. */
extern char sdf_use_hchar;
#endif