diff --git a/Changes b/Changes index b737e011f..1628387e2 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks! * Verilator 4.023 devel +**** Support $rewind. + **** Add -Wpedantic for compliance testing. **** Add error on redefining preprocessor directives. [Piotr Binkowski] diff --git a/src/verilog.l b/src/verilog.l index da62a98d4..303dcb845 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -200,6 +200,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "$recovery" { FL; return yaTIMINGSPEC; } "$recrem" { FL; return yaTIMINGSPEC; } "$removal" { FL; return yaTIMINGSPEC; } + "$rewind" { FL; return yD_REWIND; } "$rtoi" { FL; return yD_RTOI; } "$setup" { FL; return yaTIMINGSPEC; } "$setuphold" { FL; return yaTIMINGSPEC; } diff --git a/src/verilog.y b/src/verilog.y index 88b497cfc..b974e0c3f 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -538,6 +538,7 @@ class AstSenTree; %token yD_READMEMH "$readmemh" %token yD_REALTIME "$realtime" %token yD_REALTOBITS "$realtobits" +%token yD_REWIND "$rewind" %token yD_RIGHT "$right" %token yD_RTOI "$rtoi" %token yD_SFORMAT "$sformat" @@ -2952,6 +2953,7 @@ system_f_call_or_t: // IEEE: part of system_tf_call (can be task or func) | yD_RANDOM parenE { $$ = new AstRand($1); } | yD_REALTIME parenE { $$ = new AstTimeD($1); } | yD_REALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); } + | yD_REWIND '(' idClassSel ')' { $$ = new AstFSeek($1, $3, new AstConst($1, 0), new AstConst($1, 0)); } | yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,NULL); } | yD_RIGHT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,$5); } | yD_RTOI '(' expr ')' { $$ = new AstRToIS($1,$3); } diff --git a/test_regress/t/t_sys_file_basic.v b/test_regress/t/t_sys_file_basic.v index e8fc7d014..b67512811 100644 --- a/test_regress/t/t_sys_file_basic.v +++ b/test_regress/t/t_sys_file_basic.v @@ -247,6 +247,9 @@ module t; if ($fseek(file, 0, 2) != 0) $stop; v_off = $ftell(file); if (v_off < v_length) $stop; + if ($rewind(file) != 0) $stop; + v_off = $ftell(file); + if (v_off != 0) $stop; $fclose(file); end