diff options
| author | mergify[bot] | 2022-08-29 21:05:56 +0000 |
|---|---|---|
| committer | GitHub | 2022-08-29 21:05:56 +0000 |
| commit | 9f1484572e2e4185e87a9cfb03b253870636c12c (patch) | |
| tree | cc77f59b2a73082f412db7944c25c71ed54e8393 /src/test/scala/chiselTests | |
| parent | df5a95454ff0414d1d3ce16d06dbe27b152e3751 (diff) | |
Fix OpaqueSlot handling of contextual names (#2708) (#2712)
We need to ensure that contextual names stay contextual (ie. sensitive
to the module context which is important for naming ports).
(cherry picked from commit cee255216c4a1bb658a2d8ddc03d966ce7ffb877)
Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'src/test/scala/chiselTests')
| -rw-r--r-- | src/test/scala/chiselTests/RecordSpec.scala | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/test/scala/chiselTests/RecordSpec.scala b/src/test/scala/chiselTests/RecordSpec.scala index 5080f15f..cde18da7 100644 --- a/src/test/scala/chiselTests/RecordSpec.scala +++ b/src/test/scala/chiselTests/RecordSpec.scala @@ -150,15 +150,17 @@ trait RecordSpecUtils { val in = IO(Input(new InnerRecord)) val out = IO(Output(new InnerRecord)) val inst = Module(new InnerModule) - inst.foo := in - out := inst.bar + inst.io.foo := in + out := inst.io.bar } class InnerModule extends Module { - val foo = IO(Input(new InnerRecord)) - val bar = IO(Output(new InnerRecord)) + val io = IO(new Bundle { + val foo = Input(new InnerRecord) + val bar = Output(new InnerRecord) + }) // DO NOT do this; just for testing element connections - bar.elements.head._2 := foo.elements.head._2 + io.bar.elements.head._2 := io.foo.elements.head._2 } class NamedSingleElementRecord extends Record { @@ -238,25 +240,24 @@ class RecordSpec extends ChiselFlatSpec with RecordSpecUtils with Utils { var mod: NestedRecordModule = null ChiselStage.elaborate { mod = new NestedRecordModule; mod } val testStrings = Seq( - mod.in.toTarget.toString(), - mod.in.k.toTarget.toString(), - mod.in.k.k.toTarget.toString(), - mod.in.elements.head._2.toTarget.toString(), - mod.in.k.elements.head._2.toTarget.toString(), - mod.in.k.k.elements.head._2.toTarget.toString() + mod.inst.io.foo.toTarget.serialize, + mod.inst.io.foo.k.toTarget.serialize, + mod.inst.io.foo.k.k.toTarget.serialize, + mod.inst.io.foo.elements.head._2.toTarget.serialize, + mod.inst.io.foo.k.elements.head._2.toTarget.serialize, + mod.inst.io.foo.k.k.elements.head._2.toTarget.serialize ) - testStrings.foreach(x => assert(x == "~NestedRecordModule|NestedRecordModule>in")) + testStrings.foreach(x => assert(x == "~NestedRecordModule|InnerModule>io.foo")) } they should "work correctly when connecting nested opaque type elements" in { val nestedRecordChirrtl = ChiselStage.emitChirrtl { new NestedRecordModule } nestedRecordChirrtl should include("input in : UInt<8>") nestedRecordChirrtl should include("output out : UInt<8>") - nestedRecordChirrtl should include("inst.foo <= in") - nestedRecordChirrtl should include("out <= inst.bar") - nestedRecordChirrtl should include("input foo : UInt<8>") - nestedRecordChirrtl should include("output bar : UInt<8>") - nestedRecordChirrtl should include("bar <= foo") + nestedRecordChirrtl should include("inst.io.foo <= in") + nestedRecordChirrtl should include("out <= inst.io.bar") + nestedRecordChirrtl should include("output io : { flip foo : UInt<8>, bar : UInt<8>}") + nestedRecordChirrtl should include("io.bar <= io.foo") } they should "throw an error when map contains a named element and opaqueType is overriden to true" in { |
