summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/CompatibilitySpec.scala
diff options
context:
space:
mode:
authorJack2021-12-18 08:27:38 +0000
committerJack2021-12-18 08:27:38 +0000
commitdd9ad534771247ac16eaa47eb9794102736b5102 (patch)
treed4566d317cb8526b79017de1e438aea8217dd1d4 /src/test/scala/chiselTests/CompatibilitySpec.scala
parent440edc4436fb3a8a4175ae425a0d31c4997ee60f (diff)
parentf50f74f583fba7b98e550c440df091e559ce32b8 (diff)
Merge branch 'master' into 3.5-release
Diffstat (limited to 'src/test/scala/chiselTests/CompatibilitySpec.scala')
-rw-r--r--src/test/scala/chiselTests/CompatibilitySpec.scala33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/test/scala/chiselTests/CompatibilitySpec.scala b/src/test/scala/chiselTests/CompatibilitySpec.scala
index 2d4ad517..7ac67b7c 100644
--- a/src/test/scala/chiselTests/CompatibilitySpec.scala
+++ b/src/test/scala/chiselTests/CompatibilitySpec.scala
@@ -195,11 +195,9 @@ class CompatibiltySpec extends ChiselFlatSpec with ScalaCheckDrivenPropertyCheck
class SmallBundle extends Bundle {
val f1 = UInt(width = 4)
val f2 = UInt(width = 5)
- override def cloneType: this.type = (new SmallBundle).asInstanceOf[this.type]
}
class BigBundle extends SmallBundle {
val f3 = UInt(width = 6)
- override def cloneType: this.type = (new BigBundle).asInstanceOf[this.type]
}
"A Module with missing bundle fields when compiled with the Chisel compatibility package" should "not throw an exception" in {
@@ -538,6 +536,9 @@ class CompatibiltySpec extends ChiselFlatSpec with ScalaCheckDrivenPropertyCheck
info("toUInt works")
s.toUInt shouldBe a [UInt]
+
+ info("toBools works")
+ s.toBools shouldBe a [Seq[Bool]]
}
ChiselStage.elaborate(new Foo)
@@ -566,4 +567,32 @@ class CompatibiltySpec extends ChiselFlatSpec with ScalaCheckDrivenPropertyCheck
verilog should include ("assign io_out_0 = io_in_0;")
}
+ it should "ignore .suggestName on field io" in {
+ class MyModule extends Module {
+ val io = new Bundle {
+ val foo = UInt(width = 8).asInput
+ val bar = UInt(width = 8).asOutput
+ }
+ io.suggestName("potato")
+ io.bar := io.foo
+ }
+ val verilog = ChiselStage.emitVerilog(new MyModule)
+ verilog should include ("input [7:0] io_foo")
+ verilog should include ("output [7:0] io_bar")
+ }
+
+ it should "properly name field io" in {
+ class MyModule extends Module {
+ val io = new Bundle {
+ val foo = UInt(width = 8).asInput
+ val bar = UInt(width = 8).asOutput
+ }
+ val wire = Wire(init = io.foo)
+ io.bar := wire
+ }
+ val verilog = ChiselStage.emitVerilog(new MyModule)
+ verilog should include ("input [7:0] io_foo")
+ verilog should include ("output [7:0] io_bar")
+ }
+
}