Skip to content

Commit

Permalink
Prototype getRef with layers
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jan 18, 2025
1 parent fe1126c commit a4a944b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 5 additions & 3 deletions circtlib/src/firrtl/capi/CAPIDefinition.scala
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,12 @@ trait TypeApi:
using arena: Arena
): Int
inline def isRef: Boolean
inline def toRef(
forceable: Boolean
inline def getRef(
forceable: Boolean,
layer: Seq[String]
)(
using arena: Arena
using arena: Arena,
context: Context
): Type
inline def isAnyRef: Boolean
inline def isInteger: Boolean
Expand Down
13 changes: 9 additions & 4 deletions circtlib/src/firrtl/capi/CAPIImplementation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,16 @@ given TypeApi with
): Int =
firrtlTypeGetBundleFieldIndex(tpe.segment, fieldName.toStringRef.segment)
inline def isRef: Boolean = firrtlTypeIsARef(tpe.segment)
inline def toRef(
forceable: Boolean
inline def getRef(
forceable: Boolean,
layer: Seq[String]
)(
using arena: Arena
): Type = Type(firrtlTypeGetRef(arena, tpe.segment, forceable))
using arena: Arena,
context: Context
): Type =
// wait for [[https://github.com/llvm/circt/pull/8093]]
// Type(firrtlTypeGetRef(arena, tpe.segment, forceable, layer.reverse.last.symbolRefAttrGet(layer.drop(1).map(_.flatSymbolRefAttrGet)).segment))
Type(firrtlTypeGetRef(arena, tpe.segment, forceable))
inline def isAnyRef: Boolean = firrtlTypeIsAAnyRef(tpe.segment)
inline def isInteger: Boolean = firrtlTypeIsAInteger(tpe.segment)
inline def isDouble: Boolean = firrtlTypeIsADouble(tpe.segment)
Expand Down

0 comments on commit a4a944b

Please sign in to comment.