From 28e1a244bcc75a1138d25f5aa43ef22e23ef3ed7 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Mon, 22 Jun 2020 12:32:36 -0700 Subject: Canonicalize construction of Decoupled with no payload (#785) * Canonicalize construction of empty Decoupled * Change signature after dev meeting discussion * Make EmptyBundle private and final * Add test case for Decoupled with no payload * Apply suggestions from code review Co-authored-by: Richard Lin Co-authored-by: Albert Magyar Co-authored-by: Schuyler Eldridge Co-authored-by: Adam Izraelevitz Co-authored-by: Richard Lin Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>--- src/test/scala/chiselTests/DecoupledSpec.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/scala/chiselTests/DecoupledSpec.scala (limited to 'src/test') diff --git a/src/test/scala/chiselTests/DecoupledSpec.scala b/src/test/scala/chiselTests/DecoupledSpec.scala new file mode 100644 index 00000000..c251df82 --- /dev/null +++ b/src/test/scala/chiselTests/DecoupledSpec.scala @@ -0,0 +1,19 @@ +// See LICENSE for license details. + +package chiselTests + +import chisel3._ +import chisel3.util.Decoupled + +class DecoupledSpec extends ChiselFlatSpec { + "Decoupled() and Decoupled.empty" should "give DecoupledIO with empty payloads" in { + elaborate(new Module { + val io = IO(new Bundle { + val in = Flipped(Decoupled()) + val out = Decoupled.empty + }) + io.out <> io.in + assert(io.asUInt.widthOption.get === 4) + }) + } +} -- cgit v1.2.3