summaryrefslogtreecommitdiff
path: root/src/main/scala/Chisel/package.scala
blob: 61fb69041c0550db9a425c05356ede5ed8b7e842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package object Chisel {
  import internal.firrtl.Width
  implicit class fromBigIntToLiteral(val x: BigInt) extends AnyVal {
    def U: UInt = UInt(x, Width())
    def S: SInt = SInt(x, Width())
  }
  implicit class fromIntToLiteral(val x: Int) extends AnyVal {
    def U: UInt = UInt(BigInt(x), Width())
    def S: SInt = SInt(BigInt(x), Width())
  }
  implicit class fromStringToLiteral(val x: String) extends AnyVal {
    def U: UInt = UInt(x)
  }
  implicit class fromBooleanToLiteral(val x: Boolean) extends AnyVal {
    def B: Bool = Bool(x)
  }
}