diff options
| author | Jack Koenig | 2020-11-05 15:54:14 -0800 |
|---|---|---|
| committer | GitHub | 2020-11-05 23:54:14 +0000 |
| commit | 8187318e7aef42d541ce307f93d9fc946ed4c38d (patch) | |
| tree | 8cadb914b3ef49c37bfebfb2aad9765167420a62 /src | |
| parent | 679dd54a8e0d65524b782459b64a10e0d91e3a9d (diff) | |
For HasId.setRef, have first set win (with force override) (#1655)
This is a refinement of the assertion added in #1616 then removed in
#1654. Because Records now set the refs of children upon binding,
later, unbound Records could incorrectly override the refs. The first
set should win.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/BundleSpec.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/BundleSpec.scala b/src/test/scala/chiselTests/BundleSpec.scala index df02aa20..5d3f23ec 100644 --- a/src/test/scala/chiselTests/BundleSpec.scala +++ b/src/test/scala/chiselTests/BundleSpec.scala @@ -141,4 +141,17 @@ class BundleSpec extends ChiselFlatSpec with BundleSpecUtils with Utils { } } } + + "Bound Data" should "have priority in setting ref over unbound Data" in { + class MyModule extends RawModule { + val foo = IO(new Bundle { + val x = Output(UInt(8.W)) + }) + foo.x := 0.U // getRef on foo.x is None.get without fix + val bar = new Bundle { + val y = foo.x + } + } + ChiselStage.emitChirrtl(new MyModule) + } } |
