aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala
blob: 15b12d520d241e6d1bb7135ce237642ad642c4bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// See LICENSE for license details.

package firrtlTests.annotationTests

import firrtl.annotations.{CircuitName, ComponentName, LoadMemoryAnnotation, ModuleName}
import org.scalatest.{FreeSpec, Matchers}

class LoadMemoryAnnotationSpec extends FreeSpec with Matchers {
  "LoadMemoryAnnotation getFileName" - {
    "add name of subcomponent to file name when a memory was split" in {
      val lma = new LoadMemoryAnnotation(
        ComponentName("init_mem_subdata", ModuleName("b", CircuitName("c"))),
        "somepath/init_mem",
        originalMemoryNameOpt = Some("init_mem")
      )

      lma.getFileName should be("somepath/init_mem_subdata")
    }
    "and do that properly when there are dots in earlier sections of the path" in {
      val lma = new LoadMemoryAnnotation(
        ComponentName("init_mem_subdata", ModuleName("b", CircuitName("c"))),
        "./target/scala-2.12/test-classes/init_mem",
        originalMemoryNameOpt = Some("init_mem")
      )

      lma.getFileName should be("./target/scala-2.12/test-classes/init_mem_subdata")
    }
  }
}