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

Global const symbols not resolved within action/parser bodies #31

Open
FelixMcFelix opened this issue Sep 1, 2023 · 0 comments
Open

Comments

@FelixMcFelix
Copy link

const symbols defined in the global scope do not seem to be usable for reads/writes within parser bodies or actions, as below:

const bit<16> GENEVE_OPT_CLASS_OXIDE = 16w0x0129;

control x (
    /* ... */
) {
    action y (
        inout headers_t hdr,
        /* ... */
    ) {
        hdr.ox_external_tag.class = GENEVE_OPT_CLASS_OXIDE;
    }

    /* ... */
}

This produces the following error message:

error: could not resolve lvalue: GENEVE_OPT_CLASS_OXIDE
    GENEVE_OPT_CLASS_OXIDE not found
[361:37] sidecar-lite.p4

          hdr.ox_external_tag.class = GENEVE_OPT_CLASS_OXIDE;
                                      ^^^^^^^^^^^^^^^^^^^^^^

From my testing, this also applies to use of constants within expressions in parser states.

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

No branches or pull requests

1 participant