3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-13 04:28:18 +00:00

Fixed counting verilog line numbers for "// synopsys translate_off" sections

This commit is contained in:
Clifford Wolf 2014-07-30 20:18:48 +02:00
parent 6400ae3648
commit 7daad40ca4
2 changed files with 4 additions and 4 deletions

View file

@ -74,21 +74,21 @@ namespace VERILOG_FRONTEND {
%% %%
"`file_push "[^\n]* { <INITIAL,SYNOPSYS_TRANSLATE_OFF>"`file_push "[^\n]* {
fn_stack.push_back(current_filename); fn_stack.push_back(current_filename);
ln_stack.push_back(frontend_verilog_yyget_lineno()); ln_stack.push_back(frontend_verilog_yyget_lineno());
current_filename = yytext+11; current_filename = yytext+11;
frontend_verilog_yyset_lineno(0); frontend_verilog_yyset_lineno(0);
} }
"`file_pop"[^\n]*\n { <INITIAL,SYNOPSYS_TRANSLATE_OFF>"`file_pop"[^\n]*\n {
current_filename = fn_stack.back(); current_filename = fn_stack.back();
fn_stack.pop_back(); fn_stack.pop_back();
frontend_verilog_yyset_lineno(ln_stack.back()); frontend_verilog_yyset_lineno(ln_stack.back());
ln_stack.pop_back(); ln_stack.pop_back();
} }
"`line"[ \t]+[^ \t\r\n]+[ \t]+\"[^ \r\n]+\"[^\r\n]*\n { <INITIAL,SYNOPSYS_TRANSLATE_OFF>"`line"[ \t]+[^ \t\r\n]+[ \t]+\"[^ \r\n]+\"[^\r\n]*\n {
char *p = yytext + 5; char *p = yytext + 5;
while (*p == ' ' || *p == '\t') p++; while (*p == ' ' || *p == '\t') p++;
frontend_verilog_yyset_lineno(atoi(p)); frontend_verilog_yyset_lineno(atoi(p));

View file

@ -300,7 +300,7 @@ std::string frontend_verilog_preproc(FILE *f, std::string filename, const std::m
input_file(fp, fn); input_file(fp, fn);
fclose(fp); fclose(fp);
} else } else
output_code.push_back("`file_notfound " + fn + "\n"); output_code.push_back("`file_notfound " + fn);
continue; continue;
} }