The first step in the algorithm is to place the modules in an array so that routing between them is as short as reasonably possible. Modules are first ordered vertically into distinct levels (this is a logical placement-the physical placement won't be determined until later), and then are placed horizontally within each level.
The ordering of modules vertically is a simple process:
Note that step 3 must eventually use all the modules because there can be no circular dependencies between modules (the modules form a strict hierarchy).
Once the modules have been ordered vertically, they must be arranged horizontally. This is done in two stages: ideal placement, and shifting to allow room for routing. During the ideal placement stage, the modules are placed in such a way that the total idealized routing distance to each module is minimized. For a given module, , the idealized routing distance is the sum of the squares of the horizontal displacements for each module that feeds data to an input of . The horizontal position of these modules will always be known since module placement proceeds in order down the hierarchy. For each level, modules are picked one by one and placed in such a manner that their idealized routing distance is minimized and they do not overlap.
Once the modules are ordered vertically and placed horizontally in an ideal manner, some may need to be shifted to make room for wires that need to go between modules. This is done by tracing the ideal path of each wire while keeping counters (which we will call and ) indicating how much space adjacent modules need between them. The algorithm is:
Once this step is completed, all modules have been placed in such a manner that routing, using the appropriate goal columns, must be possible without backtracking.