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

Result incorrect when using ~ to invert a single bit variable #22

Open
bread34657 opened this issue Jul 3, 2024 · 0 comments
Open

Result incorrect when using ~ to invert a single bit variable #22

bread34657 opened this issue Jul 3, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bread34657
Copy link

bread34657 commented Jul 3, 2024

Description

When using ~ to invert a single bit of 0, the result should be 1.
When using ~ to invert a single bit of 1, the result should be 0.

Scenario Code

action example {
    activity {
        do invertSingleBit with { val in [0]; };
        do invertSingleBit with { val in [1]; };
    }
}
action invertSingleBit {
    rand bit val;
    bit val_n;
    exec post_solve {
        val_n = ~val;
    }
    exec body ASM = """invertSingleBit: {{val}} -> {{val_n}}""";
}

Expected Output or Behaviour

invertSingleBit: 0 -> 1
invertSingleBit: 1 -> 0

Error Message from PSSGen or JAVA

1,2c1,2
< invertSingleBit: 0 -> -1
< invertSingleBit: 1 -> -2
---
> invertSingleBit: 0 -> 1
> invertSingleBit: 1 -> 0
Test Result: FAIL

Additional Context (Optional)

Please feel free to add any other context about the problem here.

@bread34657 bread34657 added the bug Something isn't working label Jul 3, 2024
@LeeKaiXuan LeeKaiXuan changed the title Invert 1bit error Result incorrect when using ~ to invert a single bit variable Jul 3, 2024
LeeKaiXuan added a commit that referenced this issue Jul 3, 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

2 participants