Skip to content

Commit 7dad4f6

Browse files
authored
Merge pull request #760 from jwest115/fix-fpp-to-layout
Use topology qualified name for directory names
2 parents c0b6706 + 548dd35 commit 7dad4f6

File tree

99 files changed

+710
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+710
-148
lines changed

compiler/lib/src/main/scala/codegen/LayoutWriter/ComputeLayoutFiles.scala

Lines changed: 0 additions & 45 deletions
This file was deleted.

compiler/lib/src/main/scala/codegen/LayoutWriter/LayoutWriterState.scala

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@ case class LayoutWriterState(
1515
locationMap: Map[String, Location] = Map()
1616
) {
1717

18-
/** Gets the unqualified name associated with a symbol. */
18+
/** Gets the qualified name associated with a symbol. */
1919
def getName(symbol: Symbol): String = {
20-
val name = symbol.getUnqualifiedName
21-
a.parentSymbolMap.get(symbol) match {
22-
case Some(cs: Symbol.Component) => s"${cs.getUnqualifiedName}_$name"
23-
case _ => name
24-
}
20+
a.getQualifiedName(symbol).toString.replace(".", "_")
2521
}
26-
2722
}
2823

2924
case object LayoutWriterState {
@@ -34,4 +29,4 @@ case object LayoutWriterState {
3429
/** Gets the text filename for a connection graph */
3530
def getConnectionGraphFileName(baseName: String): String = s"${baseName}.txt"
3631

37-
}
32+
}

compiler/lib/src/main/scala/util/Error.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ sealed trait Error {
3636
Error.print (Some(loc)) (s"duplicate JSON file ${file}")
3737
System.err.println("previous file would be generated here:")
3838
System.err.println(prevLoc)
39-
case CodeGenError.DuplicateLayoutDirectory(dir, loc, prevLoc) =>
40-
Error.print (Some(loc)) (s"duplicate topology layout directory ${dir}")
41-
System.err.println("previous topology layout directory would be generated here:")
42-
System.err.println(prevLoc)
4339
case CodeGenError.DuplicateXmlFile(file, loc, prevLoc) =>
4440
Error.print (Some(loc)) (s"duplicate XML file ${file}")
4541
System.err.println("previous file would be generated here:")
@@ -346,8 +342,6 @@ object CodeGenError {
346342
final case class DuplicateCppFile(file: String, loc: Location, prevLoc: Location) extends Error
347343
/** Duplicate JSON file path */
348344
final case class DuplicateJsonFile(file: String, loc: Location, prevLoc: Location) extends Error
349-
/** Duplicate Layout file path */
350-
final case class DuplicateLayoutDirectory(dir: String, loc: Location, prevLoc: Location) extends Error
351345
/** Duplicate XML file path */
352346
final case class DuplicateXmlFile(file: String, loc: Location, prevLoc: Location) extends Error
353347
/** Empty struct */

compiler/tools/fpp-to-layout/src/main/scala/fpp-to-layout.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ object FPPToLayout {
3838
case Some(dir1) => dir1
3939
case None => "."
4040
}
41-
ComputeLayoutFiles.visitList(
42-
LayoutWriterState(a=a, dir=dir),
43-
tulFiles,
44-
ComputeLayoutFiles.transUnit
45-
)
41+
Right(LayoutWriterState(a, dir))
4642
}
4743
_ <- {
4844
LayoutWriter.visitList(
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
c1
2+
pOut
3+
0
4+
c2
5+
pIn
6+
0
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
c1
2+
pOut
3+
0
4+
c2
5+
pIn
6+
0
7+
Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
11
module M {
22

3+
port P
4+
5+
passive component C1 {
6+
7+
output port pOut: P
8+
9+
}
10+
11+
passive component C2 {
12+
13+
sync input port pIn: P
14+
15+
}
16+
17+
instance c1: C1 base id 0x100
18+
instance c2: C2 base id 0x200
19+
320
topology Duplicate {
21+
22+
instance c1
23+
instance c2
24+
25+
connections C {
26+
c1.pOut -> c2.pIn
27+
}
28+
429
}
30+
531
}
632

7-
topology Duplicate {
33+
instance c1: M.C1 base id 0x300
34+
instance c2: M.C2 base id 0x400
35+
36+
topology Duplicate {
37+
instance c1
38+
instance c2
39+
40+
connections C {
41+
c1.pOut -> c2.pIn
42+
}
843
}
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
fpp-to-layout
2-
[ local path prefix ]/tools/fpp-to-layout/test/duplicate_tops/duplicate.fpp:7.1
3-
topology Duplicate {
4-
^
5-
error: duplicate topology layout directory DuplicateLayout
6-
previous topology layout directory would be generated here:
7-
[ local path prefix ]/tools/fpp-to-layout/test/duplicate_tops/duplicate.fpp:3.3
8-
topology Duplicate {
9-
^
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
duplicate()
22
{
33
run_test '' duplicate && \
4+
compare M_Duplicate C && \
5+
compare Duplicate C && \
46
compare_out duplicate
57
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
duplicate()
2+
{
3+
update "" duplicate
4+
move_layout_files M_Duplicate C
5+
move_layout_files Duplicate C
6+
}

0 commit comments

Comments
 (0)