コード例 #1
0
        private bool AddArcsXDL(NetlistContainer netlistContainer)
        {
            // which net to extend?
            XDLNet target;

            if (netlistContainer.Nets.Any(n => n.Name.Equals(Netname)))
            {
                target = (XDLNet)netlistContainer.GetNet(Netname);
            }
            else
            {
                target = (XDLNet)netlistContainer.GetAnyNet();
            }

            Port from = new Port(From);
            Port to   = new Port(To);

            bool arcAdded = false;

            foreach (Tile t in TileSelectionManager.Instance.GetSelectedTiles().Where(t => AddArcOnThisTile(from, to, t)))
            {
                target.Add(CommentForPip);
                target.Add(t, from, to);
                if (!t.IsPortBlocked(from, Tile.BlockReason.Blocked))
                {
                    t.BlockPort(from, Tile.BlockReason.Blocked);
                }
                t.BlockPort(to, Tile.BlockReason.Blocked);
                arcAdded = true;
            }

            return(arcAdded);
        }
コード例 #2
0
        protected override void DoCommandAction()
        {
            BlockOnlyMarkedPortsScope = BlockOnlyMarkedPorts;

            FPGATypes.AssertBackendType(FPGATypes.BackendType.ISE, FPGATypes.BackendType.Vivado);

            // prevent repeated error message from subcommands
            if (!NetlistContainerManager.Instance.Contains(NetlistContainerName))
            {
                throw new ArgumentException("The netlist container " + NetlistContainerName + " does not exist. Use the command AddNetlistContainer to add a netlist container.");
            }

            NetlistContainer nlc = GetNetlistContainer();
            Net blockerNet       = null;

            bool useExistingNet = false;

            if (nlc.Nets.Any(n => n.OutpinCount > 0))
            {
                useExistingNet = true;
                blockerNet     = nlc.GetAnyNet();
                OutputManager.WriteOutput("Adding blocker pips to already existing net " + blockerNet.Name);
            }
            else
            {
                // create XDL or TCL script
                blockerNet = Net.CreateNet("BlockSelection");

                if (FPGA.FPGA.Instance.BackendType == FPGATypes.BackendType.Vivado)
                {
                    blockerNet = new TCLNet("BlockSelection");
                    //((TCLNet)blockerNet).Properties.SetProperty("IS_ROUTE_FIXED", "TRUE", false);
                    // tag for code generation
                    ((TCLNet)blockerNet).IsBlockerNet = true;
                    ((TCLNet)blockerNet).RoutingTree  = new TCLRoutingTree();
                    TCLRoutingTreeNode root = new TCLRoutingTreeNode(null, null);
                    root.VirtualNode = true;
                    ((TCLNet)blockerNet).RoutingTree.Root = root;
                }

                useExistingNet = false;
                bool outPinAdded = false;

                // the location string of the tile in which we run the outpin
                string outpinLocation = "";

                // 1 iterate over all not filtered out tiles to instantiate primitves and to find an outpin
                switch (FPGA.FPGA.Instance.BackendType)
                {
                case FPGATypes.BackendType.ISE:
                    AddXDLTemplates(nlc, blockerNet, ref outPinAdded, ref outpinLocation);
                    break;

                case FPGATypes.BackendType.Vivado:
                    //this.AddTCLInstances(nlc, blockerNet, ref outPinAdded, ref outpinLocation);
                    ((TCLContainer)nlc).AddGndPrimitive(blockerNet);
                    outPinAdded = true;
                    break;
                }

                // 2 name net according to added outpin
                blockerNet.Name = Prefix + outpinLocation + "_" + blockerNet.Name;

                if (!outPinAdded)
                {
                    OutputManager.WriteOutput("Could not find an outpin");
                }
            }

            // 4 cluster all completely unblocked tiles by their identifiers (do not cluster BEFORE having added and thus blocked an outpin)
            //   tiles with already blocked ports are added to single cluster each and thus treated seperately
            Dictionary <int, List <Tile> > clusteredTiles = new Dictionary <int, List <Tile> >();

            switch (FPGA.FPGA.Instance.BackendType)
            {
            case FPGATypes.BackendType.ISE:
                FindClusteringForISE(clusteredTiles);
                break;

            case FPGATypes.BackendType.Vivado:
                FindClusteringForVivado(clusteredTiles);
                break;
            }


            // block by
            // 5 paths ...
            int clusterCount = 0;

            foreach (List <Tile> tiles in clusteredTiles.Values)
            {
                AddBlockerPaths(blockerNet, tiles[0], tiles);

                ProgressInfo.Progress = 0 + (int)((double)clusterCount++ / (double)clusteredTiles.Count * 50);
            }

            // 6 and arcs
            clusterCount = 0;
            foreach (List <Tile> tiles in clusteredTiles.Values)
            {
                AddArcs(blockerNet, tiles[0], tiles);

                ProgressInfo.Progress = 50 + (int)((double)clusterCount++ / (double)clusteredTiles.Count * 50);
            }

            // 7 check blocking
            if (PrintUnblockedPorts)
            {
                foreach (Tile t in TileSelectionManager.Instance.GetSelectedTiles().Where(
                             t => !BlockerSettings.Instance.SkipTile(t) && IdentifierManager.Instance.IsMatch(t.Location, IdentifierManager.RegexTypes.Interconnect)))
                {
                    CheckForUnblockedPorts(t);
                }
            }

            // clean up indeces
            foreach (Tile tile in TileSelectionManager.Instance.GetSelectedTiles().Where(t => !BlockerSettings.Instance.SkipTile(t)))
            {
                tile.SwitchMatrix.ClearBlockingPortList();
            }

            // add prefix and store nets
            if (blockerNet.PipCount > 0 && !useExistingNet)
            {
                nlc.Add(blockerNet);
            }
        }