Skip to content

[ExportVerilog] Unnecessary temporary wire for bitcast between array and integer #2590

Open
@uenoku

Description

@uenoku

input:

hw.module @Foo(%a: i2) -> (r:i1) {
  %0 = hw.bitcast %a : (i2) -> !hw.array<2xi1>
  %false = hw.constant false
  %1 = hw.array_get %0[%false] : !hw.array<2xi1>
  hw.output %1 : i1
}

current output :

module Foo(	// foo.mlir:1:1
  input  [1:0] a,
  output       r);

  wire [1:0] _T = a;	// foo.mlir:2:8
  assign r = _T[1'h0];	// foo.mlir:3:11, :4:7, :5:2
endmodule

This pattern would not be so frequent but we can eliminate _T.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions