Skip to content

Commit

Permalink
[slang] Fix PATHPULSE limit values
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan Churkin committed Jul 5, 2024
1 parent 4221f2f commit dfce622
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion scripts/diagnostics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ error WrongSpecifyDelayCount "expected one, two, three, six, or twelve delay val
error IfNoneEdgeSensitive "ifnone specify path cannot be an edge-sensitive path"
error PulseControlSpecifyParent "pulse control specparams can only be declared in specify blocks"
error PulseControlPATHPULSE "pulse control specparam names must start with 'PATHPULSE$'"
error PulseControlTwoValues "pulse control specparams must be assigned two values (reject limit and error limit)"
error TooManyEdgeDescriptors "cannot have more than six pairs of edge transitions in list"
error EdgeDescWrongKeyword "edge descriptor list cannot be used after '{}'"
error BindDirectiveInvalidName "bind target name must be a simple module or interface identifier when a list of instances is provided"
Expand Down
2 changes: 1 addition & 1 deletion source/parsing/Parser_members.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3227,7 +3227,7 @@ SpecparamDeclaratorSyntax& Parser::parseSpecparamDeclarator(SyntaxKind parentKin
if (parentKind != SyntaxKind::SpecifyBlock)
addDiag(diag::PulseControlSpecifyParent, name.range());
else if (!expr2)
addDiag(diag::PulseControlTwoValues, expr1.sourceRange()) << name.range();
expr2 = &expr1;
}
else if (expr2) {
auto last = expr2->getLastToken();
Expand Down
19 changes: 16 additions & 3 deletions tests/unittests/parsing/MemberParsingTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,20 @@ module m;
specparam PATHPULSE$a$b = (1:2:3, 4:5:6);
endspecify
endmodule
module m1;
specify
specparam PATHPULSE$ = 1;
specparam PATHPULSE$a$b = 1;
endspecify
endmodule
module m2;
specify
specparam PATHPULSE$ = (1);
specparam PATHPULSE$a$b = (1);
endspecify
endmodule
)";

parseCompilationUnit(text);
Expand All @@ -710,10 +724,9 @@ endmodule

parseCompilationUnit(text);

REQUIRE(diagnostics.size() == 3);
REQUIRE(diagnostics.size() == 2);
CHECK(diagnostics[0].code == diag::PulseControlSpecifyParent);
CHECK(diagnostics[1].code == diag::PulseControlTwoValues);
CHECK(diagnostics[2].code == diag::PulseControlPATHPULSE);
CHECK(diagnostics[1].code == diag::PulseControlPATHPULSE);
}

TEST_CASE("Invalid package decls") {
Expand Down

0 comments on commit dfce622

Please sign in to comment.