コード例 #1
0
        protected override void DoCommandAction()
        {
            FPGATypes.AssertBackendType(FPGATypes.BackendType.ISE);

            NetlistContainer netlistContainer = GetNetlistContainer();

            // extract net names as we may not remve during iteration
            List <XDLNet> netNamesToDecompose = new List <XDLNet>();

            foreach (string netName in NetNames)
            {
                XDLNet n = (XDLNet)netlistContainer.GetNet(netName);
                netNamesToDecompose.Add(n);
            }

            foreach (XDLNet net in netNamesToDecompose)
            {
                foreach (XDLPip pip in net.Pips)
                {
                    XDLNet arc = new XDLNet(net.Name + "_" + pip.Location + "_" + pip.From + "_" + pip.To);
                    // TODO what about attributes
                    arc.Add(pip);
                    netlistContainer.Add(arc);
                }
                net.ClearPips();
                if (net.NetPinCount == 0)
                {
                    netlistContainer.Remove(new Predicate <Net>(n => n.Name.Equals(net.Name)));
                }
            }
        }
コード例 #2
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);
        }
コード例 #3
0
        protected override void DoCommandAction()
        {
            FPGATypes.AssertBackendType(FPGATypes.BackendType.ISE);

            NetlistContainer netlistContainer = GetNetlistContainer();
            XDLNet           net    = (XDLNet )netlistContainer.GetNet(Netname);
            Regex            filter = new Regex(PipRegexp, RegexOptions.Compiled);

            net.Remove(pip => filter.IsMatch(pip.ToString()));
        }
コード例 #4
0
        protected override void DoCommandAction()
        {
            NetlistContainer nlc = GetNetlistContainer();

            // the old net must exist
            if (!nlc.Nets.Any(n => n.Name.Equals(OldName)))
            {
                throw new ArgumentException("Could not find net " + OldName);
            }

            // net new netname may not exist
            if (nlc.Nets.Any(n => n.Name.Equals(NewName)))
            {
                throw new ArgumentException("Net " + NewName + " already used");
            }

            // capture net
            Net net = nlc.GetNet(OldName);

            net.Name = NewName;
        }
コード例 #5
0
        protected override void DoCommandAction()
        {
            FPGATypes.AssertBackendType(FPGATypes.BackendType.ISE);

            // what to route
            NetlistContainer netlist    = GetNetlistContainer();
            XDLNet           netToRoute = (XDLNet)netlist.GetNet(NetName);

            int outpinCount = netToRoute.NetPins.Count(np => np is NetOutpin);

            if (outpinCount != 1)
            {
                throw new ArgumentException("Can not route nets with " + outpinCount + " outpins");
            }
            NetPin outpin = netToRoute.NetPins.First(np => np is NetOutpin);

            // start to route from here
            List <Location> startLocations  = new List <Location>();
            List <Location> targetLocations = new List <Location>();

            // route from outpin
            string   startTileName  = netlist.GetInstanceByName(outpin.InstanceName).Location;
            Tile     startTile      = FPGA.FPGA.Instance.GetTile(startTileName);
            Slice    startSlice     = startTile.GetSliceByName(netlist.GetInstanceByName(outpin.InstanceName).SliceName);
            Port     startPip       = startSlice.PortMapping.Ports.Where(p => p.Name.EndsWith(outpin.SlicePort)).First();
            Location outpinLocation = new Location(startTile, startPip);

            startLocations.Add(outpinLocation);

            Queue <Location> targetQueue = new Queue <Location>(targetLocations);

            foreach (NetPin inpin in netToRoute.NetPins.Where(np => np is NetInpin).OrderBy(np => np.InstanceName))
            {
                string   targetTileName = netlist.GetInstanceByName(inpin.InstanceName).Location;
                Tile     targetTile     = FPGA.FPGA.Instance.GetTile(targetTileName);
                Slice    targetSlice    = targetTile.GetSliceByName(netlist.GetInstanceByName(inpin.InstanceName).SliceName);
                Port     targetPip      = targetSlice.PortMapping.Ports.Where(p => p.Name.EndsWith(inpin.SlicePort)).First();
                Location inpinLocation  = new Location(targetTile, targetPip);

                targetQueue.Enqueue(inpinLocation);
            }

            while (targetQueue.Count > 0)
            {
                // start with new routing
                foreach (XDLPip pip in netToRoute.Pips)
                {
                    Tile newStartTile = FPGA.FPGA.Instance.GetTile(pip.Location);
                    startLocations.Add(new Location(newStartTile, new Port(pip.From)));
                }

                // dequeue next target
                Location targetLocation = targetQueue.Dequeue();

                Watch.Start("route");
                List <Location> revPath = Route(SearchMode, true, startLocations, targetLocation, 0, 100, false).FirstOrDefault();
                Watch.Stop("route");

                // extend net
                if (revPath != null)
                {
                    XDLNet extension = new XDLNet(revPath);
                    netToRoute.Add(extension);
                }
            }

            // block the added pips
            netToRoute.BlockUsedResources();
        }