Example #1
0
        private void ProcessPips(string line)
        {
            string[] pairs = line.Split(',');
            if (pairs.Length != 2)
            {
                throw new ArgumentException("Error in line " + line);
            }
            int          startIndex = pairs[0].IndexOf('=');
            string       tileName   = pairs[0].Remove(0, startIndex + 1);
            Tile         t          = FPGA.FPGA.Instance.GetTile(tileName);
            SwitchMatrix sm         = new SwitchMatrix();

            string[] switching = pairs[1].Split(' ');

            foreach (string entry in switching.Where(s => !string.IsNullOrEmpty(s)))
            {
                // "LIOI3_SING.IOI_BYP6_0->IOI_IDELAY0_CINVCTRL"
                int fromEnd = entry.IndexOf('-');
                int toStart = entry.LastIndexOf('>'); // last due to ->>

                string from          = entry.Substring(0, fromEnd);
                bool   biDirectional = from.EndsWith("<<");
                // handle LH0<<->>LH12
                while (from.EndsWith(">") || from.EndsWith("<"))
                {
                    from = from.Remove(from.Length - 1);
                }
                string to = entry.Substring(toStart + 1);
                Port   p1 = new Port(from);
                Port   p2 = new Port(to);
                sm.Add(p1, p2);

                if (biDirectional && WireHelper.GetIncludeFlag(WireHelper.IncludeFlag.BiDirectionalPips))
                {
                    sm.Add(p2, p1);
                }
            }
            XDLTileParser.StoreAndShareSwitchMatrix(t, sm);
        }
Example #2
0
        private void ProcessWires(string line, StreamReader sr, ref long currentcharCount, long totalCharCount)
        {
            string currentTileName = "";
            Tile   currentTile     = null;

            WireList wl       = new WireList();
            string   wireLine = line;

            WireHelper wireHelper = new WireHelper();

            do
            {
                currentcharCount += wireLine.Length;
                if (PrintProgress)
                {
                    ProgressInfo.Progress = (int)(((double)currentcharCount / (double)totalCharCount) * (ExcludePipsToBidirectionalWiresFromBlocking ? 50 : 100));
                }

                if (m_commentRegexp.IsMatch(wireLine))
                {
                    Console.WriteLine(wireLine);
                    continue;
                }

                int    equalIndex = wireLine.IndexOf('=');
                int    sepIndex   = wireLine.IndexOf('>', equalIndex);
                string left       = wireLine.Substring(equalIndex + 1, sepIndex - equalIndex - 2);

                int    slashIndexLeft = left.IndexOf("/");
                string fromTile       = left.Substring(0, slashIndexLeft);
                string fromPip        = left.Substring(slashIndexLeft + 1);//, left.Length - slashIndexLeft-1);

                if (string.IsNullOrEmpty(currentTileName))
                {
                    currentTileName = fromTile;
                    currentTile     = FPGA.FPGA.Instance.GetTile(currentTileName);
                }
                else if (!fromTile.Equals(currentTileName))
                {
                    if (currentTile.WireList != null)
                    {
                        throw new ArgumentException("Wirelist should be null");
                    }
                    XDLTileParser.StoreAndShareWireList(currentTile, wl);
                    currentTileName = fromTile;
                    currentTile     = FPGA.FPGA.Instance.GetTile(currentTileName);

                    wl = new WireList();
                }

                string right           = wireLine.Substring(sepIndex + 1);//, wireLine.Length - sepIndex - 1);
                int    slashIndexRight = right.IndexOf("/");
                string toTile          = right.Substring(0, slashIndexRight);
                string toPip           = right.Substring(slashIndexRight + 1);//, right.Length - slashIndexRight - 1);

                Tile tile   = FPGA.FPGA.Instance.GetTile(fromTile);
                Tile target = FPGA.FPGA.Instance.GetTile(toTile);

                uint localPipKey = FPGA.FPGA.Instance.IdentifierListLookup.GetKey(fromPip);

                if (WireHelper.GetIncludeFlag(WireHelper.IncludeFlag.WiresTrajectoriesData))
                {
                    tile.AddWireTrajectoryData(localPipKey, FPGA.FPGA.Instance.IdentifierListLookup.GetKey(toTile));
                }

                if (!currentTile.SwitchMatrix.Contains(fromPip))
                {
                    if (!WireHelper.GetIncludeFlag(WireHelper.IncludeFlag.BELOutWires) ||
                        !wireHelper.IsBELOutPip(currentTile, fromPip))
                    {
                        ReadVivadoFPGADebugger.DebugWire(fromTile, fromPip, toTile, toPip);
                        continue;
                    }
                }

                short xIncr = (short)(target.TileKey.X - currentTile.TileKey.X);
                short yIncr = (short)(target.TileKey.Y - currentTile.TileKey.Y);

                // Check if we should consider U-turn wires
                bool condition = WireHelper.GetIncludeFlag(WireHelper.IncludeFlag.UTurnWires);
                condition = condition ? fromTile != toTile || fromPip != toPip : xIncr != 0 || yIncr != 0;
                if (!condition)
                {
                    ReadVivadoFPGADebugger.DebugWire(fromTile, fromPip, toTile, toPip);
                    continue;
                }

                if (!target.SwitchMatrix.Contains(toPip))
                {
                    if (!WireHelper.GetIncludeFlag(WireHelper.IncludeFlag.BELInWires) ||
                        !wireHelper.IsBELInPip(target, toPip))
                    {
                        ReadVivadoFPGADebugger.DebugWire(fromTile, fromPip, toTile, toPip);
                        continue;
                    }
                }

                uint pipOnOtherTileKey = FPGA.FPGA.Instance.IdentifierListLookup.GetKey(toPip);
                Port from = new Port(fromPip);
                //Port to = new Port(toPip);
                bool fromIsBegin = currentTile.SwitchMatrix.ContainsRight(from);
                Wire w           = new Wire(localPipKey, pipOnOtherTileKey, fromIsBegin, xIncr, yIncr);
                wl.Add(w);

                if (WireHelper.GetIncludeFlag(WireHelper.IncludeFlag.IncomingWires))
                {
                    target.AddIncomingWire(w);
                }
            }while ((wireLine = sr.ReadLine()) != null);

            wireHelper.ProcessStopoverArcs();
        }