diff options
| author | Jack Koenig | 2021-01-20 18:55:16 -0800 |
|---|---|---|
| committer | Jack Koenig | 2021-01-21 15:36:55 -0800 |
| commit | 8a73362bb6fe87817a1867cc2482c1841f95c077 (patch) | |
| tree | a439d2a5fb52941baeffa22297b38160dc2d1249 /src/test/scala/chiselTests/BlackBox.scala | |
| parent | b88ae1fb5cd106f114fa2152ac53c197ae69c164 (diff) | |
Remove val io
Chisel projects no longer need -Xsource:2.11 when compiling with Scala
2.12.
Autowrapping of "val io" for compatibility mode Modules is now
implemented using reflection instead of calling the virtual method.
Also move Chisel.BlackBox to new chisel3.internal.LegacyBlackBox
Diffstat (limited to 'src/test/scala/chiselTests/BlackBox.scala')
| -rw-r--r-- | src/test/scala/chiselTests/BlackBox.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/BlackBox.scala b/src/test/scala/chiselTests/BlackBox.scala index 8ae7d6ee..d3d52f96 100644 --- a/src/test/scala/chiselTests/BlackBox.scala +++ b/src/test/scala/chiselTests/BlackBox.scala @@ -15,6 +15,16 @@ class BlackBoxInverter extends BlackBox { }) } +// Due to the removal of "val io", this technically works +// This style is discouraged, please use "val io" +class BlackBoxInverterSuggestName extends BlackBox { + override def desiredName: String = "BlackBoxInverter" + val foo = IO(new Bundle() { + val in = Input(Bool()) + val out = Output(Bool()) + }).suggestName("io") +} + class BlackBoxPassthrough extends BlackBox { val io = IO(new Bundle() { val in = Input(Bool()) @@ -50,6 +60,18 @@ class BlackBoxTester extends BasicTester { stop() } +class BlackBoxTesterSuggestName extends BasicTester { + val blackBoxPos = Module(new BlackBoxInverterSuggestName) + val blackBoxNeg = Module(new BlackBoxInverterSuggestName) + + blackBoxPos.foo.in := 1.U + blackBoxNeg.foo.in := 0.U + + assert(blackBoxNeg.foo.out === 1.U) + assert(blackBoxPos.foo.out === 0.U) + stop() +} + class BlackBoxFlipTester extends BasicTester { val blackBox = Module(new BlackBoxPassthrough2) @@ -187,4 +209,10 @@ class BlackBoxSpec extends ChiselFlatSpec { } ) } + "A BlackBoxed using suggestName(\"io\")" should "work (but don't do this)" in { + assertTesterPasses( + {new BlackBoxTesterSuggestName}, + Seq("/chisel3/BlackBoxTest.v"), + TesterDriver.verilatorOnly) + } } |
