diff options
| author | Jiuyang Liu | 2021-05-26 02:35:34 +0800 |
|---|---|---|
| committer | GitHub | 2021-05-25 18:35:34 +0000 |
| commit | 6ccff4848fcf55cb1e865738a67f2bec25988ac8 (patch) | |
| tree | 9d3d4a04bc7723834ffe60b515af5254b43e4524 /src/main/scala/chisel3 | |
| parent | 3e65fb78769c8e4f7b737b021c6bbb52d1d7b7af (diff) | |
throw exception if BitPat width is 0 (#1920)
* spot a bug when BitPat width is 0
* fix #1919
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/scala/chisel3')
| -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 88e46e3c..985d22da 100644 --- a/src/main/scala/chisel3/util/BitPat.scala +++ b/src/main/scala/chisel3/util/BitPat.scala @@ -23,6 +23,7 @@ object BitPat { // If ? parsing is to be exposed, the return API needs further scrutiny // (especially with things like mask polarity). require(x.head == 'b', "BitPats must be in binary and be prefixed with 'b'") + require(x.length > 1, "BitPat width cannot be 0.") var bits = BigInt(0) var mask = BigInt(0) var count = 0 |
