diff options
| author | Richard Lin | 2018-02-28 17:31:43 -0800 |
|---|---|---|
| committer | Jack Koenig | 2018-02-28 17:31:43 -0800 |
| commit | 97871178cb511063965f971b768f91c289c4776f (patch) | |
| tree | a8cd0f480772b0f9d010aaceb472baefa649c66a /src | |
| parent | 3ff19716174e9abee20726096ecf7fb4d252ce63 (diff) | |
Auto Clone Bundles in Companion Objects (#788)
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/AutoClonetypeSpec.scala | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/AutoClonetypeSpec.scala b/src/test/scala/chiselTests/AutoClonetypeSpec.scala index 0b02c3ab..59ce98b7 100644 --- a/src/test/scala/chiselTests/AutoClonetypeSpec.scala +++ b/src/test/scala/chiselTests/AutoClonetypeSpec.scala @@ -47,6 +47,15 @@ class ModuleWithInner extends Module { require(myWire.i == 14) } +object CompanionObjectWithBundle { + class ParameterizedInner(val i: Int) extends Bundle { + val data = UInt(i.W) + } + class Inner extends Bundle { + val data = UInt(8.W) + } +} + // A Bundle with an argument that is also a field. // Not necessarily good style (and not necessarily recommended), but allowed to preserve compatibility. class BundleWithArgumentField(val x: Data, val y: Data) extends Bundle @@ -123,4 +132,18 @@ class AutoClonetypeSpec extends ChiselFlatSpec { io.y := 1.U } } } + + "Bundles inside companion objects" should "not need clonetype" in { + elaborate { new Module { + val io = IO(Output(new CompanionObjectWithBundle.Inner)) + io.data := 1.U + } } + } + + "Parameterized bundles inside companion objects" should "not need clonetype" in { + elaborate { new Module { + val io = IO(Output(new CompanionObjectWithBundle.ParameterizedInner(8))) + io.data := 1.U + } } + } } |
