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

Casting For-Loop Iterator to Match Address Width in Decoding Logic #92

Open
leolitenstorrent opened this issue Apr 2, 2024 · 0 comments

Comments

@leolitenstorrent
Copy link

Dear PeakRDL Development Team,

    //--------------------------------------------------------------------------
    // Address Decode
    //--------------------------------------------------------------------------
    typedef struct {
        // Code not shown
    } decoded_reg_strb_t;
    // Code not shown

    always_comb begin
        // Code not shown
        for(int i0=0; i0<32; i0++) begin
            decoded_reg_strb.REGISTER_ARRAY[i0] = cpuif_req_masked & (cpuif_addr == 11'hf8 + i0*11'h8);
        end
    end

In the SV code generated above for address decoding, the variable i0 has bitwidth 32 whereas the address has bit width 11 (in this case). This results in the Lint warning of "Unequal length in comparison operator". May the team consider resolving this? For example, i0*11'h8 can be changed to 11'(i0)*11'h8.

Thank you!

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

No branches or pull requests

1 participant