diff options
| author | Jiuyang Liu | 2021-12-09 10:25:11 +0800 |
|---|---|---|
| committer | GitHub | 2021-12-09 02:25:11 +0000 |
| commit | 849d4a0b7f6f7ea056c5280b9d319dadf5225022 (patch) | |
| tree | 631c2271af185fdacc0cbe22d907afe25c12959d /src/main/scala/chisel3/util | |
| parent | 2e2c7c0857bf9f7d0bde75e22f01b5f092d6e33c (diff) | |
catch None.get in BitPat.apply(x: UInt): BitPat (#2276)
Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'src/main/scala/chisel3/util')
| -rw-r--r-- | src/main/scala/chisel3/util/BitPat.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala index d607be4f..4b94879f 100644 --- a/src/main/scala/chisel3/util/BitPat.scala +++ b/src/main/scala/chisel3/util/BitPat.scala @@ -89,6 +89,7 @@ object BitPat { * @note the UInt must be a literal */ def apply(x: UInt): BitPat = { + require(x.isLit, s"$x is not a literal, BitPat.apply(x: UInt) only accepts literals") val len = if (x.isWidthKnown) x.getWidth else 0 apply("b" + x.litValue.toString(2).reverse.padTo(len, "0").reverse.mkString) } |
