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

[circt-verilog] zero parameter at module declaration fails when used #7753

Open
dacsson opened this issue Oct 31, 2024 · 2 comments
Open

[circt-verilog] zero parameter at module declaration fails when used #7753

dacsson opened this issue Oct 31, 2024 · 2 comments
Labels

Comments

@dacsson
Copy link

dacsson commented Oct 31, 2024

I have a mmu.sv module for RISC-V implementation:

module mmu #(
    parameter integer DEVICE_COUNT = 0
) (
...
output logic [31:2] dev_addr[DEVICE_COUNT]
...

that is used in top module like:

mmu #(
        .DEVICE_COUNT(8)
    ) mmu (
...
        .dev_addr(
        '{
            rom_addr,
            ram_addr[0],
            ram_addr[1],
            ram_addr[2],
            ram_addr[3],
            led_addr,
            mtime_addr,
            mtimecmp_addr
        }

...

when trying to compile with circt-verilog mmu.sv i get this error:

core/mmu.sv:17:34: error: value must be positive
    output logic [31:2] dev_addr[DEVICE_COUNT],

is it impossible to compile such module? why so?

@hailongSun2000
Copy link
Member

Hey, @dacsson 😃! Based on the SV IEEE Std 1800-2017, we must pass a single positive number to its dimension when we declare an unpacked array. Please review the following image:
image

@hailongSun2000
Copy link
Member

By the way, slang doesn't handle logic [31:2] dev_addr[0], but handles logic[31:2] dev_addr[0:-1];

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

No branches or pull requests

2 participants