diff options
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/annotations/LoadMemoryAnnotation.scala | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/main/scala/firrtl/annotations/LoadMemoryAnnotation.scala b/src/main/scala/firrtl/annotations/LoadMemoryAnnotation.scala index 52022f87..7c7ef096 100644 --- a/src/main/scala/firrtl/annotations/LoadMemoryAnnotation.scala +++ b/src/main/scala/firrtl/annotations/LoadMemoryAnnotation.scala @@ -2,6 +2,8 @@ package firrtl.annotations +import java.io.File + /** * Enumeration of the two types of readmem statements available in verilog */ @@ -33,26 +35,20 @@ case class LoadMemoryAnnotation( (name, "") case "" :: name :: Nil => // this case handles a filename that begins with dot and has no suffix ("." + name, "") - case other => - (other.reverse.tail.reverse.mkString("."), "." + other.last) - } - } - - def getFileName: String = { - originalMemoryNameOpt match { - case Some(originalMemoryName) => - if(target.name == originalMemoryName) { - prefix + suffix + case other => { + if (other.last.indexOf(File.separator) != -1) { + (fileName, "") + } else { + (other.reverse.tail.reverse.mkString("."), "." + other.last) } - else { - prefix + target.name.drop(originalMemoryName.length) + suffix - } - case _ => - fileName + } } } + def getPrefix: String = + prefix + originalMemoryNameOpt.map(n => target.name.drop(n.length)).getOrElse("") def getSuffix: String = suffix + def getFileName: String = getPrefix + getSuffix def duplicate(newNamed: Named): LoadMemoryAnnotation = { newNamed match { @@ -63,5 +59,3 @@ case class LoadMemoryAnnotation( } } } - - |
