mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-25 18:15:34 +00:00
Merge pull request #2179 from splhack/static-cast
Support SystemVerilog Static Cast
This commit is contained in:
commit
8ce4f8790e
11 changed files with 135 additions and 0 deletions
|
@ -299,6 +299,7 @@ static void rewriteAsMemoryNode(AstNode *node, AstNode *rangeNode)
|
|||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%left OP_POW
|
||||
%left OP_CAST
|
||||
%right UNARY_OPS
|
||||
|
||||
%define parse.error verbose
|
||||
|
@ -3042,6 +3043,24 @@ basic_expr:
|
|||
$$ = new AstNode(AST_LOGIC_NOT, $3);
|
||||
SET_AST_NODE_LOC($$, @1, @3);
|
||||
append_attr($$, $2);
|
||||
} |
|
||||
TOK_SIGNED OP_CAST '(' expr ')' {
|
||||
if (!sv_mode)
|
||||
frontend_verilog_yyerror("Static cast is only supported in SystemVerilog mode.");
|
||||
$$ = new AstNode(AST_TO_SIGNED, $4);
|
||||
SET_AST_NODE_LOC($$, @1, @4);
|
||||
} |
|
||||
TOK_UNSIGNED OP_CAST '(' expr ')' {
|
||||
if (!sv_mode)
|
||||
frontend_verilog_yyerror("Static cast is only supported in SystemVerilog mode.");
|
||||
$$ = new AstNode(AST_TO_UNSIGNED, $4);
|
||||
SET_AST_NODE_LOC($$, @1, @4);
|
||||
} |
|
||||
basic_expr OP_CAST '(' expr ')' {
|
||||
if (!sv_mode)
|
||||
frontend_verilog_yyerror("Static cast is only supported in SystemVerilog mode.");
|
||||
$$ = new AstNode(AST_CAST_SIZE, $1, $4);
|
||||
SET_AST_NODE_LOC($$, @1, @4);
|
||||
};
|
||||
|
||||
concat_list:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue