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

Presence of logical action is not reset in C target #2300

Closed
a-sr opened this issue May 30, 2024 · 2 comments
Closed

Presence of logical action is not reset in C target #2300

a-sr opened this issue May 30, 2024 · 2 comments
Assignees
Labels
bug Something isn't working c Related to C target
Milestone

Comments

@a-sr
Copy link
Collaborator

a-sr commented May 30, 2024

After being present once the is_present always returns true even if the logical action did not trigger.

Example:

target C {
    timeout: 7 msecs,
    fast: true
}

main reactor {
    logical action a;
    logical action b;
        
    reaction(startup) -> a {=
        lf_schedule(a, MSEC(1));
    =}

    reaction(a, b) -> a, b {=
        if (a->is_present) {
            printf("A");
            lf_schedule(b, MSEC(2));
        }
        if (b->is_present) {
            printf("B");
            lf_schedule(a, MSEC(1));
        }
        printf(" at %d msecs with triggers (%d,%d)\n", lf_time_logical_elapsed() / MSEC(1), a->is_present, b->is_present);
    =}
}

Output (VS Code v0.7.3):

A at 1 msecs with triggers (1,0)
AB at 3 msecs with triggers (1,1)
AB at 4 msecs with triggers (1,1)
AB at 5 msecs with triggers (1,1)
AB at 6 msecs with triggers (1,1)
AB at 7 msecs with triggers (1,1)

Expected behavior:
A and B should alternate with different offsets.

@a-sr a-sr added bug Something isn't working c Related to C target labels May 30, 2024
@cmnrd
Copy link
Collaborator

cmnrd commented May 30, 2024

This is a duplicate of #2291

@lhstrh
Copy link
Member

lhstrh commented Sep 29, 2024

Fixed via #2409.

@lhstrh lhstrh closed this as completed Sep 29, 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 c Related to C target
Projects
None yet
Development

No branches or pull requests

5 participants