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

relationship lookahead #16

Open
XunChangqing opened this issue Jan 27, 2024 · 1 comment
Open

relationship lookahead #16

XunChangqing opened this issue Jan 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@XunChangqing
Copy link

XunChangqing commented Jan 27, 2024

Description

In PSSActionModel.java, the action only collects its own constraints and the constraints of its sub-actions when it executes, is there any problem if the constraints of the containing action are not taken into account at this time? For example, in the following code scenario.
If the execution of a and b only considers its own constraints, then will the entry's a.x > b.y constraint not be satisfied?
For example, a.x = 0 causes b.x to have no legal value.

在 PSSActionModel.java,action 执行时只收集了自身以及子action的约束,此时如果不考虑父亲action的约束会不会有问题呢?例如一下代码情况,
如果执行a和b时,只考虑自身约束,那么entry的 a.x > b.y 约束会不会无法满足呢?
比如 a.x = 0,会导致 b.x 没有合法值。

Scenario Code

componenent pss_top {
    action sub_a {
        rand bit x;
    }

    action sub_b {
        rand bit y;
    }

    aciton entry {
        sub_a a;
        sub_b b;

        constraint {
            a.x > b.y;
        }

        activity {
            a;
            b;
        }
    }
}
@XunChangqing XunChangqing added the bug Something isn't working label Jan 27, 2024
@LeeKaiXuan
Copy link
Collaborator

In current version (v2.3.0), as you said, the action only gets its constraint when it is executed, thus any constraint declared from its parents can't be covered (except in-line constraint).
Also, any sub-action attribute can't be accessed when the action handle is uninitialized. Therefore, a.x > b.y will be failed traversal and an error message shall be shown (PSS-ERROR: [PSSMemberPathElemExpression] a.x is not defined.).

Tip

Suppose you want the same behaviours as your example (i.e., do 2 actions with the first action's value greater than seconds.). We suggest you solve both values first, then assign them by in-line constraint.

Solution

component pss_top {
    action sub_a {
        rand bit [2] x;
        exec body ASM = """sub_a.x = {{x}}""";
    }

    action sub_b {
        rand bit [2] y;
        exec body ASM = """sub_b.y = {{y}}""";
    }

    action root_a {
        rand bit [2] x, y;
        constraint {
            x < y
        }
        activity {
            do sub_a with { x == this.x; };
            do sub_b with { y == this.y; };
        }
    }
}

Expected Output

sub_a.x = 1
sub_b.y = 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants