Skip to content

Commit

Permalink
Apply align.preset = some
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkoenig committed Dec 18, 2024
1 parent 161c5d8 commit 37c9adc
Show file tree
Hide file tree
Showing 112 changed files with 984 additions and 984 deletions.
12 changes: 6 additions & 6 deletions core/src/main/scala/chisel3/AggregateImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private[chisel3] abstract class VecImpl[T <: Data] private[chisel3] (gen: => T,
// We also don't want to warn on literals that are "too small"
p.litOption match {
case Some(idx) if idx < length => return this.apply(idx.intValue)
case _ => // Fall through to control flow below
case _ => // Fall through to control flow below
}

if (length == 0) {
Expand Down Expand Up @@ -395,13 +395,13 @@ private[chisel3] abstract class VecImpl[T <: Data] private[chisel3] (gen: => T,
// Reconstruct the resolvedDirection (in Aggregate.bind), since it's not stored.
// It may not be exactly equal to that value, but the results are the same.
val reconstructedResolvedDirection = direction match {
case ActualDirection.Input => SpecifiedDirection.Input
case ActualDirection.Input => SpecifiedDirection.Input
case ActualDirection.Output => SpecifiedDirection.Output
case ActualDirection.Bidirectional.Default | ActualDirection.Unspecified =>
SpecifiedDirection.Unspecified
case ActualDirection.Bidirectional.Flipped => SpecifiedDirection.Flip
case ActualDirection.Empty => SpecifiedDirection.Unspecified
case dir => throwException(s"Unexpected directionality: $dir")
case ActualDirection.Empty => SpecifiedDirection.Unspecified
case dir => throwException(s"Unexpected directionality: $dir")
}
// TODO port technically isn't directly child of this data structure, but the result of some
// muxes / demuxes. However, this does make access consistent with the top-level bindings.
Expand Down Expand Up @@ -1254,8 +1254,8 @@ abstract class Bundle extends Record {
override def className: String = try {
this.getClass.getSimpleName match {
case name if name.startsWith("$anon$") => "AnonymousBundle" // fallback for anonymous Bundle case
case "" => "AnonymousBundle" // ditto, but on other platforms
case name => name
case "" => "AnonymousBundle" // ditto, but on other platforms
case name => name
}
} catch {
// This happens if you have nested objects which your class is defined in
Expand Down
36 changes: 18 additions & 18 deletions core/src/main/scala/chisel3/BitsImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private[chisel3] trait BitsImpl extends Element { self: Bits =>
protected def _headImpl(n: Int)(implicit sourceInfo: SourceInfo): UInt = {
this.width match {
case KnownWidth(x) => require(x >= n, s"Can't head($n) for width $x < $n")
case UnknownWidth => ()
case UnknownWidth => ()
}
binop(sourceInfo, UInt(Width(n)), HeadOp, n)
}
Expand All @@ -62,7 +62,7 @@ private[chisel3] trait BitsImpl extends Element { self: Bits =>
widthOption match {
case Some(w) if w == 0 => Builder.error(s"Cannot extract from zero-width")
case Some(w) if x >= w => Builder.error(s"High index $x is out of range [0, ${w - 1}]")
case _ =>
case _ =>
}

pushOp(DefPrim(sourceInfo, Bool(), BitsExtractOp, this.ref, ILit(x), ILit(x)))
Expand Down Expand Up @@ -125,7 +125,7 @@ private[chisel3] trait BitsImpl extends Element { self: Bits =>
case Some(w) if w == 0 => Builder.error(s"Cannot extract from zero-width")
case Some(w) if y >= w => Builder.error(s"High and low indices $x and $y are both out of range [0, ${w - 1}]")
case Some(w) if x >= w => Builder.error(s"High index $x is out of range [0, ${w - 1}]")
case _ =>
case _ =>
}
}

Expand Down Expand Up @@ -169,8 +169,8 @@ private[chisel3] trait BitsImpl extends Element { self: Bits =>

protected def _padImpl(that: Int)(implicit sourceInfo: SourceInfo): this.type = this.width match {
case KnownWidth(w) if w >= that => this
case _ if this.isLit => this._padLit(that)
case _ => binop(sourceInfo, cloneTypeWidth(this.width.max(Width(that))), PadOp, that)
case _ if this.isLit => this._padLit(that)
case _ => binop(sourceInfo, cloneTypeWidth(this.width.max(Width(that))), PadOp, that)
}

protected def _impl_unary_~(implicit sourceInfo: SourceInfo): Bits
Expand All @@ -195,7 +195,7 @@ private[chisel3] trait BitsImpl extends Element { self: Bits =>
protected def _asBoolImpl(implicit sourceInfo: SourceInfo): Bool = {
this.width match {
case KnownWidth(1) => this(0)
case _ => throwException(s"can't covert ${this.getClass.getSimpleName}${this.width} to Bool")
case _ => throwException(s"can't covert ${this.getClass.getSimpleName}${this.width} to Bool")
}
}

Expand All @@ -218,7 +218,7 @@ private[chisel3] trait UIntImpl extends BitsImpl with Num[UInt] { self: UInt =>
override def toString: String = {
litOption match {
case Some(value) => s"UInt$width($value)"
case _ => stringAccessor(s"UInt$width")
case _ => stringAccessor(s"UInt$width")
}
}

Expand Down Expand Up @@ -328,18 +328,18 @@ private[chisel3] trait UIntImpl extends BitsImpl with Num[UInt] { self: UInt =>
binop(sourceInfo, UInt(this.width), DynamicShiftRightOp, that)

protected def _rotateLeftImpl(n: Int)(implicit sourceInfo: SourceInfo): UInt = width match {
case _ if (n == 0) => this
case _ if (n == 0) => this
case KnownWidth(w) if (w <= 1) => this
case KnownWidth(w) if n >= w => do_rotateLeft(n % w)
case _ if (n < 0) => do_rotateRight(-n)
case _ => tail(n) ## head(n)
case KnownWidth(w) if n >= w => do_rotateLeft(n % w)
case _ if (n < 0) => do_rotateRight(-n)
case _ => tail(n) ## head(n)
}

protected def _rotateRightImpl(n: Int)(implicit sourceInfo: SourceInfo): UInt = width match {
case _ if (n <= 0) => do_rotateLeft(-n)
case _ if (n <= 0) => do_rotateLeft(-n)
case KnownWidth(w) if (w <= 1) => this
case KnownWidth(w) if n >= w => do_rotateRight(n % w)
case _ => this(n - 1, 0) ## (this >> n)
case KnownWidth(w) if n >= w => do_rotateRight(n % w)
case _ => this(n - 1, 0) ## (this >> n)
}

private def dynamicShift(
Expand All @@ -365,7 +365,7 @@ private[chisel3] trait UIntImpl extends BitsImpl with Num[UInt] { self: UInt =>

protected def _zextImpl(implicit sourceInfo: SourceInfo): SInt = this.litOption match {
case Some(value) => SInt.Lit(value, this.width + 1)
case None => pushOp(DefPrim(sourceInfo, SInt(width + 1), ConvertOp, ref))
case None => pushOp(DefPrim(sourceInfo, SInt(width + 1), ConvertOp, ref))
}

override protected def _asSIntImpl(implicit sourceInfo: SourceInfo): SInt = this.litOption match {
Expand Down Expand Up @@ -399,7 +399,7 @@ private[chisel3] trait SIntImpl extends BitsImpl with Num[SInt] { self: SInt =>
override def toString: String = {
litOption match {
case Some(value) => s"SInt$width($value)"
case _ => stringAccessor(s"SInt$width")
case _ => stringAccessor(s"SInt$width")
}
}

Expand Down Expand Up @@ -595,7 +595,7 @@ private[chisel3] trait BoolImpl extends UIntImpl { self: Bool =>
override def toString: String = {
litToBooleanOption match {
case Some(value) => s"Bool($value)"
case _ => stringAccessor("Bool")
case _ => stringAccessor("Bool")
}
}

Expand All @@ -608,7 +608,7 @@ private[chisel3] trait BoolImpl extends UIntImpl { self: Bool =>
def litToBooleanOption: Option[Boolean] = litOption.map {
case intVal if intVal == 1 => true
case intVal if intVal == 0 => false
case intVal => throwException(s"Boolean with unexpected literal value $intVal")
case intVal => throwException(s"Boolean with unexpected literal value $intVal")
}

/** Convert to a [[scala.Boolean]] */
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/chisel3/ChiselEnumImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private[chisel3] abstract class EnumTypeImpl(private[chisel3] val factory: Chise
case Some(value) =>
factory.nameOfValue(value) match {
case Some(name) => s"${factory.getClass.getSimpleName.init}($value=$name)"
case None => stringAccessor(s"${factory.getClass.getSimpleName.init}($value=(invalid))")
case None => stringAccessor(s"${factory.getClass.getSimpleName.init}($value=(invalid))")
}
case _ => stringAccessor(s"${factory.getClass.getSimpleName.init}")
}
Expand Down Expand Up @@ -162,9 +162,9 @@ private[chisel3] abstract class EnumTypeImpl(private[chisel3] val factory: Chise
}
case b: Record =>
b.elements.collect {
case (name, e: EnumType) if this.typeEquivalent(e) => Seq(Seq(name))
case (name, e: EnumType) if this.typeEquivalent(e) => Seq(Seq(name))
case (name, v: Vec[_]) if this.typeEquivalent(v.sample_element) => Seq(Seq(name))
case (name, b2: Bundle) => enumFields(b2).map(name +: _)
case (name, b2: Bundle) => enumFields(b2).map(name +: _)
}.flatten.toSeq
}

Expand All @@ -178,7 +178,7 @@ private[chisel3] abstract class EnumTypeImpl(private[chisel3] val factory: Chise
case Some(ChildBinding(parent)) =>
outerMostVec(parent) match {
case outer @ Some(_) => outer
case None => currentVecOpt
case None => currentVecOpt
}
case _ => currentVecOpt
}
Expand All @@ -187,7 +187,7 @@ private[chisel3] abstract class EnumTypeImpl(private[chisel3] val factory: Chise
private def annotateEnum(): Unit = {
val anno = outerMostVec() match {
case Some(v) => EnumVecChiselAnnotation(v, enumTypeName, enumFields(v))
case None => EnumComponentChiselAnnotation(this, enumTypeName)
case None => EnumComponentChiselAnnotation(this, enumTypeName)
}

// Enum annotations are added every time a ChiselEnum is bound
Expand Down Expand Up @@ -310,7 +310,7 @@ private[chisel3] trait ChiselEnumImpl { self: ChiselEnum =>
if (n.litOption.isDefined) {
enumInstances.find(_.litValue == n.litValue) match {
case Some(result) => result
case None => throwException(s"${n.litValue} is not a valid value for $enumTypeName")
case None => throwException(s"${n.litValue} is not a valid value for $enumTypeName")
}
} else if (!n.isWidthKnown) {
throwException(s"Non-literal UInts being cast to $enumTypeName must have a defined width")
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/chisel3/ClockImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private[chisel3] trait ClockImpl extends Element {
override def connect(that: Data)(implicit sourceInfo: SourceInfo): Unit =
that match {
case _: Clock | DontCare => super.connect(that)(sourceInfo)
case _ => super.badConnect(that)(sourceInfo)
case _ => super.badConnect(that)(sourceInfo)
}

override def litOption: Option[BigInt] = None
Expand Down
Loading

0 comments on commit 37c9adc

Please sign in to comment.