コード例 #1
0
 public override void BlockUsedResources()
 {
     foreach (TCLRoutingTreeNode node in RoutingTree.GetAllRoutingNodes().Where(n => !n.VirtualNode))
     {
         node.Tile.BlockPort(node.Port,Tile.BlockReason.OccupiedByMacro);
     }
 }
コード例 #2
0
        public void SetPins()
        {
            foreach (TCLRoutingTreeNode node in RoutingTree.GetAllRoutingNodes().Where(n => !n.VirtualNode))
            {
                Tile t = node.Tile;
                foreach (Slice s in t.Slices)
                {
                    bool inport  = s.PortMapping.IsSliceInPort(node.Port);
                    bool outport = s.PortMapping.IsSliceOutPort(node.Port);
                    if ((inport || outport) && node.Port.Name.Contains('_'))
                    {
                        NetPin pin = null;
                        if (inport)
                        {
                            pin = new NetInpin();
                        }
                        else
                        {
                            pin = new NetOutpin();
                        }

                        pin.SlicePort    = node.Port.Name.Substring(node.Port.Name.LastIndexOf('_'));
                        pin.InstanceName = s.SliceName;

                        bool pinExistsAlready = NetPins.FirstOrDefault(np => np.InstanceName.Equals(pin.InstanceName) && np.SlicePort.Equals(pin.SlicePort)) != null;
                        if (!pinExistsAlready)
                        {
                            Add(pin);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public void UnflattenNet()
        {
            List <TCLRoutingTreeNode> nodeQueue = new List <TCLRoutingTreeNode>(RoutingTree.Root.Children);
            NetOutpin          outPin           = (NetOutpin)NetPins.First(np => np is NetOutpin);
            Tile               rootTile         = FPGA.FPGA.Instance.GetTile(outPin.TileName);
            TCLRoutingTreeNode newRoot          = nodeQueue.FirstOrDefault(n =>
                                                                           n.Tile.Location.Equals(rootTile.Location) &&
                                                                           rootTile.GetSliceByName(outPin.SliceName).PortMapping.IsSliceOutPort(outPin.SlicePort));

            nodeQueue.Remove(newRoot);

            NodeNet          = false;
            RoutingTree.Root = newRoot;
            // try to assign each node to parent
            while (nodeQueue.Count > 0)
            {
                foreach (TCLRoutingTreeNode node in RoutingTree.GetAllRoutingNodes())
                {
                    bool addedNodes = false;
                    // stay on tile
                    TCLRoutingTreeNode nodeOnThisTile = nodeQueue.Find(n =>
                                                                       n.Tile.Location.Equals(node.Tile.Location) &&
                                                                       n.Tile.SwitchMatrix.Contains(node.Port, n.Port));
                    if (nodeOnThisTile != null)
                    {
                        node.Children.Add(nodeOnThisTile);
                        nodeQueue.Remove(nodeOnThisTile);
                        addedNodes = true;
                        break;
                    }

                    // leave tile
                    foreach (Location loc in Navigator.GetDestinations(node.Tile, node.Port))
                    {
                        // look for next hop on loc.Tile
                        TCLRoutingTreeNode nodeOnOtherTile = nodeQueue.Find(n =>
                                                                            n.Tile.Location.Equals(loc.Tile.Location) &&
                                                                            n.Tile.SwitchMatrix.Contains(loc.Pip, n.Port));
                        if (nodeOnOtherTile != null)
                        {
                            node.Children.Add(nodeOnOtherTile);
                            nodeQueue.Remove(nodeOnOtherTile);
                            addedNodes = true;
                            break;
                        }
                    }
                    if (addedNodes)
                    {
                        break;
                    }
                }
            }
        }
コード例 #4
0
        public void FlattenNet()
        {
            // we do not need to overwrite TCLRoutingTree (which is only s very flat class)
            TCLRoutingTreeNode newRoot = new TCLRoutingTreeNode(null, null);

            newRoot.VirtualNode = true;
            // we can ignore virtual nodes as the new root will be the virtual new node
            foreach (TCLRoutingTreeNode node in RoutingTree.GetAllRoutingNodes().Where(n => !n.VirtualNode))
            {
                newRoot.Children.Add(node);
                node.Parent = newRoot;
            }

            // clear children after iterating over GetAllRoutingNodes, otherwise this will change the result fromGetAllRoutingNodes
            foreach (TCLRoutingTreeNode node in newRoot.Children)
            {
                node.Children.Clear();
            }

            NodeNet          = true;
            RoutingTree.Root = newRoot;
        }