mirror of https://github.com/zachjs/sv2v.git
added support for inside expressions (closes #28)
This commit is contained in:
parent
33bea9e694
commit
1a6e0ce9df
|
|
@ -388,7 +388,7 @@ string { Token Lit_string _ _ }
|
|||
%left "^" "^~" "~^"
|
||||
%left "&" "~&"
|
||||
%left "==" "!=" "===" "!==" "==?" "!=?"
|
||||
%left "<" "<=" ">" ">="
|
||||
%left "<" "<=" ">" ">=" "inside" "dist"
|
||||
%left "<<" ">>" "<<<" ">>>"
|
||||
%left "+" "-"
|
||||
%left "*" "/" "%"
|
||||
|
|
@ -999,6 +999,7 @@ Expr :: { Expr }
|
|||
| "'" "{" PatternItems "}" { Pattern $3 }
|
||||
| "{" StreamOp StreamSize Concat "}" { Stream $2 $3 $4 }
|
||||
| "{" StreamOp Concat "}" { Stream $2 (Number "1") $3 }
|
||||
| Expr "inside" Concat { foldl1 (BinOp LogOr) $ map (BinOp Eq $1) $3 }
|
||||
-- binary expressions
|
||||
| Expr "||" Expr { BinOp LogOr $1 $3 }
|
||||
| Expr "&&" Expr { BinOp LogAnd $1 $3 }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
module top;
|
||||
initial
|
||||
for (logic [1:0] a = 0; a < 3; a++) begin
|
||||
if (a inside {2'b01, 2'b00})
|
||||
$display("fizz");
|
||||
if (a inside {2'b10})
|
||||
$display("buzz");
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module top;
|
||||
initial begin : foo
|
||||
reg [1:0] a;
|
||||
for (a = 0; a < 3; a++) begin
|
||||
if (a == 2'b01 || a == 2'b00)
|
||||
$display("fizz");
|
||||
if (a == 2'b10)
|
||||
$display("buzz");
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
Loading…
Reference in New Issue