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

Constraint is volatile when using if decision on chain constraint of string-type #21

Open
LeeKaiXuan opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@LeeKaiXuan
Copy link
Collaborator

Description

When a string-type variable is constrained by someone (e.g., tf in example) and then the variable will constraint another (e.g., bar in example), the if decision that constraints the string-type variable become incorrect. Thus, the entire constraint block volatiles the user's expectation.

Scenario Code

component pss_top {
    action root_a {
        activity {
            do chainConstraintWithString with { tf in [1]; };
        }
    }

    action chainConstraintWithString {
        rand bit tf;
        rand string foo;
        rand int bar;

        constraint {
            if (tf in [1]) {
                foo in ["foo"];
            } else {
                foo in ["oof"];
            }
            if (foo in ["foo"]) {
                bar in [100];
            } else if (foo in ["oof"]) {
                bar in [200];
            } else {
                bar in [300];
            }
        }
        exec body ASM = """chainConstraintWithString: {{tf}} ; {{foo}} ; {{bar}}""";
    }
}

Expected Output or Behaviour

constraintBySet: 1 ; foo ; 100

Error Message from PSSGen or JAVA

1c1
< chainConstraintWithString: 1 ; oof ; 200
---
> constraintBySet: 1 ; foo ; 100
@LeeKaiXuan LeeKaiXuan added the bug Something isn't working label Jun 13, 2024
@LeeKaiXuan LeeKaiXuan self-assigned this Jun 13, 2024
LeeKaiXuan added a commit that referenced this issue Jun 13, 2024
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

1 participant