Skip to content

Commit a4a944b

Browse files
committed
Prototype getRef with layers
wait for llvm/circt#8093
1 parent fe1126c commit a4a944b

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

circtlib/src/firrtl/capi/CAPIDefinition.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,12 @@ trait TypeApi:
642642
using arena: Arena
643643
): Int
644644
inline def isRef: Boolean
645-
inline def toRef(
646-
forceable: Boolean
645+
inline def getRef(
646+
forceable: Boolean,
647+
layer: Seq[String]
647648
)(
648-
using arena: Arena
649+
using arena: Arena,
650+
context: Context
649651
): Type
650652
inline def isAnyRef: Boolean
651653
inline def isInteger: Boolean

circtlib/src/firrtl/capi/CAPIImplementation.scala

+9-4
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,16 @@ given TypeApi with
438438
): Int =
439439
firrtlTypeGetBundleFieldIndex(tpe.segment, fieldName.toStringRef.segment)
440440
inline def isRef: Boolean = firrtlTypeIsARef(tpe.segment)
441-
inline def toRef(
442-
forceable: Boolean
441+
inline def getRef(
442+
forceable: Boolean,
443+
layer: Seq[String]
443444
)(
444-
using arena: Arena
445-
): Type = Type(firrtlTypeGetRef(arena, tpe.segment, forceable))
445+
using arena: Arena,
446+
context: Context
447+
): Type =
448+
// wait for [[https://github.com/llvm/circt/pull/8093]]
449+
// Type(firrtlTypeGetRef(arena, tpe.segment, forceable, layer.reverse.last.symbolRefAttrGet(layer.drop(1).map(_.flatSymbolRefAttrGet)).segment))
450+
Type(firrtlTypeGetRef(arena, tpe.segment, forceable))
446451
inline def isAnyRef: Boolean = firrtlTypeIsAAnyRef(tpe.segment)
447452
inline def isInteger: Boolean = firrtlTypeIsAInteger(tpe.segment)
448453
inline def isDouble: Boolean = firrtlTypeIsADouble(tpe.segment)

0 commit comments

Comments
 (0)