44
44
import com.sun.electric.tool.placement.PlacementAdapter.PlacementNode;
45
45
import com.sun.electric.tool.placement.PlacementAdapter.PlacementPort;
46
46
import com.sun.electric.tool.placement.PlacementFrame.PlacementNetwork;
47
import com.sun.electric.tool.routing.Routing;
48
import com.sun.electric.tool.routing.SeaOfGates;
49
import com.sun.electric.tool.routing.seaOfGates.SeaOfGatesEngine;
50
import com.sun.electric.tool.routing.seaOfGates.SeaOfGatesEngineFactory;
51
import com.sun.electric.tool.routing.seaOfGates.SeaOfGatesEngineFactory.SeaOfGatesEngineType;
52
import com.sun.electric.tool.routing.seaOfGates.SeaOfGatesHandlers;
53
import com.sun.electric.tool.routing.seaOfGates.SeaOfGatesHandlers.Save;
47
54
import com.sun.electric.tool.user.User;
48
55
import com.sun.electric.tool.user.ui.WindowFrame;
49
56
import com.sun.electric.util.CollectionFactory;
52
59
import java.io.Serializable;
53
60
import java.util.ArrayList;
54
61
import java.util.HashMap;
62
import java.util.HashSet;
55
63
import java.util.Iterator;
56
64
import java.util.List;
57
65
import java.util.Map;
58
67
import java.util.prefs.Preferences;
130
139
public boolean doIt() throws JobException
132
newCell = placeCellNoJob(cell, getEditingPreferences(), prefs, false, this);
133
141
PlacementFrame pla = getCurrentPlacementAlgorithm(prefs);
142
newCell = placeCellNoJob(cell, getEditingPreferences(), pla, prefs, false, this);
134
143
Cell redispCell = pla.getRedispCell();
135
144
if (redispCell != null) newCell = redispCell;
136
145
fieldVariableChanged("newCell");
145
154
if (User.isShowCellsInNewWindow()) wf = null;
146
155
if (wf == null) wf = WindowFrame.createEditWindow(newCell);
147
156
wf.setCellWindow(newCell, null);
158
List<Cell> cellsToRoute = new ArrayList<Cell>();
159
Set<Cell> cellsScheduled = new HashSet<Cell>();
160
if (prefs.placementRunRouting)
162
// see if general placement was done, with partitioning into subcells
163
if (prefs.placementAlgorithm.equals(PlacementAdapter.GEN.getAlgorithmName()))
165
// first route the subcells
166
for(Iterator<NodeInst> it = newCell.getNodes(); it.hasNext(); )
168
NodeInst ni = it.next();
169
if (ni.isCellInstance())
171
Cell cell = (Cell)ni.getProto();
172
if (cell.getName().startsWith("CLUSTER"))
174
if (!cellsScheduled.contains(cell))
176
cellsScheduled.add(cell);
177
cellsToRoute.add(cell);
184
// route the top-level cell
185
cellsToRoute.add(newCell);
187
// now do all the routings
188
new AllRoutingJob(cellsToRoute);
195
* Class to run sea-of-gates routing, cell by cell, in new jobs.
197
private static class AllRoutingJob extends Job
199
private final List<Cell> cells;
200
private final SeaOfGates.SeaOfGatesOptions prefs = new SeaOfGates.SeaOfGatesOptions();
202
protected AllRoutingJob(List<Cell> cells)
204
super("Sea-Of-Gates Route", Routing.getRoutingTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);
206
prefs.getOptionsFromPreferences(false);
211
public boolean doIt() throws JobException
213
Cell cell = cells.get(0);
214
SeaOfGatesEngine router = SeaOfGatesEngineFactory.createSeaOfGatesEngine(SeaOfGatesEngineType.defaultVersion);
215
router.setPrefs(prefs);
216
SeaOfGatesEngine.Handler handler = SeaOfGatesHandlers.getDefault(cell, null, this, getEditingPreferences(), Save.SAVE_ONCE);
217
router.routeIt(handler, cell, true);
221
public void terminateOK()
224
if (cells.size() > 0)
226
new AllRoutingJob(cells);
153
232
* Entry point to do Placement of a Cell and create a new, placed Cell.
154
233
* Gathers the requirements for Placement into a collection of shadow
162
241
* @param job the Job (for detecting abort).
163
242
* @return the new Cell with the placement results.
165
public static Cell placeCellNoJob(Cell cell, EditingPreferences ep, PlacementPreferences prefs, boolean quiet, Job job)
244
public static Cell placeCellNoJob(Cell cell, EditingPreferences ep, PlacementFrame pla, PlacementPreferences prefs, boolean quiet, Job job)
170
249
Job.getUserInterface().setProgressNote("Acquiring netlist...");
172
251
System.out.println();
173
PlacementFrame pla = getCurrentPlacementAlgorithm(prefs);
174
// get network information for the Cell
253
// get network information for the Cell
175
254
Netlist netList = cell.getNetlist();
176
255
if (netList == null) {
177
256
System.out.println("Sorry, a deadlock aborted routing (network information unavailable). Please try again");
253
332
// make the PlacementNode for this NodeInst
254
PlacementNode plNode = new PlacementNode(ni, null, null, ni.getTechSpecific(), np.getDefWidth(ep),
255
np.getDefHeight(ep), pl, ni.isLocked());
333
double paddingRatio = (prefs.placementPadding + 100.0) / 100.0;
334
double width = np.getDefWidth(ep) * paddingRatio;
335
double height = np.getDefHeight(ep) * paddingRatio;
336
PlacementNode plNode = new PlacementNode(ni, null, null, ni.getTechSpecific(), width,
337
height, pl, ni.isLocked());
257
339
nodesToPlace.add(plNode);
258
340
for (PlacementFrame.PlacementPort plPort : pl)
297
379
if (portInstsByNetwork != null)
298
380
portInsts = portInstsByNetwork.get(net);
300
List<PortInst> portList = new ArrayList<PortInst>();
301
for (Iterator<PortInst> pIt = net.getPorts(); pIt.hasNext();)
302
portList.add(pIt.next());
303
portInsts = portList.toArray(new PortInst[] {});
382
portInsts = net.getPortsList().toArray(new PortInst[] {});
305
384
for (int i = 0; i < portInsts.length; i++) {
306
385
PortInst pi = portInsts[i];
328
407
pla.setOriginalCell(cell);
329
408
pla.setFailure(false);
330
409
Cell newCell = PlacementAdapter.doPlacement(pla, cell.getLibrary(), cell.noLibDescribe(), nodesToPlace,
331
allNetworks, exportsToPlace, iconToPlace, ep, prefs, quiet, job);
410
allNetworks, exportsToPlace, iconToPlace, ep, prefs, quiet?0:1, job);
340
419
/** The name of the Placement algorithm to use. The default is "Min-Cut". */
341
420
@StringPref(node = PLACEMENT_NODE, key = "AlgorithmName", factory = "Min-Cut")
342
421
public String placementAlgorithm;
423
/** The percentage of padding to use. The default is 0. */
424
@IntegerPref(node = PLACEMENT_NODE, key = "PlacementPadding", factory = 0)
425
public int placementPadding;
427
/** True to run routing after placement finishes. */
428
@BooleanPref(node = PLACEMENT_NODE, key = "PlacementRunRouting", factory = false)
429
public boolean placementRunRouting;
344
431
private Object[][] values;