From e137e93f944b1200a3c24039959a0a4a55f8274d Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 24 Apr 2008 14:32:39 +0000 Subject: [PATCH] Support optional argument to and . git-svn-id: file://localhost/svn/verilator/trunk/verilator@1034 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 2 ++ bin/verilator | 4 ++++ src/verilog.y | 2 ++ test_regress/t/t_sys_file.v | 4 ++-- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index d5a9b154f..455812ebc 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Allow defines terminated in EOF, though against spec. [Stefan Thiede] +**** Support optional argument to $finish and $stop. [by Stefan Thiede] + **** Fix "always @ ((a) or (b))" syntax error. [by Niranjan Prabhu] **** Fix "output reg name=expr;" syntax error. [Martin Scharrer] diff --git a/bin/verilator b/bin/verilator index 8fa60bbfa..c63244801 100755 --- a/bin/verilator +++ b/bin/verilator @@ -1548,6 +1548,10 @@ argument (as with C's printf), you cannot simply list variables standalone. The sized display functions are rarely used and so not supported. Replace them with a $write with the appropriate format specifier. +=item $finish, $stop + +The rarely used optional exit code to finish and stop is ignored. + =item $fopen, $fclose, $fdisplay, $fwrite File descriptors passed to the file PLI calls must be file descriptors, not diff --git a/src/verilog.y b/src/verilog.y index ffe977d58..583eb0740 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -897,7 +897,9 @@ stmt: ';' { $$ = NULL; } | yD_C '(' cStrList ')' ';' { $$ = (v3Global.opt.ignc() ? NULL : new AstUCStmt($1,$3)); } | yD_FCLOSE '(' varRefDotBit ')' ';' { $$ = new AstFClose($1, $3); } | yD_FINISH parenE ';' { $$ = new AstFinish($1); } + | yD_FINISH '(' expr ')' ';' { $$ = new AstFinish($1); } | yD_STOP parenE ';' { $$ = new AstStop($1); } + | yD_STOP '(' expr ')' ';' { $$ = new AstStop($1); } | yVL_COVER_OFF { $$ = new AstPragma($1,AstPragmaType::COVERAGE_BLOCK_OFF); } | stateCaseForIf { $$ = $1; } | taskRef ';' { $$ = $1; } diff --git a/test_regress/t/t_sys_file.v b/test_regress/t/t_sys_file.v index 23f98b01a..935f7cb9c 100644 --- a/test_regress/t/t_sys_file.v +++ b/test_regress/t/t_sys_file.v @@ -23,7 +23,7 @@ module t; $fclose(file); `ifdef verilator - if (file != 0) $stop; + if (file != 0) $stop(1); // Also test arguments to stop $fwrite(file, "Never printed, file closed\n"); `endif @@ -39,6 +39,6 @@ module t; end $write("*-* All Finished *-*\n"); - $finish; + $finish(0); // Test arguments to finish end endmodule