Skip to content

[OM] Shift left folder doesnt sign extend #9602

@rwy7

Description

@rwy7

The shift-left folder will do modular shift left, respecting the size of the underlying ap-int, but since we're working with big integers, I'd expect it to grow instead.

Demo of the issue, 4 << 4 ==> 0

firrtl.circuit "Casts" {
  firrtl.module @Casts() {}
  firrtl.class @PropertyArithmetic(out %o1: !firrtl.integer) {
    %0 = firrtl.integer 4
    %1 = firrtl.integer.shl %0, %0 : (!firrtl.integer, !firrtl.integer) -> !firrtl.integer
    firrtl.propassign %o1, %1 : !firrtl.integer
  }
}

// ./bin/circt-opt -canonicalize='top-down=true region-simplify=aggressive' ../scratch/scratch.mlir  --mlir-print-ir-before-all
module {
  firrtl.circuit "Casts" {
    firrtl.module @Casts() {
    }
    firrtl.class @PropertyArithmetic(out %o1: !firrtl.integer) {
      %0 = firrtl.integer 0
      firrtl.propassign %o1, %0 : !firrtl.integer
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FIRRTLInvolving the `firrtl` dialectOMObject Model

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions