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

var declaration with same name as enum member #682

Open
nananapo opened this issue Apr 20, 2024 · 0 comments
Open

var declaration with same name as enum member #682

nananapo opened this issue Apr 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nananapo
Copy link
Contributor

module ModuleA () {
    enum EnumName: logic {
        MemberName,
    }
    var EnumName_MemberName: logic;
    always_comb {
        EnumName_MemberName = 0;
    }
}

This Veryl code is translated into

module project_ModuleA ();
    typedef enum logic {
        EnumName_MemberName
    } EnumName;
    logic EnumName_MemberName;
    always_comb begin
        EnumName_MemberName = 0;
    end
endmodule

The member of EnumName is instantiated as EnumName_MemberName.
This may be ambiguous when there are var declarations with same name.

I don't know this is legal in SystemVerilog, but verilator, iverilog and GOWIN EDA don't support it. So I think prohibiting same name declaration as enum member or emitting another name is good.

@dalance dalance added the bug Something isn't working label Apr 21, 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