Files
gps/dependencies/chisel/src/main/scala/chisel3/util/ImplicitConversions.scala
T
2026-07-12 11:01:51 +03:00

18 lines
540 B
Scala

// SPDX-License-Identifier: Apache-2.0
package chisel3.util
import chisel3._
import scala.language.implicitConversions
/** Implicit conversions to automatically convert [[scala.Boolean]] and [[scala.Int]] to [[Bool]]
* and [[UInt]] respectively
*/
object ImplicitConversions {
// The explicit fromIntToLiteral resolves an ambiguous conversion between fromIntToLiteral and
// UInt.asUInt.
implicit def intToUInt(x: Int): UInt = chisel3.fromIntToLiteral(x).asUInt
implicit def booleanToBool(x: Boolean): Bool = x.B
}