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

[LowerToHW] Use type decl for Bundle type lowering #2329

Open
uenoku opened this issue Dec 12, 2021 · 0 comments
Open

[LowerToHW] Use type decl for Bundle type lowering #2329

uenoku opened this issue Dec 12, 2021 · 0 comments
Labels
enhancement New feature or request ExportVerilog

Comments

@uenoku
Copy link
Member

uenoku commented Dec 12, 2021

If there are large structs in ports, we might get long lines. For example(from FPU.fir),

; circt-opt %s -export-verilog
hw.module @Long(%clock: i1, %io_cp_req_bits: !hw.struct<cmd: i5, ldst: i1, wen: i1, ren1: i1, ren2: i1, ren3: i1, 
                               swap12: i1, swap23: i1, single: i1, fromint: i1, toint: i1, fastpipe: i1, fma: i1, div: i1, sqrt: i1, 
                               wflags: i1, rm: i3, typ: i2, in1: i65, in2: i65, in3: i65>)  {
}

will generate

module Long(     // foo.mlir:1:1
  input                                                                                                                                                                                                                                                                                                                           clock,
  input struct packed {logic [4:0] cmd; logic ldst; logic wen; logic ren1; logic ren2; logic ren3; logic swap12; logic swap23; logic single; logic fromint; logic toint; logic fastpipe; logic fma; logic div; logic sqrt; logic wflags; logic [2:0] rm; logic [1:0] typ; logic [64:0] in1; logic [64:0] in2; logic [64:0] in3; } io_cp_req_bits);

endmodule

This looks not good so we may consider to use type decl at module scope.

@uenoku uenoku added ExportVerilog enhancement New feature or request labels Dec 12, 2021
@uenoku uenoku changed the title [ExportVerilog] Long line emission of large struct [LowerToHW] Use type decl for Bundle type lowering Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ExportVerilog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant