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

[Question] How to use case statement with don't care? #641

Open
nananapo opened this issue Apr 10, 2024 · 5 comments
Open

[Question] How to use case statement with don't care? #641

nananapo opened this issue Apr 10, 2024 · 5 comments
Labels
lang Language design

Comments

@nananapo
Copy link
Contributor

Hi.
Is the case statement with don't care like casez or casex supported?
I want to use it to implement a decoder.

@taichi-ishitani
Copy link
Contributor

Veryl has not yet supported these statement.

@dalance
SystemVerilog has case inside statement that is enhanced version of casex statement.
So I think Veryl should support case inside but has not to support casex and casez statements.

@nananapo
Copy link
Contributor Author

By the way, case expression seems to be converted into logic using ternary operator ?. But I think converting into case statement is better.

@dalance dalance added the lang Language design label Apr 11, 2024
@dalance
Copy link
Collaborator

dalance commented Apr 12, 2024

By the way, case expression seems to be converted into logic using ternary operator ?. But I think converting into case statement is better.

The reason using ternary operator is that it can be used at arbitrary expression context like below:

// pass
localparam A = X == 1 ? 0 : 1;

// fail
localparam A = case (X)
    1: 0;
    default: 1;
endcase

@nananapo
Copy link
Contributor Author

I think it would be nice if the semantics of case expression and statement are not different.

@taichi-ishitani
Copy link
Contributor

SystemVerilog does not have if expression and case expression features so I think it's difficult.

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

No branches or pull requests

3 participants