Do a better job with synthesis translate pragmas.

This commit is contained in:
Stephen Williams 2014-08-09 08:04:25 -07:00 committed by Maciej Suminski
parent 6765e32ab9
commit 486dc7abeb
2 changed files with 7 additions and 11 deletions

View File

@ -137,8 +137,13 @@ TU [munpf]
current line. These are very easy to handle. The meta-comments
format is a little more tricky to handle, but do what we can. */
"//"{W}*"synthesis"{W}*"translate_on"{W}*\n { return K_MC_TRANSLATE_ON; }
"//"{W}*"synthesis"{W}*"translate_off"{W}*\n { return K_MC_TRANSLATE_OFF; }
/* The lexor detects "// synthesis translate_on/off" meta-comments,
we handle them here by turning on/off a flag. The pform uses
that flag to attach implicit attributes to "initial" and
"always" statements. */
"//"{W}*"synthesis"{W}*"translate_on"{W}*\n { pform_mc_translate_on(true); }
"//"{W}*"synthesis"{W}*"translate_off"{W}*\n { pform_mc_translate_on(false); }
"//" { comment_enter = YY_START; BEGIN(LCOMMENT); }
<LCOMMENT>. { yymore(); }
<LCOMMENT>\n { yylloc.first_line += 1; BEGIN(comment_enter); }

View File

@ -532,8 +532,6 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
%token K_resolveto K_sin K_sinh K_slew K_split K_sqrt K_tan K_tanh
%token K_timer K_transition K_units K_white_noise K_wreal
%token K_zi_nd K_zi_np K_zi_zd K_zi_zp
/* Support some meta-comments as pragmas. */
%token K_MC_TRANSLATE_ON K_MC_TRANSLATE_OFF
%type <flag> from_exclude block_item_decls_opt
%type <number> number pos_neg_number
@ -4248,13 +4246,6 @@ module_item
/* Modules can contain further sub-module definitions. */
: module
/* The lexor detects "// synthesis translate_on/off" meta-comments,
we handle them here by turning on/off a flag. The pform uses
that flag to attach implicit attributes to "initial" and
"always" statements. */
| K_MC_TRANSLATE_OFF { pform_mc_translate_on(false); }
| K_MC_TRANSLATE_ON { pform_mc_translate_on(true); }
| attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';'
{ data_type_t*data_type = $3;