Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[slang] Finish implementation of matched/triggered sequence method restrictions. #1095

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

likeamahoney
Copy link
Contributor

Closes #524

After researching full LRM in terms of matched/triggered sequence methods correct usage I considered that such checks were not implemented in slang:

1 (matched):

... sequence triggered method should not be used in the right-hand side of a continuous assignment or of an assignment in an always_comb procedure.

example:

checker my_check(input logic clk, output logic a, output logic b);
sequence s; 1; endsequence

assign b = s.triggered; // illegal 

always_comb a = s.triggered;  // illegal
endchecker

module m(input logic clk, output logic a, output logic b);
my_check mc(clk, a, b);
endmodule

2 (triggered):

There are additional restrictions when passing local variables into an instance of a named sequence to which triggered is applied: In the declaration of the named sequence, the formal argument to which the local variable is bound shall not be referenced before it is assigned.

example:

sequence sub_seq2(lv);
(lv, lv = 1);  // violation
endsequence
sequence seq2a;
int v1; ##1 sub_seq2(v1).triggered ##1 (1 == v1);
// v1 is now bound to lv
endsequence

module m();
assert property(seq2a);
endmodule

3 (matched):

The method matched is used to detect the end point of one sequence (the source sequence) referenced in a multiclocked sequence (the destination sequence). It can only be used in sequence expressions.

example:

program check;

sequence e1;
1;
endsequence

sequence e2;
1;
endsequence

initial begin
wait (e1.matched || e2.matched); // violation
if (e1.matched) // violation
$display("e1 passed");
if (e2.matched) // violation
$display("e2 passed");
end
endprogram

Also the check that only sample named value expressions are used when passing local variables into an instance of a named sequence has been clarified (now only calls to triggered methods are checked), since LRM says that this only applies to them:

There are additional restrictions when passing local variables into an instance of a named sequence to which
triggered is applied:
—Local variables can be passed in only as entire actual arguments, not as proper subexpressions of
actual arguments.

The last one is triggered method circular dependencies restriction check is not implemented for now.

triggered and matched methods clock check should be implemented in terms of #1027

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.77%. Comparing base (2fd768f) to head (3d6d565).
Report is 23 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1095      +/-   ##
==========================================
+ Coverage   94.76%   94.77%   +0.01%     
==========================================
  Files         191      191              
  Lines       47716    47758      +42     
==========================================
+ Hits        45217    45264      +47     
+ Misses       2499     2494       -5     
Files with missing lines Coverage Δ
include/slang/ast/ASTContext.h 100.00% <100.00%> (ø)
source/ast/builtins/MiscSystemFuncs.cpp 86.79% <100.00%> (+1.22%) ⬆️
source/ast/expressions/AssertionExpr.cpp 90.53% <100.00%> (+0.02%) ⬆️
source/ast/expressions/AssignmentExpressions.cpp 93.17% <100.00%> (+0.09%) ⬆️
source/ast/expressions/CallExpression.cpp 94.00% <100.00%> (+0.41%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fd768f...3d6d565. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finish implementing restrictions on the 'triggered' and 'matched' sequence methods
1 participant