protected override void DoCommandAction() { // reset PRIOR to reading to reset high lighter CommandExecuter.Instance.Execute(new Reset()); FPGA.FPGA.Instance.Reset(); FPGA.FPGA.Instance.BackendType = FPGATypes.BackendType.Vivado; // create reader & open file StreamReader sr = new StreamReader(FileName); FileInfo fi = new FileInfo(FileName); long charCount = 0; long lineCount = 0; string line = ""; while ((line = sr.ReadLine()) != null) { lineCount++; charCount += line.Length; if (PrintProgress) { ProgressInfo.Progress = (int)(((double)charCount / (double)fi.Length) * (ExcludePipsToBidirectionalWiresFromBlocking ? 50 : 100)); } if (m_commentRegexp.IsMatch(line)) { continue; } int length = line.IndexOf('='); string prefix = line.Substring(0, length); switch (prefix) { case "Device": Watch.Start("ProcessDevice"); ProcessDevice(line); Watch.Stop("ProcessDevice"); break; case "R": Watch.Start("ProcessTile"); ProcessTile(line); Watch.Stop("ProcessTile"); break; case "Site": Watch.Start("ProcessSite"); ProcessSite(line); Watch.Stop("ProcessSite"); break; case "Pips": Watch.Start("ProcessPips"); ProcessPips(line); Watch.Stop("ProcessPips"); break; case "Wire": Watch.Start("ProcessWire"); ProcessWires(line, sr, ref charCount, fi.Length); Watch.Stop("ProcessWire"); break; default: { throw new ArgumentException("Unknown line type: " + line + " (line" + lineCount + ")"); } } } sr.Close(); ReadVivadoFPGADebugger.CloseStream(); WireList emptyWl = new WireList(); foreach (Tile tile in FPGA.FPGA.Instance.GetAllTiles().Where(t => t.WireList == null)) { XDLTileParser.StoreAndShareWireList(tile, emptyWl); } if (ExcludePipsToBidirectionalWiresFromBlocking) { ExcludePipsToBidirectionalWiresFromBlocking exclCmd = new ExcludePipsToBidirectionalWiresFromBlocking(); exclCmd.Profile = Profile; exclCmd.PrintProgress = PrintProgress; exclCmd.ProgressStart = 50; exclCmd.ProgressShare = 50; exclCmd.FileName = ""; CommandExecuter.Instance.Execute(exclCmd); } CommandExecuter.Instance.Execute(new Reset()); // no LoadFPGAFamilyScript here! LoadFPGAFamilyScript is called through Reset // remember for other stuff how we read in this FPGA Blackboard.Instance.LastLoadCommandForFPGA = ToString(); }
protected override void DoCommandAction() { // reset PRIOR to reading to reset high lighter CommandExecuter.Instance.Execute(new Reset()); // create reader & open file XDLStreamReaderWithUndo sr = new XDLStreamReaderWithUndo(FileName); FPGA.FPGA.Instance.Reset(); // XDL is only available with ISE FPGA.FPGA.Instance.BackendType = FPGA.FPGATypes.BackendType.ISE; XDLTileParser tp = new XDLTileParser(); try { string line = ""; while ((line = sr.ReadLine()) != null) { // add space not to match tile_summary or tiles if (line.Contains("(tile ")) { tp.ParseTile(line, sr); if (PrintProgress) { ProgressInfo.Progress = (int)((double)FPGA.FPGA.Instance.TileCount / (double)FPGA.FPGA.Instance.NumberOfExpectedTiles * (ReadWireStatements ? 20 : 100)); } } //skip commens else if (line.StartsWith("#")) { continue; } else if (line.StartsWith("(xdl_resource_report")) { XDLResourceReportParser.Parse(line); } else if (line.StartsWith("(tiles")) { XDLDeviceShapeParser.Parse(line); } } } finally { sr.Close(); } // read wires in second run if (ReadWireStatements) { ReadWireStatements rw = new ReadWireStatements(); rw.ProgressStart = 20; rw.ProgressShare = 30; rw.FileName = FileName; rw.HandleUnresolvedWires = false; rw.PrintProgress = PrintProgress; rw.Profile = Profile; CommandExecuter.Instance.Execute(rw); // in third run rw = new ReadWireStatements(); rw.ProgressStart = 50; rw.ProgressShare = 30; rw.FileName = FileName; rw.HandleUnresolvedWires = true; rw.PrintProgress = PrintProgress; rw.Profile = Profile; CommandExecuter.Instance.Execute(rw); } if (ExcludePipsToBidirectionalWiresFromBlocking) { ExcludePipsToBidirectionalWiresFromBlocking exclCmd = new ExcludePipsToBidirectionalWiresFromBlocking(); exclCmd.Profile = Profile; exclCmd.PrintProgress = PrintProgress; exclCmd.ProgressStart = 80; exclCmd.ProgressShare = 20; exclCmd.FileName = ""; CommandExecuter.Instance.Execute(exclCmd); } CommandExecuter.Instance.Execute(new Reset()); // no LoadFPGAFamilyScript here! LoadFPGAFamilyScript is called through Reset // remember for other stuff how we read in this FPGA Objects.Blackboard.Instance.LastLoadCommandForFPGA = ToString(); }