diff --git a/vpi/sdf_lexor.lex b/vpi/sdf_lexor.lex index a653ff53c..dcbd22021 100644 --- a/vpi/sdf_lexor.lex +++ b/vpi/sdf_lexor.lex @@ -5,7 +5,7 @@ %{ /* - * Copyright (c) 2007-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2010 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 @@ -73,6 +73,12 @@ static int yywrap(void) [pP][oO][sS][eE][dD][gG][eE] {return K_POSEDGE; } [nN][eE][gG][eE][dD][gG][eE] {return K_NEGEDGE; } + /* Integer values */ +[0-9]+ { + yylval.int_val = strtoul(yytext, 0); + return INTEGER; +} + /* Real values */ [0-9]+(\.[0-9]+)?([Ee][+-]?[0-9]+)? { yylval.real_val = strtod(yytext, 0); diff --git a/vpi/sdf_parse.y b/vpi/sdf_parse.y index f432ed9e6..cf2796ec5 100644 --- a/vpi/sdf_parse.y +++ b/vpi/sdf_parse.y @@ -1,7 +1,7 @@ %{ /* - * Copyright (c) 1998-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2010 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 @@ -58,7 +58,7 @@ char sdf_use_hchar = '.'; %type celltype %type cell_instance %type hierarchical_identifier -%type port port_instance +%type port port_instance port_interconnect %type rtriple signed_real_number %type delval rvalue @@ -173,6 +173,11 @@ time_scale sdf_parse_path, @2.first_line, $3, $4); free($4); } + | '(' K_TIMESCALE INTEGER IDENTIFIER ')' + { if (sdf_flag_inform) vpi_printf("%s:%d:SDF INFO: TIMESCALE : %lu%s\n", + sdf_parse_path, @2.first_line, $3, $4); + free($4); + } ; cell_list @@ -254,7 +259,8 @@ del_def | '(' K_IOPATH error ')' { vpi_printf("%s:%d: SDF ERROR: Invalid/malformed IOPATH\n", sdf_parse_path, @2.first_line); } - | '(' K_INTERCONNECT port_instance port_instance delval_list ')' + /* | '(' K_INTERCONNECT port_instance port_instance delval_list ')' */ + | '(' K_INTERCONNECT port_interconnect port_interconnect delval_list ')' { if (sdf_flag_warning) vpi_printf("%s:%d: SDF WARNING: " "INTERCONNECT not supported.\n", sdf_parse_path, @2.first_line); @@ -301,6 +307,14 @@ port /* | hierarchical_identifier '[' INTEGER ']' */ ; + /* Since INTERCONNECT is ignored we can also ignore a vector bit. */ +port_interconnect + : hierarchical_identifier + { $$ = $1; } + | hierarchical_identifier '[' INTEGER ']' + { $$ = $1;} + ; + port_edge : '(' {start_edge_id();} edge_identifier {stop_edge_id();} port_instance ')' { $$.vpi_edge = $3; $$.string_val = $5; } @@ -384,6 +398,9 @@ signed_real_number : REAL_NUMBER { $$ = $1; } | '+' REAL_NUMBER { $$ = $2; } | '-' REAL_NUMBER { $$ = -$2; } + | INTEGER { $$ = $1; } + | '+' INTEGER { $$ = $2; } + | '-' INTEGER { $$ = -$2; } ; %%