From d65ba037a8ed9b543be6c755d0aa7f6c57d64d3a Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Wed, 22 Oct 2025 08:48:28 +0100 Subject: [PATCH] Internals: Simplify parsing of 'fork' blocks --- src/V3ParseImp.h | 1 + src/verilog.y | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/V3ParseImp.h b/src/V3ParseImp.h index d2e3aa988..df829f61e 100644 --- a/src/V3ParseImp.h +++ b/src/V3ParseImp.h @@ -128,6 +128,7 @@ struct V3ParseBisonYYSType final { VFwdType::en fwdtype; VLifetime::en lifetime; VStrength::en strength; + VJoinType::en joinType; #include "V3Ast__gen_yystype.h" }; diff --git a/src/verilog.y b/src/verilog.y index acb7a2703..734dea2ce 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -3373,32 +3373,22 @@ seq_blockPreId: // IEEE: seq_block, but called with leading ID GRAMMARP->endLabel($4, $1, $4); } ; +par_blockJoin: + yJOIN { $$ = VJoinType::JOIN; } + | yJOIN_ANY { $$ = VJoinType::JOIN_ANY; } + | yJOIN_NONE { $$ = VJoinType::JOIN_NONE; } + ; + par_block: // ==IEEE: par_block - par_blockFront blockDeclStmtListE yJOIN endLabelE - { $$ = $1; $1->joinType(VJoinType::JOIN); - V3ParseGrammar::addForkStmtsp($1, $2); - GRAMMARP->endLabel($4, $1, $4); } - | par_blockFront blockDeclStmtListE yJOIN_ANY endLabelE - { $$ = $1; $1->joinType(VJoinType::JOIN_ANY); - V3ParseGrammar::addForkStmtsp($1, $2); - GRAMMARP->endLabel($4, $1, $4); } - | par_blockFront blockDeclStmtListE yJOIN_NONE endLabelE - { $$ = $1; $1->joinType(VJoinType::JOIN_NONE); + par_blockFront blockDeclStmtListE par_blockJoin endLabelE + { $$ = $1; $1->joinType($3); V3ParseGrammar::addForkStmtsp($1, $2); GRAMMARP->endLabel($4, $1, $4); } ; par_blockPreId: // ==IEEE: par_block but called with leading ID - par_blockFrontPreId blockDeclStmtListE yJOIN endLabelE - { $$ = $1; $1->joinType(VJoinType::JOIN); - V3ParseGrammar::addForkStmtsp($1, $2); - GRAMMARP->endLabel($4, $1, $4); } - | par_blockFrontPreId blockDeclStmtListE yJOIN_ANY endLabelE - { $$ = $1; $1->joinType(VJoinType::JOIN_ANY); - V3ParseGrammar::addForkStmtsp($1, $2); - GRAMMARP->endLabel($4, $1, $4); } - | par_blockFrontPreId blockDeclStmtListE yJOIN_NONE endLabelE - { $$ = $1; $1->joinType(VJoinType::JOIN_NONE); + par_blockFrontPreId blockDeclStmtListE par_blockJoin endLabelE + { $$ = $1; $1->joinType($3); V3ParseGrammar::addForkStmtsp($1, $2); GRAMMARP->endLabel($4, $1, $4); } ;