mirror of https://github.com/zachjs/sv2v.git
fix precedence of non-blocking assignment
This commit is contained in:
parent
2a4d1cc5a8
commit
dce7f14909
|
|
@ -398,6 +398,7 @@ time { Token Lit_time _ _ }
|
|||
|
||||
|
||||
-- operator precedences, from *lowest* to *highest*
|
||||
%nonassoc Asgn
|
||||
%nonassoc NoElse
|
||||
%nonassoc "else"
|
||||
%right "|->" "|=>" "#-#" "#=#"
|
||||
|
|
@ -647,8 +648,8 @@ DeclToken :: { DeclToken }
|
|||
| "{" StreamOp StreamSize Concat "}" {% posInject \p -> DTStream p $2 $3 (map toLHS $4) }
|
||||
| "{" StreamOp Concat "}" {% posInject \p -> DTStream p $2 (RawNum 1) (map toLHS $3) }
|
||||
| opt("var") "type" "(" Expr ")" {% posInject \p -> DTType p (\Unspecified -> \[] -> TypeOf $4) }
|
||||
| "<=" opt(DelayOrEvent) Expr {% posInject \p -> DTAsgn p AsgnOpNonBlocking $2 $3 }
|
||||
| IncOrDecOperator {% posInject \p -> DTAsgn p (AsgnOp $1) Nothing (RawNum 1) }
|
||||
| "<=" opt(DelayOrEvent) Expr %prec Asgn {% posInject \p -> DTAsgn p AsgnOpNonBlocking $2 $3 }
|
||||
| Identifier "::" Identifier {% posInject \p -> DTPSIdent p $1 $3 }
|
||||
| Identifier ParamBindings "::" Identifier {% posInject \p -> DTCSIdent p $1 $2 $4 }
|
||||
DeclTokenAsgn :: { DeclToken }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
`define TEST(stmt) \
|
||||
begin \
|
||||
stmt; \
|
||||
#1 $display("%b", foo); \
|
||||
stmt; \
|
||||
#1 $display("%b", foo); \
|
||||
end
|
||||
|
||||
module top;
|
||||
reg foo;
|
||||
localparam bar = 10;
|
||||
initial begin
|
||||
`TEST(foo <= bar <= 11)
|
||||
`TEST(foo <= bar <= 11 <= 0)
|
||||
`TEST(foo <= bar <= 11 <= 0 <= 0)
|
||||
end
|
||||
endmodule
|
||||
Loading…
Reference in New Issue