Skip to content

Can't refer struct member from always_comb block #2009

@taichi-ishitani

Description

@taichi-ishitani

Veryl reports unknown_member error for the code below.

proto package foo_proto_pkg {
    const WIDTH: u32;
    struct foo_struct {
      foo: logic<WIDTH>,
    }
}
package foo_pkg::<W: u32> for foo_proto_pkg {
    const WIDTH: u32 = W;
    struct foo_struct {
      foo: logic<WIDTH>,
    }
}
interface foo_if::<PKG: foo_proto_pkg> {
    var foo: PKG::foo_struct;
    modport mp {
        foo: input,
    }
}
module foo_module::<PKG: foo_proto_pkg> {
    inst foo: foo_if::<PKG>;

    var _foo: logic;
    always_comb {
        _foo = foo.foo.foo;
    }
}
�]8;;https://doc.veryl-lang.org/book/07_appendix/02_semantic_error.html#unknown_member�\unknown_member (link)�]8;;�\

  💥 "PKG" doesn't have member "foo_struct"
    ╭─[:24:16]
 23 │     always_comb {
 24 │         _foo = foo.foo.foo;
    ·                ─────┬─────
    ·                     ╰── Error location
 25 │     }
    ╰────
  help: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions