Skip to content

Commit 4f50865

Browse files
[scala3] Add missing implies for BitsIntf (#5055)
1 parent aea576a commit 4f50865

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

core/src/main/scala-2/chisel3/BitsIntf.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,5 +900,5 @@ private[chisel3] trait BoolIntf extends ToBoolable { self: Bool =>
900900
def implies(that: Bool): Bool = macro SourceInfoTransform.thatArg
901901

902902
/** @group SourceInfoTransformMacro */
903-
def do_implies(that: Bool)(implicit sourceInfo: SourceInfo): Bool = (!this) | that
903+
def do_implies(that: Bool)(implicit sourceInfo: SourceInfo): Bool = _impl_implies(that)
904904
}

core/src/main/scala-3/chisel3/BitsIntf.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,4 +597,11 @@ private[chisel3] trait BoolIntf extends ToBoolable { self: Bool =>
597597
def asClock(using SourceInfo): Clock = _asClockImpl
598598

599599
def asAsyncReset(using SourceInfo): AsyncReset = _asAsyncResetImpl
600+
601+
/** Logical implication
602+
*
603+
* @param that a boolean signal
604+
* @return [[!this || that]]
605+
*/
606+
def implies(that: Bool)(using SourceInfo): Bool = _impl_implies(that)
600607
}

core/src/main/scala/chisel3/Bits.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ sealed class Bool() extends UInt(1.W) with BoolIntf with Reset {
691691
protected def _asAsyncResetImpl(implicit sourceInfo: SourceInfo): AsyncReset =
692692
pushOp(DefPrim(sourceInfo, AsyncReset(), AsAsyncResetOp, ref))
693693

694+
protected def _impl_implies(that: Bool)(implicit sourceInfo: SourceInfo): Bool = (!this) | that
695+
694696
override protected def _fromUInt(that: UInt)(implicit sourceInfo: SourceInfo): this.type = {
695697
_resizeToWidth(that, this.widthOption, true)(identity).asBool.asInstanceOf[this.type]
696698
}

0 commit comments

Comments
 (0)