Skip to content

Commit fa6cfd3

Browse files
committed
Cleanup; remove unused json writer
Signed-off-by: Eddie Hung <[email protected]>
1 parent 9ea4f42 commit fa6cfd3

File tree

1 file changed

+14
-115
lines changed

1 file changed

+14
-115
lines changed

src/com/xilinx/rapidwright/placer/dreamplacefpga/DREAMPlaceFPGA.java

Lines changed: 14 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -53,117 +53,27 @@
5353
*/
5454
public class DREAMPlaceFPGA {
5555

56-
public static final String INTERCHANGE_NETLIST = "interchange_netlist";
57-
public static final String INTERCHANGE_DEVICE = "interchange_device";
58-
public static final String RESULT_DIR = "result_dir";
59-
public static final String IO_PL = "io_pl";
60-
public static final String GPU = "gpu";
61-
public static final String NUM_BINS_X = "num_bins_x";
62-
public static final String NUM_BINS_Y = "num_bins_y";
63-
public static final String GLOBAL_PLACE_STAGES = "global_place_stages";
64-
public static final String TARGET_DENSITY = "target_density";
65-
public static final String DENSITY_WEIGHT = "density_weight";
66-
public static final String RANDOM_SEED = "random_seed";
67-
public static final String SCALE_FACTOR = "scale_factor";
68-
public static final String GLOBAL_PLACE_FLAG = "global_place_flag";
69-
public static final String ROUTABILITY_OPT_FLAG = "routability_opt_flag";
70-
public static final String LEGALIZE_FLAG = "legalize_flag";
71-
public static final String DETAILED_PLACE_FLAG = "detailed_place_flag";
72-
public static final String DTYPE = "dtype";
73-
public static final String PLOT_FLAG = "plot_flag";
74-
public static final String NUM_THREADS = "num_threads";
75-
public static final String DETERMINISTIC_FLAG = "deterministic_flag";
76-
public static final String ENABLE_IF = "enable_if";
77-
public static final String ENABLE_SITE_ROUTING = "enable_site_routing";
78-
79-
public static final String IO_PL_DEFAULT = "";
80-
public static final boolean GPU_DEFAULT = false;
81-
public static final int NUM_BINS_X_DEFAULT = 512;
82-
public static final int NUM_BINS_Y_DEFAULT = 512;
83-
public static final String GLOBAL_PLACE_STAGES_DEFAULT =
84-
"[\n{\"num_bins_x\" : 512,"
85-
+ " \"num_bins_y\" : 512,"
86-
+ " \"iteration\" : 2000,"
87-
+ " \"learning_rate\" : 0.01,"
88-
+ " \"wirelength\" : \"weighted_average\","
89-
+ " \"optimizer\" : \"nesterov\"}\n]";
90-
public static final double TARGET_DENSITY_DEFAULT = 1.0;
91-
public static final double DENSITY_WEIGHT_DEFAULT = 8e-5;
92-
public static final int RANDOM_SEED_DEFAULT = 1000;
93-
public static final double SCALE_FACTOR_DEFAULT = 1.0;
94-
public static final boolean GLOBAL_PLACE_FLAG_DEFAULT = true;
95-
public static final boolean ROUTABILITY_OPT_FLAG_DEFAULT = false;
96-
public static final boolean LEGALIZE_FLAG_DEFAULT = true;
97-
public static final boolean DETAILED_PLACE_FLAG_DEFAULT = false;
98-
public static final String DTYPE_DEFAULT = "float32";
99-
public static final boolean PLOT_FLAG_DEFAULT = false;
100-
public static final int NUM_THREADS_DEFAULT = 8;
101-
public static final boolean DETERMINISTIC_FLAG_DEFAULT = true;
102-
public static final boolean ENABLE_IF_DEFAULT = true;
103-
public static final boolean ENABLE_SITE_ROUTING_DEFAULT = false;
104-
105-
// public static final String dreamPlaceFPGAExec = "DREAMPlaceFPGA";
10656
public static final String dreamPlaceFPGAExec = "dreamplacefpga";
10757

10858
public static final String MAKE_DCP_OUT_OF_CONTEXT = PhysicalNetlistToDcp.MAKE_DCP_OUT_OF_CONTEXT;
10959

110-
public static Map<String, Object> getSettingsMap() {
111-
Map<String, Object> map = new HashMap<>();
112-
113-
map.put(IO_PL, IO_PL_DEFAULT);
114-
map.put(GPU, GPU_DEFAULT);
115-
map.put(NUM_BINS_X, NUM_BINS_X_DEFAULT);
116-
map.put(NUM_BINS_Y, NUM_BINS_Y_DEFAULT);
117-
map.put(GLOBAL_PLACE_STAGES, GLOBAL_PLACE_STAGES_DEFAULT);
118-
map.put(TARGET_DENSITY, TARGET_DENSITY_DEFAULT);
119-
map.put(DENSITY_WEIGHT, DENSITY_WEIGHT_DEFAULT);
120-
map.put(RANDOM_SEED, RANDOM_SEED_DEFAULT);
121-
map.put(SCALE_FACTOR, SCALE_FACTOR_DEFAULT);
122-
map.put(GLOBAL_PLACE_FLAG, GLOBAL_PLACE_FLAG_DEFAULT);
123-
map.put(ROUTABILITY_OPT_FLAG, ROUTABILITY_OPT_FLAG_DEFAULT);
124-
map.put(LEGALIZE_FLAG, LEGALIZE_FLAG_DEFAULT);
125-
map.put(DETAILED_PLACE_FLAG, DETAILED_PLACE_FLAG_DEFAULT);
126-
map.put(DTYPE, DTYPE_DEFAULT);
127-
map.put(PLOT_FLAG, PLOT_FLAG_DEFAULT);
128-
map.put(NUM_THREADS, NUM_THREADS_DEFAULT);
129-
map.put(DETERMINISTIC_FLAG, DETERMINISTIC_FLAG_DEFAULT);
130-
map.put(ENABLE_IF, ENABLE_IF_DEFAULT);
131-
map.put(ENABLE_SITE_ROUTING, ENABLE_SITE_ROUTING_DEFAULT);
132-
133-
return map;
134-
}
135-
136-
public static void writeJSONForDREAMPlaceFPGA(Path jsonPath, Map<String, Object> attributes) {
137-
try (BufferedWriter bw = new BufferedWriter(new FileWriter(jsonPath.toFile()))) {
138-
bw.write("{\n");
139-
boolean first = true;
140-
for (Entry<String, Object> e : attributes.entrySet()) {
141-
if (first) {
142-
first = false;
143-
} else {
144-
bw.write(",\n");
145-
}
146-
bw.write(" \"" + e.getKey() + "\"");
147-
bw.write(" : ");
148-
if (e.getValue() instanceof String && !e.getKey().equals(GLOBAL_PLACE_STAGES)) {
149-
bw.write("\"" + e.getValue().toString() + "\"");
150-
} else if (e.getValue() instanceof Boolean) {
151-
bw.write((boolean) e.getValue() ? "1" : "0");
152-
} else {
153-
bw.write(e.getValue().toString() + "");
154-
}
155-
156-
}
157-
bw.write("\n}\n");
158-
} catch (IOException e) {
159-
throw new UncheckedIOException(e);
160-
}
161-
}
162-
60+
/**
61+
* Given a EDIFNetlist object, place it using DREAMPlaceFPGA.
62+
* @param netlist EDIFNetlist object to be placed.
63+
* @return Placed Design object.
64+
* @throws IOException
65+
*/
16366
public static Design placeDesign(EDIFNetlist netlist) throws IOException {
16467
return placeDesign(netlist, null, false);
16568
}
16669

70+
/**
71+
* Given a EDIFNetlist object, place it using DREAMPlaceFPGA.
72+
* @param netlist EDIFNetlist object to be placed.
73+
* @param workDir Path to working directory (null to use a temporary directory which gets deleted on return)
74+
* @return Placed Design object.
75+
* @throws IOException
76+
*/
16777
public static Design placeDesign(EDIFNetlist netlist, Path workDir, boolean makeOutOfContext) throws IOException {
16878
boolean removeWorkDir = false;
16979
if (workDir == null) {
@@ -194,17 +104,6 @@ public static Design placeDesign(EDIFNetlist netlist, Path workDir, boolean make
194104
}
195105
}
196106

197-
// Create JSON file for DREAMPlaceFPGA
198-
// Path jsonFile = workDir.resolve("design.json");
199-
// Map<String, Object> settings = getSettingsMap();
200-
// settings.put(INTERCHANGE_DEVICE, deviceFile.toString());
201-
// settings.put(INTERCHANGE_NETLIST, workDir.relativize(Paths.get(inputRoot + Interchange.LOG_NETLIST_EXT)).toString());
202-
// settings.put(RESULT_DIR, workDir.toString());
203-
// writeJSONForDREAMPlaceFPGA(jsonFile, settings);
204-
205-
// Run DREAMPlaceFPGA
206-
// String exec = dreamPlaceFPGAExec + " " + workDir.relativize(jsonFile);
207-
208107
// Run DREAMPlaceFPGA
209108
List<String> exec = new ArrayList<>();
210109
exec.add(dreamPlaceFPGAExec);
@@ -223,7 +122,7 @@ public static Design placeDesign(EDIFNetlist netlist, Path workDir, boolean make
223122
}
224123

225124
// Load placed result
226-
Design placedDesign = null;
125+
Design placedDesign;
227126
String outputPhysNetlistPath = workDir.resolve("design/design.phys").toString();
228127
try {
229128
placedDesign = PhysNetlistReader.readPhysNetlist(outputPhysNetlistPath,

0 commit comments

Comments
 (0)