Skip to content

Commit

Permalink
[binder] Update API FIRRTLDirection for CIRCT 1.60.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO authored and seldridge committed Nov 16, 2023
1 parent b7e53f0 commit 28caf3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions binder/includeConstants.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# enum FIRRTLPortDirection
FIRRTL_PORT_DIR_INPUT
FIRRTL_PORT_DIR_OUTPUT
# enum FIRRTLDirection
FIRRTL_DIRECTION_IN
FIRRTL_DIRECTION_OUT
# enum FIRRTLConvention
FIRRTL_CONVENTION_INTERNAL
FIRRTL_CONVENTION_SCALARIZED
Expand Down
10 changes: 5 additions & 5 deletions binder/src/main/scala/PanamaCIRCT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class PanamaCIRCT {
MlirType(CAPI.firrtlTypeGetBundle(arena, mlirCtx, fields.length, buffer))
}

def firrtlAttrGetPortDirs(dirs: Seq[FIRRTLPortDir]): MlirAttribute = {
def firrtlAttrGetPortDirs(dirs: Seq[FIRRTLDirection]): MlirAttribute = {
val (ptr, length) = seqToArray(dirs)
MlirAttribute(CAPI.firrtlAttrGetPortDirs(arena, mlirCtx, length, ptr))
}
Expand Down Expand Up @@ -657,13 +657,13 @@ object FIRRTLNameKind {
final case object InterestingName extends FIRRTLNameKind(value = CAPI.FIRRTL_NAME_KIND_INTERESTING_NAME())
}

sealed abstract class FIRRTLPortDir(val value: Int) extends ForeignType[Int] {
sealed abstract class FIRRTLDirection(val value: Int) extends ForeignType[Int] {
private[circt] def get = value
private[circt] val sizeof = 4 // FIXME: jextract doesn't export type for C enum
}
object FIRRTLPortDir {
final case object Input extends FIRRTLPortDir(value = CAPI.FIRRTL_PORT_DIR_INPUT())
final case object Output extends FIRRTLPortDir(value = CAPI.FIRRTL_PORT_DIR_OUTPUT())
object FIRRTLDirection {
final case object In extends FIRRTLDirection(value = CAPI.FIRRTL_DIRECTION_IN())
final case object Out extends FIRRTLDirection(value = CAPI.FIRRTL_DIRECTION_OUT())
}

sealed abstract class firrtlAttrGetRUW(val value: Int) extends ForeignType[Int] {
Expand Down
6 changes: 3 additions & 3 deletions binder/src/main/scala/PanamaCIRCTConverter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ case class Op(state: MlirOperationState, op: MlirOperation, regions: Seq[Region]

case class Ports(
types: Seq[MlirType],
dirs: Seq[FIRRTLPortDir],
dirs: Seq[FIRRTLDirection],
locs: Seq[MlirLocation],
names: Seq[String],
nameAttrs: Seq[MlirAttribute],
Expand Down Expand Up @@ -199,8 +199,8 @@ class PanamaCIRCTConverter extends CIRCTConverter {
Ports(
types = types,
dirs = irs.map(_.direction match {
case fir.Input => FIRRTLPortDir.Input
case fir.Output => FIRRTLPortDir.Output
case fir.Input => FIRRTLDirection.In
case fir.Output => FIRRTLDirection.Out
}),
locs = locs,
names = irs.map(_.name),
Expand Down

0 comments on commit 28caf3a

Please sign in to comment.