Skip to content

Commit

Permalink
Merge pull request chipsalliance#1851 from alainmarcel/alainmarcel-pa…
Browse files Browse the repository at this point in the history
…tch-1

grammar opt
  • Loading branch information
alaindargelas authored Sep 13, 2021
2 parents 60e16eb + 2c0a1be commit 3500608
Show file tree
Hide file tree
Showing 7 changed files with 11,342 additions and 11,507 deletions.
14 changes: 7 additions & 7 deletions grammar/SV3_1aParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,8 @@ var_data_type :
| var_type data_type_or_implicit ;

signing
: SIGNED # Signing_Signed
| UNSIGNED # Signing_Unsigned
: SIGNED
| UNSIGNED
;


Expand Down Expand Up @@ -1066,11 +1066,11 @@ tf_port_item : ( attribute_instance )*
identifier variable_dimension* ( ASSIGN_OP expression )? ;

tf_port_direction
: INPUT # TfPortDir_Inp
| OUTPUT # TfPortDir_Out
| INOUT # TfPortDir_Inout
| REF # TfPortDir_Ref
| CONST REF # TfPortDir_ConstRef
: INPUT
| OUTPUT
| INOUT
| REF
| CONST REF
;

tf_port_declaration : ( attribute_instance )* tf_port_direction ( var_type )?
Expand Down
21 changes: 21 additions & 0 deletions src/SourceCompile/SV3_1aTreeShapeListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1859,4 +1859,25 @@ void SV3_1aTreeShapeListener::exitNumber(SV3_1aParser::NumberContext *ctx) {
addVObject(ctx, VObjectType::slNumber_1TickbX);
}

void SV3_1aTreeShapeListener::exitSigning(SV3_1aParser::SigningContext *ctx) {
if (ctx->SIGNED())
addVObject(ctx, VObjectType::slSigning_Signed);
else if (ctx->UNSIGNED())
addVObject(ctx, VObjectType::slSigning_Unsigned);
}

void SV3_1aTreeShapeListener::exitTf_port_direction(
SV3_1aParser::Tf_port_directionContext *ctx) {
if (ctx->INPUT())
addVObject(ctx, VObjectType::slTfPortDir_Inp);
else if (ctx->OUTPUT())
addVObject(ctx, VObjectType::slTfPortDir_Out);
else if (ctx->INOUT())
addVObject(ctx, VObjectType::slTfPortDir_Inout);
else if (ctx->REF())
addVObject(ctx, VObjectType::slTfPortDir_Ref);
else if (ctx->CONST())
addVObject(ctx, VObjectType::slTfPortDir_ConstRef);
}

} // namespace SURELOG
9 changes: 9 additions & 0 deletions src/SourceCompile/generate_parser_listener.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ set TYPES(slNumber_1TickbX) 1
set TYPES(slNumber_1TickBx) 1
set TYPES(slNumber_1TickBX) 1
set TYPES(slSigning_Signed) 1
set TYPES(slSigning_Unsigned) 1
set TYPES(slTfPortDir_Inp) 1
set TYPES(slTfPortDir_Out) 1
set TYPES(slTfPortDir_Inout) 1
set TYPES(slTfPortDir_Ref) 1
set TYPES(slTfPortDir_ConstRef) 1
set TYPES(slIntegerAtomType_Byte) 1
set TYPES(slIntegerAtomType_Shortint) 1
set TYPES(slIntegerAtomType_Int) 1
Expand Down
Loading

0 comments on commit 3500608

Please sign in to comment.