blob: 99d567adfaaec121df9923aa7295e437c744dbfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// 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
}
|