chipsalliance / yosys-f4pga-plugins

Plugins for Yosys developed as part of the F4PGA project.
https://f4pga.org
Apache License 2.0
80 stars 46 forks source link

Currently support for custom-type with range is limited to single range. #467

Closed grotival closed 1 year ago

grotival commented 1 year ago

Currently support for custom-type with range is limited to single range message is emitted from this line in yosys-f4pga-plugins in this minimal repro case:

package repro_pkg;

  parameter int J = 3;
  parameter int K = 2;

  typedef struct packed {
    logic a;
    logic b;
    logic c;
  } my_packed_struct_t;

  typedef union packed {
    my_packed_struct_t [K:0][J:0] my_array;
    my_packed_struct_t [K:0][J:0] my_array2;
  } my_packed_struct_with_array_t;

endpackage : repro_pkg

module repro;
endmodule : repro

Maybe this should be added to the testbench As far as I can tell this case is the closest but it's only for a user-defined type containing an array. The problem is when using an array of a user-defined type.

grotival commented 1 year ago

We appreciated if this could be implemented as this is quite a common case at Google. Chatted with @QuantamHD about this issue who told me maybe you could get this prioritised?

thanks a lot!

QuantamHD commented 1 year ago

@kamilrakoczy is this something you could look at?

kamilrakoczy commented 1 year ago

Sure, I'll look at this.

kamilrakoczy commented 1 year ago

@grotival After https://github.com/chipsalliance/yosys-f4pga-plugins/pull/470 plugin should support multi-range user-defined type inside struct/union. Could you please test if this change works for you?

grotival commented 1 year ago

Will do! thanks!

grotival commented 1 year ago

verified on my side, all good now, thanks a lot!