Exemple #1
0
        /// <summary>
        /// Creates LB-compact placement with sequence of compaction steps.
        /// </summary>
        private void ToCompact()
        {
            //Stop condition of while loop, true if compaction steps change the O-tree
            bool changed = true;

            //Copy of components of the actual O-tree. If compaction steps does not change them, placement is compact.
            List<Bit> DfsSequenceCopy = new List<Bit>(oTree.DfsSequence);
            List<int> moduleSequenceCopy = new List<int>(oTree.ModuleSequence);

            while (changed)
            {
                changed = false;

                //Vertical constraint graph from horizontal O-tree.
                Graph gVertical = ToVerticalConstraintGraph();
                //Vertical O-tree from vertical constraint graph.
                oTree.ModuleSequence = gVertical.DepthFirstSearch(oTree.DfsSequence);

                //Horizontal constraint graph from vertical O-tree.
                Graph gHorizontal = ToHorizontalConstraintGraph();
                //Horizontal O-tree from horizontal constraint graph.
                oTree.ModuleSequence = gHorizontal.DepthFirstSearch(oTree.DfsSequence);

                //Checking the changes of the O-Tree after compaction steps.
                //If the O-tree has changed, more compaction steps could be needed on the changed tree.
                if (!(oTree.DfsSequence.SequenceEqual(DfsSequenceCopy) &&
                      oTree.ModuleSequence.SequenceEqual(moduleSequenceCopy)))
                {
                    moduleSequenceCopy = new List<int>(oTree.ModuleSequence);
                    DfsSequenceCopy = new List<Bit>(oTree.DfsSequence);
                    changed = true;
                }
            }

            //Compact placement.
            placement = new Placement(modules.Values.ToList<Module>());
        }
Exemple #2
0
 /// <summary>
 /// Algoritms class for O-Tree representation.
 /// </summary>
 /// <param name="ot">The O-tree code which describes the placement.</param>
 /// <param name="_modules">Modules to be packed.</param>
 public OT(OTree ot, List<Module> _modules)
 {
     oTree = ot;
     modules = _modules.ToDictionary(item => item.Name, item => item);
     placement = null;
 }
Exemple #3
0
 /// <summary>
 /// Algoritms class for O-Tree representation.
 /// </summary>
 /// <param name="ot">The O-tree code which describes the placement.</param>
 /// <param name="_modules">Modules to be packed.</param>
 public OT(OTree ot, List <Module> _modules)
 {
     oTree     = ot;
     modules   = _modules.ToDictionary(item => item.Name, item => item);
     placement = null;
 }