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

[slang-tidy] OnlyAssignedOnReset triggered incorrectly with structs and for loops #1121

Open
Sustrak opened this issue Sep 13, 2024 · 0 comments
Assignees

Comments

@Sustrak
Copy link
Contributor

Sustrak commented Sep 13, 2024

module test;
    struct {
        logic x;
        logic z;
    } k [1:0];
    logic clk_i;
    logic rst_ni;
    logic a, b, c, d;

    always_ff @(posedge clk_i or negedge rst_ni) begin
        if (~rst_ni) begin
            k <= '{default: 0};
        end else begin
            for (int i = 0; i < 2; i++) begin
                if (d) begin
                    k[i].x <= 1'b1;
                    k[i].z <= 1'b1;
                end
            end
        end
    end
endmodule

Even if k is assigned on the else reset clause, the OnlyAssignedOnReset check is triggered.

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

2 participants