mirror of
https://github.com/verilator/verilator.git
synced 2025-01-22 14:24:18 +00:00
Support type(t) static casting
This commit is contained in:
parent
9a9931fb9d
commit
ff262fc4fb
@ -4219,6 +4219,8 @@ expr<nodep>: // IEEE: part of expression/constant_expression/primary
|
||||
// // IEEE: cast/constant_cast
|
||||
// // expanded from casting_type
|
||||
| simple_type yP_TICK '(' expr ')' { $$ = new AstCast($1->fileline(), $4, $1); }
|
||||
| yTYPE '(' exprOrDataType ')' yP_TICK '(' expr ')'
|
||||
{ $$ = new AstCast($1, $7, new AstRefDType($1, AstRefDType::FlagTypeOfExpr(), $3)); }
|
||||
| ySIGNED yP_TICK '(' expr ')' { $$ = new AstSigned($1, $4); }
|
||||
| yUNSIGNED yP_TICK '(' expr ')' { $$ = new AstUnsigned($1, $4); }
|
||||
| ySTRING yP_TICK '(' expr ')' { $$ = new AstCvtPackString($1, $4); }
|
||||
|
@ -15,6 +15,8 @@ module t(/*AUTOARG*/);
|
||||
y = 2.3;
|
||||
z = x + y;
|
||||
if (z != (1.2+2.3)) $stop;
|
||||
z = type(z)'(22);
|
||||
if (z != 22.0) $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user