aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAdam Izraelevitz2016-11-21 09:12:59 -0800
committerGitHub2016-11-21 09:12:59 -0800
commitaad8e09f355f4804d29361d75f54ce4a5c2d5c52 (patch)
tree6f657cdb73f37438d1500fd4af6394e5549550a5 /src/test
parent4b346ea0b6d9fc0867558d7bdd0fe56159489a92 (diff)
Rewrote inline xform to fix quadratic perf. bug (#377)
* Rewrote inline xform to fix quadratic perf. bug Turns out caching previously inlined modules is not useful The previous algorithm in a module, would flatten an instance's children, then flatten that instance. This caused all instances to be effectively inlined the number of times of its depth in the instance hierarchy, making it O(n*d*s), where n is the number of instances, and d is the depth of the instance, and s is the number of statements in the instance. The new algorithm directly inlines a module by keeping track of the parents of that instance, making it constant time with the number of instantiated instances. * Minor style fixes
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/InlineInstancesTests.scala17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/test/scala/firrtlTests/InlineInstancesTests.scala b/src/test/scala/firrtlTests/InlineInstancesTests.scala
index 36b007e8..92ed1195 100644
--- a/src/test/scala/firrtlTests/InlineInstancesTests.scala
+++ b/src/test/scala/firrtlTests/InlineInstancesTests.scala
@@ -49,11 +49,7 @@ class InlineInstancesTests extends LowTransformSpec {
| wire i$b : UInt<32>
| i$b <= i$a
| b <= i$b
- | i$a <= a
- | module Inline :
- | input a : UInt<32>
- | output b : UInt<32>
- | b <= a""".stripMargin
+ | i$a <= a""".stripMargin
val writer = new StringWriter()
val aMap = new AnnotationMap(Seq(InlineAnnotation(ModuleName("Inline", CircuitName("Top")))))
execute(writer, aMap, input, check)
@@ -87,11 +83,7 @@ class InlineInstancesTests extends LowTransformSpec {
| i1$b <= i1$a
| b <= i1$b
| i0$a <= a
- | i1$a <= i0$b
- | module Simple :
- | input a : UInt<32>
- | output b : UInt<32>
- | b <= a""".stripMargin
+ | i1$a <= i0$b""".stripMargin
val writer = new StringWriter()
val aMap = new AnnotationMap(Seq(InlineAnnotation(ModuleName("Simple", CircuitName("Top")))))
execute(writer, aMap, input, check)
@@ -166,10 +158,6 @@ class InlineInstancesTests extends LowTransformSpec {
| b <= i1.b
| i0$a <= a
| i1.a <= i0$b
- | module A :
- | input a : UInt<32>
- | output b : UInt<32>
- | b <= a
| module B :
| input a : UInt<32>
| output b : UInt<32>
@@ -183,7 +171,6 @@ class InlineInstancesTests extends LowTransformSpec {
execute(writer, aMap, input, check)
}
-
// ---- Errors ----
// 1) ext module
"External module" should "not be inlined" in {