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

&convert on bitfield seems to be broken #1484

Closed
Tracked by #1481
bbannier opened this issue Jul 6, 2023 · 1 comment
Closed
Tracked by #1481

&convert on bitfield seems to be broken #1484

bbannier opened this issue Jul 6, 2023 · 1 comment
Assignees
Labels
Bug Something isn't working Type: Bug 🐛

Comments

@bbannier
Copy link
Member

bbannier commented Jul 6, 2023

The following code does not compile; I would have expected the &convert to have the effect of extracting the element value.

module foo;

public type X = unit {
    x: bitfield(8) {
        a: 0..4;
    } &convert=$$.a;
};
$ printf '\x00' | spicy-dump -d foo.spicy
[error] foo.spicy:3:17-7:2: cannot coerce expression '(__bits)' of type 'tuple<uint<8>>' to type 'bitfield
(8) {
    a: 0..4; }'
[error] foo.spicy:3:17-7:2: cannot coerce expression '__parsed_x' of type 'bitfield(8) {
    a: 0..4; }' to type 'tuple<a: uint<8>>'
[error] spicy-dump: aborting after errors
@bbannier bbannier added Bug Something isn't working Type: Bug 🐛 labels Jul 6, 2023
@bbannier bbannier mentioned this issue Jul 6, 2023
9 tasks
@rsmmr
Copy link
Member

rsmmr commented Aug 3, 2023

I believe this will come with #1032.

@rsmmr rsmmr self-assigned this Aug 3, 2023
rsmmr added a commit that referenced this issue Aug 4, 2023
Closes #1032. Using a typedef with bitfields works now.
Closes #1484. `&convert` can now refer to individual bitfields.

TODOs:
    - Like on the HILTI side, no support for &convert and bit order
      yet.
rsmmr added a commit that referenced this issue Aug 7, 2023
Closes #1032. Using a typedef with bitfields works now.
Closes #1484. `&convert` can now refer to individual bitfields.

TODOs:
    - No support for bit order yet.
    - Couple of test failures due to incorrectly failing type comparision.
rsmmr added a commit that referenced this issue Aug 9, 2023
Closes #1032. Using a typedef with bitfields works now.
Closes #1484. `&convert` can now refer to individual bitfields.
rsmmr added a commit that referenced this issue Aug 11, 2023
Closes #1032. Using a typedef with bitfields works now.
Closes #1484. `&convert` can now refer to individual bitfields.
@rsmmr rsmmr closed this as completed in e55296b Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Type: Bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants