summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/util
diff options
context:
space:
mode:
authorSchuyler Eldridge2020-10-19 12:35:26 -0400
committerGitHub2020-10-19 16:35:26 +0000
commitac641fb183e3a8866e6bd72123801cfb04a0c893 (patch)
tree8a0839df9a42c47b7618ffcf944b989cd0dcc574 /src/test/scala/chiselTests/util
parentbaea2da820e9ebff5ba1b6ad9573a7cc33aaacbd (diff)
Enable Cat of Zero Element Vec (#1623)
* Return 0.U for asUInt of a zero-element Seq Add a condition to SeqUtils.asUInt to have it return an unspecified width 0.U when applied to an empty sequence. This enables the ability to do a Cat of a zero-element sequence. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com> * Test elaboration of Cat on zero-element Seq Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Diffstat (limited to 'src/test/scala/chiselTests/util')
-rw-r--r--src/test/scala/chiselTests/util/CatSpec.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/util/CatSpec.scala b/src/test/scala/chiselTests/util/CatSpec.scala
new file mode 100644
index 00000000..2e52fe63
--- /dev/null
+++ b/src/test/scala/chiselTests/util/CatSpec.scala
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0
+
+package chiselTests.util
+
+import chisel3._
+import chisel3.stage.ChiselStage
+import chisel3.util.Cat
+
+import chiselTests.ChiselFlatSpec
+
+object CatSpec {
+
+ class JackIsATypeSystemGod extends MultiIOModule {
+ val in = IO(Input (Vec(0, UInt(8.W))))
+ val out = IO(Output(UInt(8.W)))
+
+ out := Cat(in)
+ }
+
+}
+
+class CatSpec extends ChiselFlatSpec {
+
+ import CatSpec._
+
+ behavior of "util.Cat"
+
+ it should "not fail to elaborate a zero-element Vec" in {
+
+ ChiselStage.elaborate(new JackIsATypeSystemGod)
+
+ }
+
+}