Exemplo n.º 1
0
        public void AddNeedTraces(NodeTraces inTrace)
        {
            int i;

            for (i = 0; i < inTrace.lines.Count; i++)
            {
                if (lines.FindIndex(el => el.IntersectsWith(inTrace.lines[i])) >= 0)
                {
                    break;
                }
            }
            for (int j = 0; j < i; j++)
            {
                lines.Add(inTrace.lines[j]);
            }
        }
Exemplo n.º 2
0
 public void AddTrace(NodeTraces inTrace)
 {
     lines.AddRange(inTrace.lines);
     crossing.AddRange(inTrace.crossing);
 }
Exemplo n.º 3
0
 public void AddNeedTraces(NodeTraces inTrace)
 {
     int i;
     for (i = 0; i < inTrace.lines.Count; i++)
     {
         if (lines.FindIndex(el => el.IntersectsWith(inTrace.lines[i])) >= 0)
             break;
     }
     for (int j = 0; j < i; j++)
         lines.Add(inTrace.lines[j]);
 }
Exemplo n.º 4
0
        public void CreateFileWithNames(string inPath, string nameFrag)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(inPath))
            {
                file.WriteLine("#include \"stdafx.h\" ");
                file.WriteLine("layout& SUM(void)");
                file.WriteLine("{");
                file.WriteLine("    FRAG(" + nameFrag + ")");
                file.WriteLine("    COMPACTION_MODE(X_Y)");
                //file.WriteLine("    // Транзисторы");
                CultureInfo culture = CultureInfo.CreateSpecificCulture("en-CA");
                double      coordX  = ((double)Params.leftBorder + 1.0) / 2.0;// 2.0;//4.0
                double      coordY  = ((double)Params.lineP + 1.0) / 2.0;
                foreach (string str in placedP)
                {
                    if (str != "")
                    {
                        file.WriteLine("    W(1.00) L(1.00) OR(SOUTH) SIMM TP(" + coordX.ToString("F2", culture) +
                                       ", " + coordY.ToString("F2", culture) + ");");
                    }
                    coordX += 1.0;//2.0
                }
                coordX = ((double)Params.leftBorder + 1.0) / 2.0;
                coordY = ((double)Params.lineN - 1.0) / 2.0;
                foreach (string str in placedN)
                {
                    if (str != "")
                    {
                        file.WriteLine("    W(1.00) L(1.00) OR(NORTH) SIMM TN(" + coordX.ToString("F2", culture) +
                                       ", " + coordY.ToString("F2", culture) + ");");
                    }
                    coordX += 1.0;
                }

                //file.WriteLine("    // Шины, линии");
                foreach (string curName in nodeConnectionDict.Keys)
                //NodeTraces cnt in nodeConnectionDict.Values)
                {
                    NodeTraces cnt = nodeConnectionDict[curName];
                    //TM1(0.00, 26.50, "VCC");
                    if (cnt.lines.Count > 0)
                    {
                        string layerPoint = "T" + Params.DefineMaterial(cnt.lines[0].type);
                        coordX = ((double)cnt.lines[0].Left) / 2.0;
                        coordY = ((double)cnt.lines[0].Top) / 2.0 + CorrectTop(cnt.lines[0]);
                        if (cnt.lines.Count > 1)
                        {
                            layerPoint = "T" + Params.DefineMaterial(cnt.lines[0].type);
                            coordX     = ((double)cnt.lines[1].Left) / 2.0;
                            coordY     = ((double)cnt.lines[1].Top) / 2.0 + CorrectTop(cnt.lines[1]);
                        }
                        file.WriteLine(layerPoint + "(" + coordX.ToString("F2", culture) + ", " + coordY.ToString("F2", culture) +
                                       ", \"" + curName + "\");");
                    }

                    for (int i = 0; i < cnt.lines.Count; i++)    //each (LineStruct ln in cnt.lines)
                    {
                        if (cnt.lines[i].Length() > 0)
                        {
                            coordX = ((double)cnt.lines[i].Left) / 2.0;
                            coordY = ((double)cnt.lines[i].Top) / 2.0 + CorrectTop(cnt.lines[i]);

                            string moving    = "";
                            double coordNext = 0.0;
                            if (cnt.lines[i].Height == 0)
                            {
                                moving    = "X";
                                coordNext = ((double)cnt.lines[i].Right) / 2.0;
                            }
                            else
                            {
                                moving    = "Y";
                                coordNext = ((double)cnt.lines[i].Bottom) / 2.0 + CorrectBottom(cnt.lines[i]);
                            }

                            file.WriteLine("    W_WIRE(" + GetLineW(cnt.lines[i]) + ") " + Params.DefineMaterial(cnt.lines[i].type) + "(" +
                                           coordX.ToString("F2", culture) + ", " + coordY.ToString("F2", culture) +
                                           ") " + moving + "(" + coordNext.ToString("F2", culture) + ");");
                        }
                        else
                        {
                            file.WriteLine("	//Error line");
                        }
                    }

                    foreach (ContactSimple contactUnit in cnt.crossing)
                    {
                        string cntType = Params.DefineMaterial(contactUnit.layer);
                        coordX = ((double)contactUnit.x) / 2.0;
                        coordY = ((double)contactUnit.y) / 2.0;
                        file.WriteLine("    " + cntType + "(" + coordX.ToString("F2", culture) +
                                       ", " + coordY.ToString("F2", culture) + ");");
                    }
                }

                file.WriteLine(AddKnBorder());
                file.WriteLine(AddKpBorder());
                file.WriteLine(AddB1Border());

                file.WriteLine("    ENDF");
                file.WriteLine("    return " + nameFrag + ";");
                file.WriteLine("}");
            }
        }
Exemplo n.º 5
0
 public void AddTrace(NodeTraces inTrace)
 {
     lines.AddRange(inTrace.lines);
     crossing.AddRange(inTrace.crossing);
 }
Exemplo n.º 6
0
        public NodeTraces RecoveryPath(ContactSimple startPoint, ContactSimple endPoint, string curName)
        {
            NodeTraces trace = new NodeTraces();

            List<ContactSimple> endPosition = GetSourceContacts(endPoint, curName);

            bool selectFirst = false;
            if ( diffusionException.FindIndex(el => el == curName) >= 0 )
                selectFirst = true;
            List<ContactSimple> starts = GetSourceContacts(startPoint, curName);
            ContactSimple curPoint = starts[0];
            foreach (ContactSimple cnt in starts)
            {
                if (GetPoint(cnt).name == curName)
                {
                    if (selectFirst)
                    {
                        curPoint = cnt;
                        break;
                    }
                    else
                    {
                        if ( (GetPoint(curPoint).name != curName) || (GetPoint(curPoint).number > GetPoint(cnt).number) )
                            curPoint = cnt;
                    }
                }
            }

            List<int> setOfLayers = new List<int>();//GetLayers(curPoint, curName);
            setOfLayers.Add(startPoint.layer);

            bool nextPoints = false;
            bool loopGo = true;
            int k = 0;

            while ( loopGo && k < 100)
            {
                k++;
                List<LineStruct> setOfLines = new List<LineStruct>();

                nextPoints = true;
                foreach (int layerUnit in setOfLayers)
                {
                    setOfLines.Add(GetLineVertical(curPoint, layerUnit, curName));
                    setOfLines.Add(GetLineHorizont(curPoint, layerUnit, curName));
                }

                //bool bestFinded = false;
                LineStruct curLine = setOfLines[0];
                foreach (LineStruct searchLine in setOfLines)
                {
                    ContactSimple oposPnt = new ContactSimple(searchLine.OpositePoint(curPoint));
                        if (GetPoint(oposPnt).isUsed && (GetPoint(oposPnt).name == curName))
                    {
                        curLine = searchLine;
                        loopGo = false;
                    }
                }

                if (loopGo)
                    curLine = SelectBestLine(setOfLines, trace.lines);//setOfLines.Max();
                trace.lines.Add(curLine);

                /*if ( (curLine.type == Layers.siliconTrace && curPoint.layer == Layers.metal1Trace) ||
                    (curLine.type == Layers.metal1Trace && curPoint.layer == Layers.siliconTrace) )
                {
                    trace.crossing.Add(new ContactSimple(curPoint, Params.csiType));
                }*/

                curPoint = curLine.OpositePoint(curPoint);
                setOfLayers = GetLayers(curPoint, curName);

                if ( endPosition.FindIndex(element => (element == curPoint) &&
                                           (element.layer == curPoint.layer)) >= 0 )
                    loopGo = false;
            }

            /*if ( (curPoint.layer == Params.met1Type) && (curPoint.y < Params.lineMiddle) )
                trace.crossing.Add(new ContactSimple(curPoint, Params.cpaType));
            if ( (curPoint.layer == Params.met1Type) && (curPoint.y > Params.lineMiddle) )
                trace.crossing.Add(new ContactSimple(curPoint, Params.cnaType));
            */
            return trace;
        }
Exemplo n.º 7
0
 private void AddStartEndContacts(NodeTraces inTrace, ContactSimple startPoint)
 {
     if ((startPoint.layer == Layers.metal1Trace) && ( (Math.Abs(startPoint.y - Params.lineN) < 4)
                                                      || (Math.Abs(startPoint.y - Params.lineP) < 4) ))
     {
         if ( (Math.Abs(startPoint.y - Params.lineN) < 4) && FindTrueSource(startPoint) )
         {
             inTrace.crossing.Add(new ContactSimple(startPoint, Material.cna_));
             if (Math.Abs(startPoint.y - Params.lineN) > 1)
                 inTrace.lines.Add(new LineStruct(new PairInt(startPoint.x, Params.lineN), startPoint, Material.na_));
         }
         if ( (Math.Abs(startPoint.y - Params.lineP) < 4) && FindTrueSource(startPoint) )
         {
             inTrace.crossing.Add(new ContactSimple(startPoint, Material.cpa_));
             if (Math.Abs(startPoint.y - Params.lineP) > 1)
                 inTrace.lines.Add(new LineStruct(new PairInt(startPoint.x, Params.lineP), startPoint, Material.pa_));
         }
     }
     else if ((startPoint.layer == Layers.metal1Trace) && Params.IsModelBusM2InMiddle())
         inTrace.crossing.Add(new ContactSimple(startPoint, Material.cm_));
 }
Exemplo n.º 8
0
        private void SpreadUsed(Node nd)
        {
            NodeTraces curTrace = new NodeTraces();

            List<int> fixedConnection = new List<int>();
            List<int> currentConnection = new List<int>();
            for (int i = 0; i < nd.arcCollection.Count; i++)
            {
                if (currentConnection.FindIndex(el => el == i) < 0)
                {
                    List<int> curList = nodeDistanceDict[nd.name].GetConnectedPoints(i);
                    int curStart = curList.Min();
                    currentConnection.Add(curStart);

                    foreach (int curEnd in curList)
                    {
                        if (currentConnection.FindIndex(el => el == curEnd) < 0) //(curStart != curEnd)
                        {
                            int numbFixedWith = nodeDistanceDict[nd.name].GetFixedPointTo(curEnd);
                            if ((numbFixedWith >= 0))
                                fixedConnection.Add(curEnd);
                                //curTrace.AddTrace(RecoveryFixedPath(nd.arcCollection[curEnd], nd.name));

                            if (numbFixedWith != curStart)
                            {
                                NodeTraces recPath = RecoveryUnicPath(curTrace.lines, nd.arcCollection[curEnd],
                                                           nd.arcCollection[curStart], nd.name);

                                if ((numbFixedWith >= 0) && (recPath.lines.Count > 0) &&
                                    (recPath.lines.FindIndex(el => (el.type != Material.na_ && el.type != Material.pa_)) >= 0) )
                                {
                                    currentConnection.Add(numbFixedWith);
                                }
                                curTrace.AddTrace(recPath);
                            }
                            currentConnection.Add(curEnd);//!!!!!!!
                        }
                    }
                }
            }
            foreach(int curEnd in fixedConnection)
                curTrace.AddTrace(RecoveryFixedPath(nd.arcCollection[curEnd], nd.name));

            SetUsed(curTrace);
        }
Exemplo n.º 9
0
        public NodeTraces RecoveryFixedPath(ContactSimple startPoint, string curName)
        {
            NodeTraces trace = new NodeTraces();

            //List<ContactSimple> endPts = GetSourceContacts(endPoint, curName);
            ContactSimple sPoint = new ContactSimple(startPoint);
            /*foreach (ContactSimple cnt in GetSourceContacts(startPoint, curName))
                if (GetPoint(cnt).isFixed)
                    sPoint = cnt;*/
            List<ContactSimple> passedPts = new List<ContactSimple>();

            if (!startPoint.isInOut())
            {
                sPoint = startPoint.GetInDiffusionEdge();//.GetHigherPoint(0);
                //if (startPoint.y > Params.lineMiddle)
                  //  sPoint = startPoint.GetLowerPoint(0);
            }

            NodePoint ndPoint = GetPoint(sPoint);
            passedPts.Add(sPoint);
            LineStruct ln = new LineStruct(startPoint, startPoint);
            do
            {
                foreach (int  lay in Params.allLayersRange[sPoint.layer])//pin-pong + wrong layer!!!!!!
                {
                    ln = GetFixedLine(passedPts, lay, curName);
                    if (ln.Length() > 0)// && (passedPts.FindIndex(el => el == ln.OpositePoint(sPoint)) < 0))
                    {
                        trace.lines.Add(ln);
                        break;
                    }
                }
                sPoint = ln.OpositePoint(sPoint);
                passedPts.Add(sPoint);
                ndPoint = GetPoint(sPoint);
            } while(!ndPoint.isSource && ndPoint.number > 0);//GetPoint(sPoint).isSource

            return trace;
        }
Exemplo n.º 10
0
 private void SetUsed(NodeTraces inTraces)
 {
     foreach (LineStruct lnUnit in inTraces.lines)
     {
         bool isSuccess = SetUsedInLine(lnUnit);
         //if (!isSuccess)
         //	return;
     }
 }
Exemplo n.º 11
0
        private NodeTraces RecoveryUnicPath(List<LineStruct> prevLines, ContactSimple startPoint, ContactSimple endPoint, string curName)
        {
            NodeTraces trace = new NodeTraces();

            //List<ContactSimple> endPosition = GetSourceContacts(endPoint, curName);
            bool selectFirst = false;
            if ( diffusionException.FindIndex(el => el == curName) >= 0 )
                selectFirst = true;
            List<ContactSimple> starts = GetSourceContacts(startPoint, curName);
            ContactSimple curPoint = starts[0];
            foreach (ContactSimple cnt in starts)
            {
                NodePoint pn = GetPoint(cnt);
                if (GetPoint(cnt).name == curName)
                {
                    if ( selectFirst && ( GetLineVertical(prevLines, cnt, cnt.layer, curName).Height > 0 ||
                                        GetLineHorizont(prevLines, cnt, cnt.layer, curName).Width > 0 ) )
                    {

                        curPoint = cnt;
                        break;
                    }
                    else
                    {
                        if ( (GetPoint(curPoint).name != curName) || (GetPoint(curPoint).number > GetPoint(cnt).number) )
                            curPoint = cnt;
                    }
                }
            }

            AddStartEndContacts(trace, curPoint);

            List<int> setOfLayers = new List<int>();//GetLayers(curPoint, curName);
            setOfLayers.Add(startPoint.layer);

            //bool nextPoints = false;
            bool loopGo = true;
            int k = 0;

            while ( loopGo && k < 100)
            {
                k++;
                List<LineStruct> setOfLines = new List<LineStruct>();

                foreach (int layerUnit in setOfLayers)
                {
                    setOfLines.Add(GetLineVertical(prevLines, curPoint, layerUnit, curName));
                    setOfLines.Add(GetLineHorizont(prevLines, curPoint, layerUnit, curName));
                }

                LineStruct curLine = setOfLines[0];
                foreach (LineStruct searchLine in setOfLines)
                {
                    ContactSimple oposPnt = new ContactSimple(searchLine.OpositePoint(curPoint));
                    if ((searchLine.Length() > 0) && GetPoint(oposPnt).isUsed && (GetPoint(oposPnt).name == curName))
                    {
                        curLine = searchLine;
                        loopGo = false;
                    }

                    foreach (ContactSimple cntUnit in searchLine.GetPointArray())
                    {
                        if ( prevLines.FindIndex(el => el.OverlapWithPoint(cntUnit)) >= 0 )
                        {
                            curLine = searchLine;
                            loopGo = false;
                        }
                    }
                }

                if (loopGo)
                    curLine = SelectBestLine(setOfLines, trace.lines);

                if (curLine.type != curPoint.layer)
                    trace.crossing.Add(new ContactSimple(curPoint, Params.DefineMaterial(curLine.type, curPoint.layer)));

                curPoint = curLine.OpositePoint(curPoint);

                if (curLine.Length() > 0)
                    trace.lines.Add(curLine);
                else
                {
                    ContactSimple pnt = GetNextPoint(trace.lines, curPoint);
                    if (pnt != curPoint)
                        AddStartEndContacts(trace, curPoint);
                    curPoint = pnt;
                }

                setOfLayers = GetLayers(curPoint, curName);

                foreach (int layerUnit in setOfLayers)
                {
                    if ( (GetPoint(curPoint, layerUnit).name == curName) && (GetPoint(curPoint, layerUnit).number == 0) )//endPosition.FindIndex(element => (element == curPoint) &&
                           //                    (element.layer == curPoint.layer)) >= 0 )
                        loopGo = false;
                }

                SetUsedInLine(curLine);

                if (k > 97)
                    loopGo = true;
            }

            if (k < 100)
                AddStartEndContacts(trace, curPoint);

            return trace;
        }
Exemplo n.º 12
0
        /*
        private NodeTraces GetNodeTrace_old(Node nd, System.IO.StreamWriter file)//better
        {
            NodeTraces allNodeTrace = new NodeTraces();

            List<int> currentConnection = new List<int>();
            for (int i = 0; i < nd.arcCollection.Count; i++)
            {
                if (currentConnection.FindIndex(el => el == i) < 0)
                {
                    List<int> curList = nodeDistanceDict[nd.name].GetConnectedPoints(i);
                    int curStart = curList.Min();

                    if (nd.name == "VCC")
                    {
                        //PrintUsed(0, file);
                        PrintNumb(0, file);
                    }

                    foreach (int curEnd in curList)
                    {
                        if (curStart != curEnd)
                        {
                            NodeTraces curTrace = new NodeTraces();

                            int numbFixedWith = nodeDistanceDict[nd.name].GetFixedPointTo(curEnd);
                            if ((numbFixedWith >= 0) && (currentConnection.FindIndex(el => el == numbFixedWith) >= 0))
                                curTrace.AddTrace(RecoveryFixedPath(nd.arcCollection[curEnd], nd.name));
                            else
                                curTrace.AddTrace(RecoveryPath(nd.arcCollection[curEnd],
                                                           nd.arcCollection[curStart], nd.name));
                            currentConnection.Add(curEnd);

                            //SetUsed(curTrace);

                            //ReplaceUnused procRemove = new ReplaceUnused(0, GetPoint(startPoint).priority, false);
                            //SpreadWaveProcess(startPoint, procRemove);

                            allNodeTrace.AddTrace(curTrace);
                        }
                    }

                    if (nd.name == "VCC")
                    {
                        PrintUsed(0, file);
                        //PrintNumb(0, file);
                    }
                }
            }
            return allNodeTrace;
        }*/
        private NodeTraces GetNodeTrace(Node nd, System.IO.StreamWriter file)
        {
            SetAllUnused();

            NodeTraces allNodeTrace = new NodeTraces();
            //NodeTraces extraNodeTrace = new NodeTraces();

            List<ContactSimple> inters = new List<ContactSimple>();
            inters.Add(nd.arcCollection[0]);
            //List<LineStruct> lines = new List<LineStruct>();
            //if (diffusionException.FindIndex(nameUnit => nameUnit == nd.name) >= 0)
            //	allNodeTrace.lines.Add( GetFixedLine(inters, inters[0].layer, nd.name) );

            List<int> currentConnection = new List<int>();
            for (int i = 0; i < nd.arcCollection.Count; i++)
            {

                if (currentConnection.FindIndex(el => el == i) < 0)
                {
                    List<int> curList = nodeDistanceDict[nd.name].GetConnectedPoints(i);
                    int curStart = curList.Min();

                    foreach (int curEnd in curList)
                    {
                        if (curStart != curEnd)
                        {
                            //NodeTraces curTrace = new NodeTraces();

                            int numbFixedWith = nodeDistanceDict[nd.name].GetFixedPointTo(curEnd);
                            if ((curStart == numbFixedWith) && (diffusionException.FindIndex(nameUnit => nameUnit == nd.name) >= 0))
                                allNodeTrace.AddTrace(RecoveryFixedPath(nd.arcCollection[curEnd], nd.name));
                            else
                                allNodeTrace.AddTrace(RecoveryUnicPath(allNodeTrace.lines, nd.arcCollection[curEnd],
                                                           nd.arcCollection[curStart], nd.name));
                            currentConnection.Add(curEnd);

                            //allNodeTrace.AddTrace(curTrace);
                        }
                    }
                }
            }

            //allNodeTrace.DefineCrossContacts(this);
            //allNodeTrace.AddTrace(extraNodeTrace);

            return allNodeTrace;
        }