Skip to content

Commit

Permalink
Allow dist expressions in sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Aug 14, 2021
1 parent 184beae commit a12c4a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/binding/AssertionExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static const Expression& bindExpr(const ExpressionSyntax& syntax, const BindCont
if (allowInstances && (expr.type->isSequenceType() || expr.type->isPropertyType()))
return expr;

if (!expr.type->isValidForSequence()) {
if (!expr.type->isValidForSequence() && expr.kind != ExpressionKind::Dist) {
auto& comp = context.getCompilation();
context.addDiag(diag::AssertionExprType, expr.sourceRange) << *expr.type;
return *comp.emplace<InvalidExpression>(&expr, comp.getErrorType());
Expand Down
13 changes: 13 additions & 0 deletions tests/unittests/AssertionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,3 +1121,16 @@ endmodule
CHECK(diags[0].code == diag::ConcurrentAssertActionBlock);
CHECK(diags[1].code == diag::ConcurrentAssertActionBlock);
}

TEST_CASE("Sequence with dist expression") {
auto tree = SyntaxTree::fromText(R"(
module m;
wire clk, req;
assume property (@(posedge clk) req dist {0:=40, 1:=60});
endmodule
)");

Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}

0 comments on commit a12c4a3

Please sign in to comment.