Merge pull request #181 from phire/portinfo_grammar

vvp grammar: .port_info statements should require/generate semicolons.
This commit is contained in:
Stephen Williams 2017-12-18 10:04:42 -08:00 committed by GitHub
commit 0caa109174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -2304,7 +2304,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
unsigned width = ivl_scope_mod_module_port_width(net,idx);
if( name == 0 )
name = "";
fprintf( vvp_out, " .port_info %u %s %u \"%s\"\n",
fprintf( vvp_out, " .port_info %u %s %u \"%s\";\n",
idx, vvp_port_info_type_str(ptype), width,
vvp_mangle_name(name) );
}

View File

@ -27,6 +27,7 @@
# include <cstdlib>
# include <cassert>
# include "ivl_alloc.h"
# include "version_base.h"
/*
* These are bits in the lexor.
@ -708,9 +709,19 @@ statement
/* Port information for scopes... currently this is just meta-data for VPI queries */
| K_PORT_INFO T_NUMBER port_type T_NUMBER T_STRING
| K_PORT_INFO T_NUMBER port_type T_NUMBER T_STRING ';'
{ compile_port_info( $2 /* port_index */, $3, $4 /* width */,
$5 /*&name */ ); }
/* Unfortunately, older versions didn't check for a semicolon at the end of
.port_info statements.
To insure backwards compatablitly with old files, we have a duplicate rule
that doesn't require a semicolon. After version 11, this rule will be
disabled (and can safely be deleted. */
| K_PORT_INFO T_NUMBER port_type T_NUMBER T_STRING
{ if (VERSION_MAJOR > 11)
yyerror("syntax error");
compile_port_info( $2 /* port_index */, $3, $4 /* width */,
$5 /*&name */ ); }
| K_TIMESCALE T_NUMBER T_NUMBER';'
{ compile_timescale($2, $3); }