diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-08-21 17:22:04 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-08-21 17:22:04 +0200 |
commit | 6c5cafcd8bf4d6b12b4d510480a0ccc1adee7212 (patch) | |
tree | e6e3c956e5cdc73bc80c50b7137897ef04c182d2 /frontends/verilog | |
parent | 085c8e873d4d90129a952eba85836891635a7f8c (diff) | |
download | yosys-6c5cafcd8bf4d6b12b4d510480a0ccc1adee7212.tar.gz yosys-6c5cafcd8bf4d6b12b4d510480a0ccc1adee7212.tar.bz2 yosys-6c5cafcd8bf4d6b12b4d510480a0ccc1adee7212.zip |
Added support for DPI function with different names in C and Verilog
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/lexer.l | 8 | ||||
-rw-r--r-- | frontends/verilog/parser.y | 13 |
2 files changed, 16 insertions, 5 deletions
diff --git a/frontends/verilog/lexer.l b/frontends/verilog/lexer.l index cf51aac82..f79f81a9c 100644 --- a/frontends/verilog/lexer.l +++ b/frontends/verilog/lexer.l @@ -280,10 +280,6 @@ import[ \t\r\n]+\"(DPI|DPI-C)\"[ \t\r\n]+function[ \t\r\n]+ { return TOK_DPI_FUNCTION; } -<IMPORT_DPI>[(),] { - return *yytext; -} - <IMPORT_DPI>[a-zA-Z_$][a-zA-Z0-9_$]* { frontend_verilog_yylval.string = new std::string(std::string("\\") + yytext); return TOK_ID; @@ -296,6 +292,10 @@ import[ \t\r\n]+\"(DPI|DPI-C)\"[ \t\r\n]+function[ \t\r\n]+ { return *yytext; } +<IMPORT_DPI>. { + return *yytext; +} + "\\"[^ \t\r\n]+ { frontend_verilog_yylval.string = new std::string(yytext); return TOK_ID; diff --git a/frontends/verilog/parser.y b/frontends/verilog/parser.y index 1d62bc3be..22312c6d1 100644 --- a/frontends/verilog/parser.y +++ b/frontends/verilog/parser.y @@ -416,7 +416,7 @@ module_body_stmt: task_func_decl: attr TOK_DPI_FUNCTION TOK_ID TOK_ID { - current_function_or_task = new AstNode(AST_DPI_FUNCTION, AstNode::mkconst_str(*$3)); + current_function_or_task = new AstNode(AST_DPI_FUNCTION, AstNode::mkconst_str(*$3), AstNode::mkconst_str(*$4)); current_function_or_task->str = *$4; append_attr(current_function_or_task, $1); ast_stack.back()->children.push_back(current_function_or_task); @@ -425,6 +425,17 @@ task_func_decl: } opt_dpi_function_args ';' { current_function_or_task = NULL; } | + attr TOK_DPI_FUNCTION TOK_ID '=' TOK_ID TOK_ID { + current_function_or_task = new AstNode(AST_DPI_FUNCTION, AstNode::mkconst_str(*$5), AstNode::mkconst_str(*$3)); + current_function_or_task->str = *$6; + append_attr(current_function_or_task, $1); + ast_stack.back()->children.push_back(current_function_or_task); + delete $3; + delete $5; + delete $6; + } opt_dpi_function_args ';' { + current_function_or_task = NULL; + } | attr TOK_TASK TOK_ID ';' { current_function_or_task = new AstNode(AST_TASK); current_function_or_task->str = *$3; |