chipsalliance / chipsalliance/chisel

Bad error message when calling `.pad` on a `Bool`

Open
#3,365 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

**Type of issue**: Bug Report

**Please provide the steps to reproduce the problem:**

Run the following
```scala
class Example extends Module {
val in = IO(Input(Bool()))
val out = IO(Output(UInt(2.W)))

out := in.pad(2)
}
```
(Scastie: https://scastie.scala-lang.org/fcMAECXOQGiEClwr1May7w)

**What is the current behavior?**

You will see a requirement failed with no additional context
```
java.lang.IllegalArgumentException: requirement failed
at ... ()
at Playground$Example$$anonfun$3.apply(main.scala:10)
at Playground$Example$$anonfun$3.apply(main.scala:10)
at chisel3.Data.$anonfun$$colon$eq$1(Data.scala:749)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at chisel3.experimental.prefix$.apply(prefix.scala:33)
at chisel3.Data.$colon$eq(Data.scala:749)
at Playground$Example.<init>(main.scala:10)
at Playground$$anonfun$4.apply(main.scala:13)
at Playground$$anonfun$4.apply(main.scala:13)
at ... ()
at ... (Stack trace trimmed to user code only. Rerun with --full-stacktrace to see the full trace)
```

**What is the expected behavior?**

It should pad the `Bool` to a be a normal UInt

**Please tell us about your environment:**

Chisel 6.0.0-M1 but this is present on head of main too

**Other Information**

**What is the use case for changing the behavior?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.