blob: 24ea0470b1a8199c3f5adddb5b367c5459af3bbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// See LICENSE for license details.
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.core.fromIntToLiteral(x).asUInt
implicit def booleanToBool(x: Boolean): Bool = x.B
}
|