aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJack Koenig2017-02-14 13:22:26 -0800
committerGitHub2017-02-14 13:22:26 -0800
commit088b72a2d5c2c467ac6851339d0a3263e6c06bed (patch)
tree3a742e83c650d9d8e47f92cae678cd605f30b2c6 /src/test
parent208176767a8b93172e02b55fe5e5cc19891e5921 (diff)
Add support for Analog types in partial connect (#435)
Also add support for width inference
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/AttachSpec.scala48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/AttachSpec.scala b/src/test/scala/firrtlTests/AttachSpec.scala
index 32dc00a0..5eed33bd 100644
--- a/src/test/scala/firrtlTests/AttachSpec.scala
+++ b/src/test/scala/firrtlTests/AttachSpec.scala
@@ -144,6 +144,29 @@ class InoutVerilogSpec extends FirrtlFlatSpec {
executeTest(input, check, compiler)
}
+ it should "work in partial connect" in {
+ val compiler = new VerilogCompiler
+ val input =
+ """circuit Attaching :
+ | module Attaching :
+ | input foo : { b : UInt<3>, a : Analog<3> }
+ | output bar : { b : UInt<3>, a : Analog<3> }
+ | bar <- foo""".stripMargin
+ // Omitting `ifdef SYNTHESIS and `elseif verilator since it's tested above
+ val check =
+ """module Attaching(
+ | input [2:0] foo_b,
+ | inout [2:0] foo_a,
+ | output [2:0] bar_b,
+ | inout [2:0] bar_a
+ |);
+ | assign bar_b = foo_b;
+ | alias bar_a = foo_a;
+ |endmodule
+ |""".stripMargin.split("\n") map normalized
+ executeTest(input, check, compiler)
+ }
+
it should "preserve attach order" in {
val compiler = new VerilogCompiler
val input =
@@ -190,6 +213,31 @@ class InoutVerilogSpec extends FirrtlFlatSpec {
|""".stripMargin.split("\n") map normalized
executeTest(input2, check2, compiler)
}
+
+ it should "infer widths" in {
+ val compiler = new VerilogCompiler
+ val input =
+ """circuit Attaching :
+ | module Attaching :
+ | input an: Analog
+ | inst a of A
+ | attach (an, a.an1)
+ | module A:
+ | input an1: Analog<3>""".stripMargin
+ val check =
+ """module Attaching(
+ | inout [2:0] an
+ |);
+ | A a (
+ | .an1(an)
+ | );
+ |endmodule
+ |module A(
+ | inout [2:0] an1
+ |);
+ |endmodule""".stripMargin.split("\n") map normalized
+ executeTest(input, check, compiler)
+ }
}
class AttachAnalogSpec extends FirrtlFlatSpec {